diff --git a/Common/build.gradle.kts b/Common/build.gradle.kts index f823c9b78..767f5a084 100644 --- a/Common/build.gradle.kts +++ b/Common/build.gradle.kts @@ -3,13 +3,14 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { java - id("org.spongepowered.gradle.vanilla") + id("net.neoforged.moddev") `maven-publish` } // gradle.properties val jUnitVersion: String by extra val minecraftVersion: String by extra +val neoformTimestamp: String by extra val modId: String by extra val modJavaVersion: String by extra @@ -27,9 +28,9 @@ dependencyProjects.forEach { project.evaluationDependsOn(it.path) } -minecraft { - version(minecraftVersion) - // no runs are configured for Common +neoForge { + neoFormVersion = "$minecraftVersion-$neoformTimestamp" + addModdingDependenciesTo(sourceSets.test.get()) } sourceSets { diff --git a/CommonApi/build.gradle.kts b/CommonApi/build.gradle.kts index 8c1071cf8..85226eac5 100644 --- a/CommonApi/build.gradle.kts +++ b/CommonApi/build.gradle.kts @@ -1,12 +1,13 @@ plugins { java - id("org.spongepowered.gradle.vanilla") + id("net.neoforged.moddev") `maven-publish` } // gradle.properties val minecraftVersion: String by extra +val neoformTimestamp: String by extra val modId: String by extra val modJavaVersion: String by extra @@ -15,9 +16,8 @@ base { archivesName.set(baseArchivesName) } -minecraft { - version(minecraftVersion) - // no runs are configured for Common API +neoForge { + neoFormVersion = "$minecraftVersion-$neoformTimestamp" } sourceSets { diff --git a/Gui/build.gradle.kts b/Gui/build.gradle.kts index 3cb839b3a..e95ef5a7b 100644 --- a/Gui/build.gradle.kts +++ b/Gui/build.gradle.kts @@ -3,17 +3,17 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { java - id("org.spongepowered.gradle.vanilla") + id("net.neoforged.moddev") `maven-publish` } // gradle.properties val jUnitVersion: String by extra val minecraftVersion: String by extra +val neoformTimestamp: String by extra val modId: String by extra val modJavaVersion: String by extra - val baseArchivesName = "${modId}-${minecraftVersion}-gui" base { archivesName.set(baseArchivesName) @@ -29,9 +29,8 @@ dependencyProjects.forEach { project.evaluationDependsOn(it.path) } -minecraft { - version(minecraftVersion) - // no runs are configured for Gui +neoForge { + neoFormVersion = "$minecraftVersion-$neoformTimestamp" } sourceSets { diff --git a/Library/build.gradle.kts b/Library/build.gradle.kts index 891a62bef..fb7d88810 100644 --- a/Library/build.gradle.kts +++ b/Library/build.gradle.kts @@ -3,13 +3,14 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { java - id("org.spongepowered.gradle.vanilla") + id("net.neoforged.moddev") `maven-publish` } // gradle.properties val jUnitVersion: String by extra val minecraftVersion: String by extra +val neoformTimestamp: String by extra val modId: String by extra val modJavaVersion: String by extra @@ -28,9 +29,8 @@ dependencyProjects.forEach { project.evaluationDependsOn(it.path) } -minecraft { - version(minecraftVersion) - // no runs are configured for Library +neoForge { + neoFormVersion = "$minecraftVersion-$neoformTimestamp" } sourceSets { diff --git a/NeoForge/build.gradle.kts b/NeoForge/build.gradle.kts index 27881e515..2228c5623 100644 --- a/NeoForge/build.gradle.kts +++ b/NeoForge/build.gradle.kts @@ -1,5 +1,4 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge -import net.neoforged.gradle.dsl.common.runs.run.Run import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import net.darkhax.curseforgegradle.Constants as CFG_Constants @@ -11,7 +10,7 @@ plugins { id("maven-publish") id("net.darkhax.curseforgegradle") version("1.0.8") id("com.modrinth.minotaur") version("2.+") - id("net.neoforged.gradle.userdev") + id("net.neoforged.moddev") } // gradle.properties @@ -56,15 +55,13 @@ dependencyProjects.forEach { } project.evaluationDependsOn(":Changelog") -val notNeoTask = { it: Task -> !it.name.startsWith("neo") } - -tasks.withType().matching(notNeoTask).configureEach { +tasks.withType().configureEach { dependencyProjects.forEach { source(it.sourceSets.main.get().allSource) } } -tasks.withType().matching(notNeoTask).configureEach { +tasks.withType().configureEach { dependencyProjects.forEach { from(it.sourceSets.main.get().resources) } @@ -78,11 +75,6 @@ java { } dependencies { - implementation( - group = "net.neoforged", - name = "neoforge", - version = neoforgeVersion - ) dependencyProjects.forEach { implementation(it) } @@ -98,43 +90,44 @@ dependencies { ) } -minecraft { - accessTransformers { - file("src/main/resources/META-INF/accesstransformer.cfg") - } -} +neoForge { + version = neoforgeVersion + // MDG already defaults to this, but override it for clarity. + setAccessTransformers("src/main/resources/META-INF/accesstransformer.cfg") -fun commonRunProperties(run: Run) { - for (dependencyProject in dependencyProjects) { - run.modSources.add(project.name, dependencyProject.sourceSets.main.get()) - } -} + addModdingDependenciesTo(sourceSets.test.get()) -runs { - create("client") { - configure("client") - systemProperty("forge.logging.console.level", "debug") - workingDirectory(file("run/client/Dev")) - commonRunProperties(this) - } - create("client_01") { - configure("client") - workingDirectory(file("run/client/Player01")) - programArguments("--username", "Player01") - commonRunProperties(this) - } - create("client_02") { - configure("client") - workingDirectory(file("run/client/Player02")) - programArguments("--username", "Player02") - commonRunProperties(this) + mods { + create("jei") { + sourceSet(sourceSets.main.get()) + for (dependencyProject in dependencyProjects) { + sourceSet(dependencyProject.sourceSets.main.get()) + } + } } - create("server") { - configure("server") - systemProperty("forge.logging.console.level", "debug") - workingDirectory(file("run/server")) - programArguments("nogui") - commonRunProperties(this) + + runs { + create("client") { + client() + systemProperty("forge.logging.console.level", "debug") + gameDirectory = file("run/client/Dev") + } + create("client_01") { + client() + gameDirectory = file("run/client/Player01") + programArguments.addAll("--username", "Player01") + } + create("client_02") { + client() + gameDirectory = file("run/client/Player02") + programArguments.addAll("--username", "Player02") + } + create("server") { + server() + systemProperty("forge.logging.console.level", "debug") + gameDirectory = file("run/server") + programArguments.addAll("nogui") + } } } diff --git a/NeoForgeApi/build.gradle.kts b/NeoForgeApi/build.gradle.kts index dc9958a01..93c254f7b 100644 --- a/NeoForgeApi/build.gradle.kts +++ b/NeoForgeApi/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("java") id("maven-publish") - id("net.neoforged.gradle.userdev") + id("net.neoforged.moddev") } // gradle.properties @@ -47,22 +47,15 @@ java { } dependencies { - implementation( - group = "net.neoforged", - name = "neoforge", - version = neoforgeVersion - ) dependencyProjects.forEach { implementation(it) } } -minecraft { - accessTransformers { - // All minecraft configurations in the multi-project must be identical, including ATs, - // because of a ForgeGradle bug https://github.com/MinecraftForge/ForgeGradle/issues/844 - file("../Forge/src/main/resources/META-INF/accesstransformer.cfg") - } +neoForge { + version = neoforgeVersion + // We don't need the AT, but this allows MDG to share the recompiled Minecraft artifacts with the NeoForge project. + setAccessTransformers("../NeoForge/src/main/resources/META-INF/accesstransformer.cfg") } val sourcesJar = tasks.named("sourcesJar") diff --git a/build.gradle.kts b/build.gradle.kts index 3351aee8f..9deed8411 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,10 +3,8 @@ plugins { id("com.dorongold.task-tree") version("2.1.0") // https://maven.fabricmc.net/fabric-loom/fabric-loom.gradle.plugin/ id("fabric-loom") version("1.7.3") apply(false) - // https://projects.neoforged.net/neoforged/neogradle - id("net.neoforged.gradle.userdev") version("7.0.162") apply(false) - // https://repo.spongepowered.org/service/rest/repository/browse/maven-public/org/spongepowered/gradle/vanilla/org.spongepowered.gradle.vanilla.gradle.plugin/ - id("org.spongepowered.gradle.vanilla") version("0.2.1-SNAPSHOT") apply(false) + // https://projects.neoforged.net/neoforged/moddevgradle + id("net.neoforged.moddev") version("2.0.26-beta") apply(false) } apply { from("buildtools/ColoredOutput.gradle") diff --git a/gradle.properties b/gradle.properties index 98d135d0e..c0e86a0ec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,8 @@ githubUrl=https://github.com/mezz/JustEnoughItems # Minecraft minecraftVersion=1.21.1 minecraftVersionRange=[1.21, 1.21.1) +# https://projects.neoforged.net/neoforged/neoform +neoformTimestamp=20240808.144430 minecraftExtraCompatibleVersion=1.21