From 81b9cfe1129c48c56ac62afa9290377e959f7c79 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 25 Sep 2024 14:26:10 +0200 Subject: [PATCH] basic 1.21 setup --- build.gradle | 37 ++++++++++++++----- gradle.properties | 26 ++++++------- gradle/wrapper/gradle-wrapper.properties | 3 +- .../{mods.toml => neoforge.mods.toml} | 0 4 files changed, 42 insertions(+), 24 deletions(-) rename src/main/resources/META-INF/{mods.toml => neoforge.mods.toml} (100%) diff --git a/build.gradle b/build.gradle index 1bab577a..7b25e21c 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,16 @@ plugins { id 'eclipse' id 'idea' id 'maven-publish' - id 'net.neoforged.gradle.userdev' version '7.0.80' + id 'net.neoforged.gradle.userdev' version '7.0.163' +} + +tasks.named('wrapper', Wrapper).configure { + // Define wrapper values here so as to not have to always do so when updating gradlew.properties. + // Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with + // documentation attached on cursor hover of gradle classes and methods. However, this comes with increased + // file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards. + // (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`) + distributionType = Wrapper.DistributionType.BIN } version = mod_version @@ -24,8 +33,8 @@ base { archivesName = mod_name } -// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. -java.toolchain.languageVersion = JavaLanguageVersion.of(17) +// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21. +java.toolchain.languageVersion = JavaLanguageVersion.of(21) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" runs { @@ -53,7 +62,7 @@ runs { server { systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - programArgument '--nogui' + argument '--nogui' } // This run config launches GameTestServer and runs all registered gametests, then exits. @@ -68,7 +77,7 @@ runs { // workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + arguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() } } @@ -89,8 +98,8 @@ dependencies { compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}" runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}" - runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}" - compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api" +// runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}" +// compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api" compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}:api" runtimeOnly "vazkii.patchouli:Patchouli:${patchouli_version}" @@ -119,8 +128,8 @@ tasks.withType(ProcessResources).configureEach { ] inputs.properties replaceProperties - filesMatching(['META-INF/mods.toml']) { - expand replaceProperties + [project: project] + filesMatching(['META-INF/neoforge.mods.toml']) { + expand replaceProperties } } @@ -145,4 +154,12 @@ publishing { tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} \ No newline at end of file +} + +// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. +idea { + module { + downloadSources = true + downloadJavadoc = true + } +} diff --git a/gradle.properties b/gradle.properties index a1fb0a25..4d51c271 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,27 +1,27 @@ +org.gradle.jvmargs=-Xmx1G +org.gradle.daemon=false org.gradle.debug=false #read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings # you can also find the latest versions at: https://parchmentmc.org/docs/getting-started -neogradle.subsystems.parchment.minecraftVersion=1.20.3 -neogradle.subsystems.parchment.mappingsVersion=2023.12.31 +neogradle.subsystems.parchment.minecraftVersion=1.21 +neogradle.subsystems.parchment.mappingsVersion=2024.07.28 # Environment Properties # You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge # The Minecraft version must agree with the Neo version to get a valid artifact -minecraft_version=1.20.4 -# The Minecraft version range can use any release version of Minecraft as bounds. -# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly -# as they do not follow standard versioning conventions. -minecraft_version_range=[1.20.4,1.21) +minecraft_version=1.21.1 +minecraft_version_range=[1.21.1,1.22) # The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=20.4.198 +neo_version=21.1.45 # The Neo version range can use any version of Neo as bounds -neo_version_range=[20.4,) +neo_version_range=[21.1.0,) # The loader version range can only use the major version of FML as bounds -loader_version_range=[2,) +loader_version_range=[4,) -jei_version=17.3.0.48 -curios_version=7.2.0+1.20.4 -patchouli_version=1.20.4-85-NEOFORGE-SNAPSHOT +jei_version=19.18.3.204 +# TODO what to do about curios being discontinued? try out https://www.curseforge.com/minecraft/mc-mods/adorned? +# curios_version=7.2.0+1.20.4 +patchouli_version=1.21-87-NEOFORGE ## Mod Properties # The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d3..09523c0e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/neoforge.mods.toml similarity index 100% rename from src/main/resources/META-INF/mods.toml rename to src/main/resources/META-INF/neoforge.mods.toml