diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d62506c..1f03234a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: - name: Retrieve JSON run: | curl -Ls -o "headlessmc.json" "https://api.github.com/repos/3arthqu4ke/headlessmc/releases/tags/2.7.1" --header "Authorization: ${{ secrets.GITHUB_TOKEN }}" - curl -Ls -o "mc-runtime-test.json" "https://api.github.com/repos/null2264/mc-runtime-test/releases/tags/5.2.3" --header "Authorization: ${{ secrets.GITHUB_TOKEN }}" + curl -Ls -o "mc-runtime-test.json" "https://api.github.com/repos/null2264/mc-runtime-test/releases/tags/5.2.5" --header "Authorization: ${{ secrets.GITHUB_TOKEN }}" - name: Upload jar files uses: actions/upload-artifact@v4 @@ -98,11 +98,12 @@ jobs: 8 17 21 + 25 gradle-no-cache-if: true - name: Setup properties run: | - echo "org.gradle.java.installations.fromEnv=JAVA_HOME,JAVA_HOME_8_X64,JAVA_HOME_17_X64,JAVA_HOME_21_X64" >> gradle.properties + echo "org.gradle.java.installations.fromEnv=JAVA_HOME,JAVA_HOME_8_X64,JAVA_HOME_17_X64,JAVA_HOME_21_X64,JAVA_HOME_25_X64" >> gradle.properties - name: Build with Gradle run: | diff --git a/build.gradle.kts b/build.gradle.kts index 45ed0a4b..b4d271e7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,8 +7,9 @@ import org.apache.tools.ant.filters.StripJavaComments plugins { id("java") - id("architectury-plugin") version "3.4-SNAPSHOT" - id("io.github.null2264.architectury-loom") version "1.13-SNAPSHOT" apply false + id("architectury-plugin") version "3.4.164" + id("io.github.null2264.architectury-loom-remap") version "1.14-SNAPSHOT" apply false + id("io.github.null2264.architectury-loom-no-remap") version "1.14-SNAPSHOT" apply false id("com.gradleup.shadow") apply false id("me.modmuss50.mod-publish-plugin") version "1.1.0" } @@ -19,13 +20,11 @@ val loaderName = project.properties["null2264.platform"] as? String ?: "" val isForge = loaderName.endsWith("forge") val isNeo = loaderName.endsWith("neoforge") val isFabric = loaderName.endsWith("fabric") -val _mcVer = project.properties["mcVer"] as? String ?: "" -val mcVersionStr = if (_mcVer.startsWith("1.")) _mcVer else "2.$_mcVer" -val (major, minor, patch, hotfix) = mcVersionStr +val mcVersionStr = project.properties["mcVer"] as? String ?: "" +val (major, minor, patch) = mcVersionStr .split(".") .toMutableList() - .apply { while (this.size < 4) this.add("") } -val mcHotfix: Int = hotfix.toIntOrNull() ?: 0 + .apply { while (this.size < 3) this.add("") } val mcVersion: Int = "${major}${minor.padStart(2, '0')}${patch.padStart(2, '0')}".toInt() val versionRange = supportedVersionRange(mcVersion, loaderName) @@ -33,7 +32,6 @@ fun setupPreprocessor() { val buildProps = buildString { append("# DON'T TOUCH THIS FILE, This is handled by the build script\n") append("MC=${mcVersion}\n") - append("BUILD=${mcHotfix}\n") if (isFabric) append("FABRIC=1\n") if (isForge) append("FORGE=${if (!isNeo) "1" else "2"}\n") } @@ -43,7 +41,7 @@ fun setupPreprocessor() { setupPreprocessor() architectury { - minecraft = MC.versioned(mcVersion, mcHotfix) + minecraft = MC.versioned(mcVersion) } allprojects { @@ -52,7 +50,6 @@ allprojects { ext["mcVersion"] = mcVersion ext["mcVersionStr"] = mcVersionStr - ext["mcHotfix"] = mcHotfix ext["loaderName"] = loaderName ext["isFabric"] = isFabric ext["isForge"] = isForge @@ -132,11 +129,14 @@ subprojects { if (isModModule) { // NOTE: This must be set before archloom is applied! extra.set("loom.platform", loaderName) - } - if (isMcModule) { apply(plugin = "architectury-plugin") - apply(plugin = "io.github.null2264.architectury-loom") + + if (mcVersion < 260100) { + apply(plugin = "io.github.null2264.architectury-loom-remap") + } else { + apply(plugin = "io.github.null2264.architectury-loom-no-remap") + } val arch = project.extensions["architectury"] as ArchitectPluginExtension arch.apply { if (isModModule) @@ -184,18 +184,18 @@ subprojects { } val loom by lazy { - if (!isMcModule) { - throw IllegalStateException("Loom only available for MC modules") + if (!isModModule) { + throw IllegalStateException("Loom only available for submodules that applied Loom") } project.the() } dependencies { - if (isMcModule) { + if (isModModule) { val minecraft by configurations val mappings by configurations - minecraft(MC.versioned(mcVersion, mcHotfix)) + minecraft(MC.versioned(mcVersion)) mappings(loom.officialMojangMappings()) } @@ -207,8 +207,8 @@ subprojects { if (isModModule) { compileOnly(project(":stubs")) - compileInternal(project(":mclib", configuration = "namedElements")) { isTransitive = false } - shadeInternal(project(":mclib", configuration = "transformProduction$loaderProd")) { + compileInternal(project(":mclib")) { isTransitive = false } + shadeInternal(project(":mclib")) { // Remove Junit test libraries exclude(group = "org.junit.jupiter", module = "junit-jupiter") exclude(group = "org.junit.jupiter", module = "junit-jupiter-engine") @@ -302,7 +302,13 @@ subprojects { } val targetJavaVersion = if (!isApi) { - if (mcVersion >= 12006) 21 else (if (mcVersion >= 11700) 17 else 8) + when (mcVersion) { + in 11200..11605 -> 8 + in 11700..11701 -> 16 + in 11800..12004 -> 17 + in 12005..12111 -> 21 + else -> 25 + } } else { 8 // APIs should always target Java 8 } diff --git a/buildSrc/src/main/kotlin/VersionRange.kt b/buildSrc/src/main/kotlin/VersionRange.kt index 9a08ac7c..7a54f419 100644 --- a/buildSrc/src/main/kotlin/VersionRange.kt +++ b/buildSrc/src/main/kotlin/VersionRange.kt @@ -71,7 +71,8 @@ fun supportedVersionRange(mcVersion: Int, loader: String): VersionRange { in 12100..12101 -> VersionRange("1.20.x", "1.21.1") in 12102..12104 -> VersionRange("1.21.1", "1.21.4") in 12105..12110 -> VersionRange("1.21.4", "1.21.10") - 12111 -> VersionRange("1.21.10", null) + 12111 -> VersionRange("1.21.10", "1.21.11") + 22601 -> VersionRange("1.21.11", null) else -> VersionRange(null, null) } } diff --git a/buildSrc/src/main/kotlin/dependencies/Create.kt b/buildSrc/src/main/kotlin/dependencies/Create.kt index 4c7ec30e..8401b13e 100644 --- a/buildSrc/src/main/kotlin/dependencies/Create.kt +++ b/buildSrc/src/main/kotlin/dependencies/Create.kt @@ -4,7 +4,7 @@ fun createMod(isNeo: Boolean) = Dependency( group = "com.simibubi.create", // Create finally support Neo on 1.21.1 name = "create" + (if (!isNeo) "-1.18.2" else "-1.21.1"), - version = { mcVersion, hotfix -> + version = { mcVersion -> val version = if (!isNeo) "0.5.1.e-318" else "6.0.4-59" return@Dependency "$version:slim" }, diff --git a/buildSrc/src/main/kotlin/dependencies/Dependencies.kt b/buildSrc/src/main/kotlin/dependencies/Dependencies.kt index f78e1291..7acba737 100644 --- a/buildSrc/src/main/kotlin/dependencies/Dependencies.kt +++ b/buildSrc/src/main/kotlin/dependencies/Dependencies.kt @@ -3,26 +3,42 @@ package dependencies data class Dependency( private val group: String, private val name: String, - private val version: (Int, Int) -> String, + private val version: (Int) -> String, ) { - fun versioned(mcVersion: Int, mcBuild: Int): String = "${group}:${name}:${version(mcVersion, mcBuild)}" + fun versioned(mcVersion: Int): String = "${group}:${name}:${version(mcVersion)}" } -fun versionStr(versionCode: Int, hotfix: Int = 0, alwaysShowHotfix: Boolean = false): String { +fun legacyVersionStr(versionCode: Int): String { val versionCodeStr = versionCode.toString() val major = versionCodeStr.getOrNull(0)?.toString() ?: "0" val minor = versionCodeStr - .substring(1, 3 + (versionCodeStr.length - 5)) // Future proofing, in case "1.100.0" happened + .substring(1, 3) .padStart(2, '0') .trimStart('0') val patch = versionCodeStr - .substring(3 + (versionCodeStr.length - 5)) + .substring(3) .padEnd(1, '0').trimStart('0') + + if (patch.isEmpty()) return "$major.$minor" + return "$major.$minor.$patch" +} + +/** + * Transform version code (e.g. 260100) back to formatted string (e.g. 26.01). + */ +fun versionStr(versionCode: Int, alwaysShowHotfix: Boolean = false): String { + val versionCodeStr = versionCode.toString() + if (versionCodeStr.length == 5) return legacyVersionStr(versionCode) - if (major.toInt() <= 1) { - if (patch.isEmpty()) return "$major.$minor" - return "$major.$minor.$patch" - } + val year = versionCodeStr.substring(0, 2) + val release = versionCodeStr + .substring(2, 4) + .trimStart('0') + .let { if (it == "") "0" else it } + val hotfix = versionCodeStr + .substring(4) + .trimStart('0') + .let { if (it == "" && alwaysShowHotfix) "0" else it } - return if (hotfix > 0 || alwaysShowHotfix) "$minor.$patch.$hotfix" else "$minor.$patch" + return if (hotfix != "") "$year.$release.$hotfix" else "$year.$release" } diff --git a/buildSrc/src/main/kotlin/dependencies/FabricAPI.kt b/buildSrc/src/main/kotlin/dependencies/FabricAPI.kt index 1032f2f4..07fb5c42 100644 --- a/buildSrc/src/main/kotlin/dependencies/FabricAPI.kt +++ b/buildSrc/src/main/kotlin/dependencies/FabricAPI.kt @@ -3,7 +3,7 @@ package dependencies val fapi = Dependency( group = "net.fabricmc.fabric-api", name = "fabric-api", - version = { mcVersion, hotfix -> + version = { mcVersion -> when (mcVersion) { 11605 -> "0.42.0+1.16" 11802 -> "0.76.0+1.18.2" @@ -16,6 +16,7 @@ val fapi = Dependency( in 12102..12104 -> "0.106.1+1.21.3" in 12105..12110 -> "0.119.9+1.21.5" 12111 -> "0.139.5+1.21.11" + 260100 -> "0.141.1+26.1" else -> throw IllegalStateException("$mcVersion is not yet supported!") } }, @@ -24,9 +25,11 @@ val fapi = Dependency( val fapiGameTest = Dependency( group = "net.fabricmc.fabric-api", name = "fabric-gametest-api-v1", - version = { mcVersion, hotfix -> + version = { mcVersion -> when (mcVersion) { - 12105 -> "3.1.2+2a6ec84b49" + in 12105..12110 -> "3.1.2+2a6ec84b49" + 12111 -> "3.1.27+4fc5413f3e" + 260100 -> "4.0.0+574290bac9" else -> throw IllegalStateException("$mcVersion is not yet supported!") } }, @@ -35,7 +38,7 @@ val fapiGameTest = Dependency( val fapiResourceLoader = Dependency( group = "net.fabricmc.fabric-api", name = "fabric-resource-loader-v0", - version = { mcVersion, hotfix -> + version = { mcVersion -> when (mcVersion) { 12105 -> "3.1.6+02ca679649" else -> throw IllegalStateException("$mcVersion is not yet supported!") diff --git a/buildSrc/src/main/kotlin/dependencies/LexForge.kt b/buildSrc/src/main/kotlin/dependencies/LexForge.kt index 54969660..dac39b98 100644 --- a/buildSrc/src/main/kotlin/dependencies/LexForge.kt +++ b/buildSrc/src/main/kotlin/dependencies/LexForge.kt @@ -3,7 +3,7 @@ package dependencies val lexForge = Dependency( group = "net.minecraftforge", name = "forge", - version = { mcVersion, hotfix -> + version = { mcVersion -> val version = when (mcVersion) { 11605 -> "36.2.41" 11802 -> "40.2.9" diff --git a/buildSrc/src/main/kotlin/dependencies/Minecraft.kt b/buildSrc/src/main/kotlin/dependencies/Minecraft.kt index c0fc00b8..a8726c6a 100644 --- a/buildSrc/src/main/kotlin/dependencies/Minecraft.kt +++ b/buildSrc/src/main/kotlin/dependencies/Minecraft.kt @@ -3,11 +3,12 @@ package dependencies val minecraft = Dependency( group = "com.mojang", name = "minecraft", - version = { mcVersion, hotfix -> + version = { mcVersion -> when (mcVersion) { // For snapshots //12100 -> "some snapshot" - else -> versionStr(mcVersion, hotfix) + 260100 -> "26.1-snapshot-1" + else -> versionStr(mcVersion) } }, ) diff --git a/buildSrc/src/main/kotlin/dependencies/NeoForge.kt b/buildSrc/src/main/kotlin/dependencies/NeoForge.kt index 8a173e7a..22c97903 100644 --- a/buildSrc/src/main/kotlin/dependencies/NeoForge.kt +++ b/buildSrc/src/main/kotlin/dependencies/NeoForge.kt @@ -3,7 +3,7 @@ package dependencies val neoForge = Dependency( group = "net.neoforged", name = "neoforge", - version = { mcVersion, hotfix -> + version = { mcVersion -> val version = when (mcVersion) { // snapshot version format: // "0-alpha.${mc[mcVersion]}.+" @@ -11,16 +11,13 @@ val neoForge = Dependency( 12004 -> "237" in 12005..12006 -> "121" in 12100..12101 -> "129" - in 12102..12104 -> "1-beta" - in 12105..12110 -> "25-beta" - 12111 -> "24-beta" - 22601 -> when (hotfix) { - 0 -> "0-alpha.4+snapshot-1" - else -> throw IllegalStateException("Hotfix $hotfix is not yet supported!") - } + in 12102..12104 -> "96" + in 12105..12110 -> "97" + 12111 -> "42" + 260100 -> "19-beta" else -> throw IllegalStateException("Version $mcVersion is not yet supported!") } - val mc = versionStr(mcVersion, hotfix, true).substring(2) + val mc = versionStr(mcVersion, true).let { if (mcVersion>=260100) it else it.substring(2) } "${mc}.${version}" }, diff --git a/buildSrc/src/main/kotlin/dependencies/RecipeViewer.kt b/buildSrc/src/main/kotlin/dependencies/RecipeViewer.kt index b1d84496..7a4636c9 100644 --- a/buildSrc/src/main/kotlin/dependencies/RecipeViewer.kt +++ b/buildSrc/src/main/kotlin/dependencies/RecipeViewer.kt @@ -6,7 +6,7 @@ fun emi(mcVersion: Int, loader: String? = null, api: Boolean = false) = Dependen // EMI migrate to NeoForge after 1.20.2 if (loader != "fabric" && mcVersion <= 12002) "emi-forge" else "emi-$loader" } else "emi", - version = { _, _ -> + version = { _ -> buildString { if (mcVersion <= 11802) { append("0.7.3+${versionStr(mcVersion)}") // There are no multi-loader support in 1.18.2 @@ -22,6 +22,7 @@ fun emi(mcVersion: Int, loader: String? = null, api: Boolean = false) = Dependen 12003 -> "1.20.2" in 12005..12006 -> "1.20.6" in 12100..12111 -> "1.21.1" + 260100 -> "1.21.1" // FIXME: Not confirmed, but EMI might skip 1.21.11 for 26.1 else -> throw IllegalStateException("$mcVersion is not yet supported!") } ) @@ -38,7 +39,7 @@ fun rei(loader: String, api: Boolean = false) = Dependency( } else { "RoughlyEnoughItems-$loader" }, - version = { mcVersion, hotfix -> + version = { mcVersion -> // They didn't break API on MC version upgrade so mismatch should be fine when (mcVersion) { 11802 -> "8.3.618" @@ -48,7 +49,9 @@ fun rei(loader: String, api: Boolean = false) = Dependency( in 12002..12004 -> "13.0.685" in 12005..12006 -> "15.0.787" in 12100..12101 -> "16.0.788" - in 12102..12111 -> "17.0.789" + in 12102..12110 -> "17.0.789" + 12111 -> "17.0.789" // FIXME: Broken in 1.21.11, waiting for new release + 260100 -> "17.0.789" else -> throw IllegalStateException("$mcVersion is not yet supported!") } }, @@ -69,6 +72,7 @@ fun jei(mcVersion: Int, loader: String, common: Boolean = false, api: Boolean = in 12005..12006 -> versionStr(mcVersion) in 12100..12110 -> "1.21.1" 12111 -> "1.21.11" + 260100 -> "1.21.11" else -> throw IllegalStateException("$mcVersion is not yet supported!") } ) @@ -83,7 +87,7 @@ fun jei(mcVersion: Int, loader: String, common: Boolean = false, api: Boolean = append ("-api") } }, - version = { _, _ -> + version = { _ -> // They didn't break API on MC version upgrade so mismatch should be fine when (mcVersion) { 11802 -> "10.2.1.1009" @@ -94,6 +98,7 @@ fun jei(mcVersion: Int, loader: String, common: Boolean = false, api: Boolean = in 12005..12006 -> "18.0.0.62" in 12100..12110 -> "19.21.1.248" 12111 -> "27.3.0.14" + 260100 -> "27.3.0.14" else -> throw IllegalStateException("$mcVersion is not yet supported!") } }, diff --git a/cobblegen/build.gradle.kts b/cobblegen/build.gradle.kts index 8aa5d771..6a86bfb5 100644 --- a/cobblegen/build.gradle.kts +++ b/cobblegen/build.gradle.kts @@ -7,7 +7,6 @@ plugins { val mcVersion = ext["mcVersion"] as Int val mcVersionStr = ext["mcVersionStr"] as String -val mcHotfix = ext["mcHotfix"] as Int val loaderName = ext["loaderName"] as String val isFabric = ext["isFabric"] as Boolean val isForge = ext["isForge"] as Boolean @@ -84,17 +83,20 @@ dependencies { // Only use gametest API for 1.21.5+, because the full FAPI is causing crashes on dev env // REF: https://github.com/FabricMC/fabric/issues/4491 if (mcVersion in 11606..12104) { - modLocalRuntime(fapi.versioned(mcVersion, mcHotfix)) - } else if (mcVersion in 12105..12110) { - // FIXME: Is Resource Loader even needed? - //modLocalRuntime(fapiResourceLoader.versioned(mcVersion, mcHotfix)) - modLocalRuntime(fapiGameTest.versioned(mcVersion, mcHotfix)) + modLocalRuntime(fapi.versioned(mcVersion)) + } else { + try { + // FIXME: Is Resource Loader even needed? + //modLocalRuntime(fapiResourceLoader.versioned(mcVersion)) + modLocalRuntime(fapiGameTest.versioned(mcVersion)) + } catch (e: IllegalStateException) { + } } } else { if (!isNeo) { - "forge"(lexForge.versioned(mcVersion, mcHotfix)) + "forge"(lexForge.versioned(mcVersion)) } else { - "neoForge"(neoForge.versioned(mcVersion, mcHotfix)) + "neoForge"(neoForge.versioned(mcVersion)) } } @@ -110,19 +112,19 @@ dependencies { // <- EMI if (mcVersion <= 11802) { - modCompileOnly(emi(mcVersion, null, api = true).versioned(0, 0)) + modCompileOnly(emi(mcVersion, null, api = true).versioned(0)) if (project.properties["recipe_viewer"] == "emi" && isFabric) - modLocalRuntime(emi(mcVersion).versioned(0, 0)) + modLocalRuntime(emi(mcVersion).versioned(0)) } else { - modCompileOnly(emi(mcVersion, loaderName, api = true).versioned(0, 0)) + modCompileOnly(emi(mcVersion, loaderName, api = true).versioned(0)) if (project.properties["recipe_viewer"] == "emi") - modLocalRuntime(emi(mcVersion, loaderName).versioned(0, 0)) + modLocalRuntime(emi(mcVersion, loaderName).versioned(0)) } // EMI -> // <- REI // Use the full package instead of 'api-' for (neo)forge, since the 'api-' didn't include @REIPlugin* - modCompileOnly(rei(loaderName, true).versioned(mcVersion, mcHotfix)) + modCompileOnly(rei(loaderName, true).versioned(mcVersion)) if (mcVersion in 12002..12104) { // FIXME: Not sure why it's not included modCompileOnly("me.shedaniel.cloth:basic-math:0.6.1") modCompileOnly("dev.architectury:architectury:11.1.13") @@ -130,15 +132,15 @@ dependencies { if (project.properties["recipe_viewer"] == "rei") { if (mcVersion == 11902) // REI's stupid dep bug modLocalRuntime("dev.architectury:architectury-fabric:6.5.77") - modLocalRuntime(rei(loaderName).versioned(mcVersion, mcHotfix)) + modLocalRuntime(rei(loaderName).versioned(mcVersion)) } // REI -> // <- JEI - modCompileOnly(jei(mcVersion, loaderName, common = true, api = true).versioned(0, 0)) - modCompileOnly(jei(mcVersion, loaderName, common = false, api = true).versioned(0, 0)) + modCompileOnly(jei(mcVersion, loaderName, common = true, api = true).versioned(0)) + modCompileOnly(jei(mcVersion, loaderName, common = false, api = true).versioned(0)) if (project.properties["recipe_viewer"] == "jei") - modCompileOnly(jei(mcVersion, loaderName, common = false, api = false).versioned(0, 0)) + modCompileOnly(jei(mcVersion, loaderName, common = false, api = false).versioned(0)) // JEI -> /* FIXME: Broken, somehow diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f..f8e1ee31 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0ceb5e90..23449a2b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1 +1,7 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index f5feea6d..adff685a 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -115,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -173,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -206,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 9d21a218..e509b2dd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,94 +1,93 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/mclib/build.gradle.kts b/mclib/build.gradle.kts index b464b761..a8a9fe46 100644 --- a/mclib/build.gradle.kts +++ b/mclib/build.gradle.kts @@ -1,6 +1,18 @@ +plugins { + id("org.spongepowered.gradle.vanilla") +} + +minecraft { + version(project.ext["mcVersionStr"] as String) +} + +repositories { + maven("https://repo.spongepowered.org/maven/") +} + dependencies { // Mostly for Mixin and Arch's dependant on Fabric's @Environment annotations - modCompileOnly("net.fabricmc:fabric-loader:0.17.2") + compileOnly("org.spongepowered:mixin:0.8.5") } publishing { diff --git a/settings.gradle.kts b/settings.gradle.kts index e052f1c9..d4b610c6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -10,16 +10,26 @@ pluginManagement { maven("https://repo.spongepowered.org/maven/") gradlePluginPortal() } + val mcVer: String by settings + val (major, minor, patch) = mcVer + .split(".") + .toMutableList() + .apply { while (this.size < 3) this.add("") } + val mcVersion: Int = "${major}${minor.padStart(2, '0')}${patch.padStart(2, '0')}".toInt() + resolutionStrategy { eachPlugin { if (requested.id.id == "org.spongepowered.gradle.vanilla") { - // REF: https://repo.spongepowered.org/#browse/browse:maven-public:org%2Fspongepowered%2Fvanillagradle%2F0.2.1-SNAPSHOT - useModule("org.spongepowered:vanillagradle:0.2.1-20240507.024226-82") + val targetModule = when (mcVersion) { + in 11605..12111 -> "org.spongepowered:vanillagradle:0.2.2-SNAPSHOT" + else -> "org.spongepowered:vanillagradle:0.3.0-SNAPSHOT" + } + useModule(targetModule) } } } plugins { - id("com.gradleup.shadow") version "8.3.5" + id("com.gradleup.shadow") version "9.3.1" id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" } } diff --git a/stubs/build.gradle.kts b/stubs/build.gradle.kts index 78857248..7ac407db 100644 --- a/stubs/build.gradle.kts +++ b/stubs/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT" + id("org.spongepowered.gradle.vanilla") } minecraft { diff --git a/versions.json b/versions.json index 19316cd2..3cd4874f 100644 --- a/versions.json +++ b/versions.json @@ -32,6 +32,9 @@ { "mc": "1.21.5", "loader": "neoforge", "java": "21", "testVersions": ["1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10"] }, { "mc": "1.21.11", "loader": "fabric", "java": "21", "testVersions": ["1.21.11"] }, - { "mc": "1.21.11", "loader": "neoforge", "java": "21", "testVersions": ["1.21.11"] } + { "mc": "1.21.11", "loader": "neoforge", "java": "21", "testVersions": ["1.21.11"] }, + + { "mc": "26.1", "loader": "fabric", "java": "25", "testVersions": ["26.1"] }, + { "mc": "26.1", "loader": "neoforge", "java": "25", "testVersions": ["26.1"] } ] }