diff --git a/.github/workflows/dev_build.yml b/.github/workflows/dev_build.yml index 893674b7..5952dc8f 100644 --- a/.github/workflows/dev_build.yml +++ b/.github/workflows/dev_build.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: persist-credentials: false diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c0a3db5e..e09298e8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: persist-credentials: false diff --git a/README.md b/README.md index d86bde41..858d7689 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ To update this template to a newer Minecraft version, follow these steps: 2. Update `gradle/libs.versions.toml` (the versions catalog): - Set the version entries to the new versions. Common keys to update are: - `versions.minecraft` - Minecraft version - - `versions.yarn-mappings` - Yarn mappings - `versions.fabric-loader` - Fabric loader version - `versions.meteor` - Meteor Client snapshot version - If your addon depends on other libraries listed under the `[libraries]` section, update their versions there as @@ -53,7 +52,7 @@ To update this template to a newer Minecraft version, follow these steps: - Windows (cmd.exe): `gradlew.bat wrapper --gradle-version && gradlew.bat wrapper` - This updates and regenerates the Gradle Wrapper scripts (`gradlew`, `gradlew.bat`, etc.) for the specified version. 5. Update your source code: - - Adjust for Minecraft or Yarn mapping changes: method names, imports, mixins, etc. + - Adjust for Minecraft source changes: method names, imports, mixins, etc. - Check for Meteor Client API changes that may affect your addon by comparing against the [master branch](https://github.com/MeteorDevelopment/meteor-client/tree/master). 6. Build and test: diff --git a/build.gradle.kts b/build.gradle.kts index 5c21a65b..884f02c4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,10 +2,13 @@ plugins { alias(libs.plugins.fabric.loom) } +val archivesBaseName = providers.gradleProperty("archives_base_name").get() +val mavenGroup = providers.gradleProperty("maven_group").get() + base { - archivesName = properties["archives_base_name"] as String + archivesName = archivesBaseName version = libs.versions.mod.version.get() - group = properties["maven_group"] as String + group = mavenGroup } repositories { @@ -35,12 +38,24 @@ java { } fun toMinecraftCompat(version: String): String { - val match = Regex("""^(\d{2})\.([1-9]\d*)(?:\.([1-9]\d*))?$""") - .matchEntire(version) - ?: error("Invalid Minecraft version format: $version. Expected YY.D or YY.D.H") + val stable = Regex("""^(\d{2})\.([1-9]\d*)(?:\.(\d+))?$""") + + stable.matchEntire(version)?.let { + val (year, drop, _) = it.destructured + return "~$year.$drop" + } + + val pre = Regex("""^(\d{2})\.([1-9]\d*)-pre[-.](\d+)$""") + pre.matchEntire(version)?.let { + return version.replace("-pre-", "-pre.") + } + + val rc = Regex("""^(\d{2})\.([1-9]\d*)-rc[-.](\d+)$""") + rc.matchEntire(version)?.let { + return version.replace("-rc-", "-rc.") + } - val (year, drop, _) = match.destructured - return "~$year.$drop" + return version } tasks { @@ -58,10 +73,10 @@ tasks { } jar { - inputs.property("archivesName", project.base.archivesName.get()) + inputs.property("archivesName", archivesBaseName) from("LICENSE") { - rename { "${it}_${inputs.properties["archivesName"]}" } + rename { "${it}_$archivesBaseName" } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 837ada03..90a6bce2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,22 +3,20 @@ mod-version = "0.1.0" # Fabric (https://fabricmc.net/develop) jdk = "25" -minecraft = "26.1.2" -yarn-mappings = "1.21.11+build.3" -fabric-loader = "0.19.2" +minecraft = "26.2" +fabric-loader = "0.19.3" # Loom (https://github.com/FabricMC/fabric-loom) -loom = "1.16-SNAPSHOT" +loom = "1.17-SNAPSHOT" # Meteor (https://github.com/MeteorDevelopment/meteor-client/) -meteor = "26.1.2-SNAPSHOT" +meteor = "26.2-SNAPSHOT" # Mods [libraries] # Fabric base minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } -yarn = { module = "net.fabricmc:yarn", version.ref = "yarn-mappings" } fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" } # Meteor client diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d997cfc6..b1b8ef56 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 c61a118f..a9db1155 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 739907df..249efbb0 100755 --- a/gradlew +++ b/gradlew @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/gradlew.bat b/gradlew.bat index c4bdd3ab..a51ec4f5 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,12 +19,12 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -51,7 +51,7 @@ 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 +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -65,29 +65,18 @@ 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 +"%COMSPEC%" /c exit 1 :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" %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -: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 +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL%