diff --git a/forge/build.gradle b/forge/build.gradle index 1c597ff..4577cc2 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,98 +1,70 @@ import org.gradle.api.tasks.bundling.Jar plugins { - id 'net.minecraftforge.gradle' version '[6.0,6.2)' - id 'org.parchmentmc.librarian.forgegradle' version '1.+' - id 'org.spongepowered.mixin' version '0.7.+' + //id 'net.minecraftforge.gradle' version '[6.0,6.2)' + //id 'org.parchmentmc.librarian.forgegradle' version '1.+' + //id 'org.spongepowered.mixin' version '0.7.+' + id "net.neoforged.moddev.legacy" version "2.0.61-beta-pr-118-legacy" } archivesBaseName = "${rootProject.archive_base_name}-forge" -minecraft { - // Change to your preferred mappings - mappings channel: "parchment", version: "${rootProject.mappings_version}-${rootProject.minecraft_version}" - // Add your AccessTransformer - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - +neoForge { + version = "${project.minecraft_version}-${project.forge_version}" + def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg') + if (at.exists()) { + accessTransformers.add(at.absolutePath) + } + parchment { + minecraftVersion = rootProject.minecraft_version + mappingsVersion = rootProject.mappings_version + } runs { - // applies to all the run configs below - configureEach { - workingDirectory project.file('run') - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id - - mods { - "${mod_id}" { - source sourceSets.main - } - } - } - client { - property 'forge.enabledGameTestNamespaces', mod_id + client() } - - server { - workingDirectory project.file('run/server') - property 'forge.enabledGameTestNamespaces', mod_id - args '--nogui' + data { + data() } - - // This run config launches GameTestServer and runs all registered gametests, then exits. - // By default, the server will crash when no gametests are provided. - // The gametest system is also enabled by default for other run configs under the /test command. - gameTestServer { - property 'forge.enabledGameTestNamespaces', mod_id + server { + server() } - - data { - // example of overriding the workingDirectory set in configureEach above - workingDirectory project.file('run-data') - - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + } + mods { + "${mod_id}" { + sourceSet sourceSets.main } } } -mixin { - add sourceSets.main, "gtcore.refmap.json" - config "gtcore.mixins.json" - config "gtcore.jei.mixins.json" - debug.verbose = true - debug.export = true -} -jarJar.enable() + + dependencies { - minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}" annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' - implementation fg.deobf("io.github.gregtechintergalactical:antimatter-forge:${antimatter_version}") - implementation fg.deobf("io.github.gregtechintergalactical:tesseract-forge:${tesseract_version}"){ + modImplementation("io.github.gregtechintergalactical:antimatter-forge:${antimatter_version}") + modImplementation("io.github.gregtechintergalactical:tesseract-forge:${tesseract_version}"){ exclude(group: "maven.modrinth") } //modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}" - compileOnly fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}") - compileOnly fg.deobf("curse.maven:terrafirmacraft-302973:4723717") - implementation fg.deobf("earth.terrarium:botarium-forge-1.18.2:${project.botarium_version}") - implementation fg.deobf("com.teamresourceful.resourcefullib:resourcefullib-forge-1.18.2:${project.resourcefullib_version}") - implementation fg.deobf("io.github.reforgedmods.terraform-api:terraform-wood-api-v1:${project.terraform_version_forge}") + modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}") + modCompileOnly("curse.maven:terrafirmacraft-302973:4723717") + modImplementation("earth.terrarium:botarium-forge-1.18.2:${project.botarium_version}") + modImplementation("com.teamresourceful.resourcefullib:resourcefullib-forge-1.18.2:${project.resourcefullib_version}") + modImplementation("io.github.reforgedmods.terraform-api:terraform-wood-api-v1:${project.terraform_version_forge}") jarJar("io.github.reforgedmods.terraform-api:terraform-wood-api-v1:${project.terraform_version_forge}"){ - jarJar.ranged(it, "[3.1.5,)") + version{ + strictly("[3.1.5,)") + prefer(project.terraform_version_forge) + } } //modRuntimeOnly("mezz.jei:jei-${rootProject.minecraft_version}-forge:${rootProject.jei_version}") - implementation fg.deobf("maven.modrinth:carbon-config:${project.carbon_config_forge_version}") - runtimeOnly fg.deobf("curse.maven:the-twilight-forest-227639:4337390") + modImplementation("maven.modrinth:carbon-config:${project.carbon_config_forge_version}") + modRuntimeOnly("curse.maven:the-twilight-forest-227639:4337390") implementation("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}") - implementation fg.deobf("mezz.jei:jei-${rootProject.minecraft_version}-forge:${rootProject.jei_version}") - implementation fg.deobf("curse.maven:the-one-probe-245211:3965693") - implementation fg.deobf("com.gtnewhorizon.structurelib:structurelib-forge:${project.structurelib_version}-${project.minecraft_version}") - implementation fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}") + modImplementation("mezz.jei:jei-${rootProject.minecraft_version}-forge:${rootProject.jei_version}") + modImplementation("curse.maven:the-one-probe-245211:3965693") + modImplementation("com.gtnewhorizon.structurelib:structurelib-forge:${project.structurelib_version}-${project.minecraft_version}") } @@ -114,13 +86,20 @@ sourcesJar { from(project(':common').sourceSets.main.allSource) } -tasks.named('jarJar', Jar).configure { - archiveClassifier.set("") +mixin { + add sourceSets.main, "gtcore.refmap.json" + config "gtcore.mixins.json" + config "gtcore.jei.mixins.json" } +/*tasks.named('jarJar', Jar).configure { + archiveClassifier.set("") +}*/ + tasks.named('jar', Jar).configure { manifest { attributes([ + "MixinConfigs" : "gtcore.mixins.json", 'Specification-Title' : mod_id, 'Specification-Vendor' : "Trinsdar", 'Specification-Version' : '1', // We are version 1 of ourselves @@ -132,8 +111,8 @@ tasks.named('jar', Jar).configure { } // This is the preferred method to reobfuscate your jar file - finalizedBy 'reobfJar' - archiveClassifier.set "thin" + //finalizedBy 'reobfJar' + //archiveClassifier.set "thin" } publishing { @@ -141,7 +120,7 @@ publishing { mavenJava(org.gradle.api.publish.maven.MavenPublication) { artifactId = "gtcore-" + project.name from components.java - jarJar.component(it) + //jarJar.component(it) } } repositories { diff --git a/settings.gradle b/settings.gradle index e063373..d4a3bf3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -18,6 +18,16 @@ pluginManagement { } gradlePluginPortal() mavenCentral() + maven { + name 'Maven for PR #118' // https://github.com/neoforged/ModDevGradle/pull/118 + url 'https://prmaven.neoforged.net/ModDevGradle/pr118' + content { + includeModule('net.neoforged.moddev.legacy', 'net.neoforged.moddev.legacy.gradle.plugin') + includeModule('net.neoforged.moddev', 'net.neoforged.moddev.gradle.plugin') + includeModule('net.neoforged', 'moddev-gradle') + includeModule('net.neoforged.moddev.repositories', 'net.neoforged.moddev.repositories.gradle.plugin') + } + } } }