buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } mavenCentral() maven { url = 'https://repo.spongepowered.org/repository/maven-public' } maven { url = 'https://maven.parchmentmc.org' } } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forgegradle_version}", changing: false classpath "org.spongepowered:mixingradle:${mixingradle_version}" classpath "org.parchmentmc:librarian:${librarian_version}" } } plugins { id 'com.matthewprenger.cursegradle' version "${cursegradle_version}" } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'org.spongepowered.mixin' jarJar.enable() boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); ext.buildNumber = System.getenv('BUILD_NUMBER') group = 'com.jozufozu.flywheel' archivesBaseName = "flywheel-forge-${artifact_minecraft_version}" version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" runs { client { workingDirectory project.file('run') property 'forge.logging.markers', '' property 'forge.logging.console.level', 'debug' property 'mixin.debug.export', 'true' property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" property 'flw.dumpShaderSource', 'true' property 'flw.loadRenderDoc', 'true' property 'flw.debugMemorySafety', 'true' arg '-mixin.config=flywheel.mixins.json' mods { flywheel { source sourceSets.main } } } server { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg '-mixin.config=flywheel.mixins.json' mods { flywheel { source sourceSets.main } } } data { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', 'flywheel', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { flywheel { source sourceSets.main } } } } } repositories { maven { url 'https://www.cursemaven.com' content { includeGroup "curse.maven" } } maven { name 'tterrag maven' url 'https://maven.tterrag.com/' } maven { name = "Modrinth" url = "https://api.modrinth.com/maven" content { includeGroup "maven.modrinth" } } mavenCentral() } // Fix for loading non-mod libraries in dev-env, used for JOML and Miniball. // https://gist.github.com/SizableShrimp/66b22f1b24c255e1491c8d98d3f11f83 // v--------------------------------------------------------------------v configurations { library implementation.extendsFrom library } minecraft.runs.all { lazyToken('minecraft_classpath') { configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) } } // ^--------------------------------------------------------------------^ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" jarJar('org.joml:joml:1.10.5') { jarJar.ranged(it, '[1.10.0,1.11.0)') } library 'org.joml:joml:1.10.5' jarJar('com.dreizak:miniball:1.0.3') { jarJar.ranged(it, '[1.0,2.0)') } library 'com.dreizak:miniball:1.0.3' // switch to implementation for debugging compileOnly fg.deobf("maven.modrinth:starlight-forge:1.0.2+1.18.2") compileOnly fg.deobf("maven.modrinth:rubidium:0.5.3a") compileOnly fg.deobf("maven.modrinth:oculus:1.18.2-1.2.5a") // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly if (System.getProperty('idea.sync.active') != 'true') { annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" } } test { useJUnitPlatform() } mixin { add sourceSets.main, 'flywheel.refmap.json' } // Workaround for SpongePowered/MixinGradle#38 afterEvaluate { tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava) tasks.configureReobfTaskForReobfJarJar.mustRunAfter(tasks.compileJava) } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } javadoc { source = [sourceSets.main.allJava] // prevent java 8's strict doclint for javadocs from failing builds options.addStringOption('Xdoclint:none', '-quiet') } compileJava { options.compilerArgs = ['-Xdiags:verbose'] } jar { manifest { attributes([ 'Specification-Title' : 'flywheel', //'Specification-Vendor': 'flywheel authors', 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.jar.baseName, 'Implementation-Version' : project.jar.archiveVersion, //'Implementation-Vendor': 'flywheel authors', 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), 'MixinConfigs' : 'flywheel.mixins.json' ]) } } java { withSourcesJar() withJavadocJar() } void addLicense(jarTask) { jarTask.from('LICENSE.md') { rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' } } jar.finalizedBy('reobfJar') tasks.jarJar.finalizedBy('reobfJarJar') addLicense(jar) addLicense(tasks.jarJar) publishing { publications { mavenJava(MavenPublication) { artifactId = archivesBaseName from components.java fg.component(it) jarJar.component(it) } } repositories { if (project.hasProperty('mavendir')) { maven { url mavendir } } } } tasks.curseforge.enabled = !dev && project.hasProperty('jozu_curseforge_key') curseforge { if (project.hasProperty('jozu_curseforge_key')) { apiKey = project.jozu_curseforge_key } project { id = project.projectId changelog = file('changelog.txt') releaseType = project.curse_type mainArtifact jar addGameVersion '1.18.2' } }