diff --git a/build.gradle b/build.gradle index bb30258..5fec07a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.8-SNAPSHOT' + id 'fabric-loom' version '1.10-SNAPSHOT' id 'maven-publish' } @@ -9,6 +9,7 @@ targetCompatibility = JavaVersion.VERSION_21 archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +String minecraftVersion = project.minecraft_version repositories { // Add repositories to retrieve artifacts from in here. @@ -36,10 +37,12 @@ dependencies { } processResources { - inputs.property "version", project.version + inputs.properties "modVersion": project.version, + "mcVersion": minecraftVersion filesMatching("fabric.mod.json") { - expand "version": project.version + expand "modVersion": project.version, + "mcVersion": minecraftVersion } } diff --git a/gradle.properties b/gradle.properties index 85c7375..375896a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,13 +2,13 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21.3 -yarn_mappings=1.21.3+build.2 -loader_version=0.16.9 +minecraft_version=1.21.4 +yarn_mappings=1.21.4+build.8 +loader_version=0.16.10 # Mod Properties -mod_version = 1.21.3-0 +mod_version = 1.21.4-0 maven_group = com.daniking.backtools archives_base_name = backtools # Dependencies -fabric_version=0.107.0+1.21.3 -cloth_config_version=15.0.127 \ No newline at end of file +fabric_version=0.118.0+1.21.4 +cloth_config_version=17.0.144 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..a4b76b9 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 df97d72..37f853b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..f3b75f3 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/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/. @@ -84,7 +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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || 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 diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @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 ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +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 @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +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 diff --git a/src/main/java/com/daniking/backtools/BackToolFeatureRenderer.java b/src/main/java/com/daniking/backtools/BackToolFeatureRenderer.java index e54e32e..5fdeb00 100644 --- a/src/main/java/com/daniking/backtools/BackToolFeatureRenderer.java +++ b/src/main/java/com/daniking/backtools/BackToolFeatureRenderer.java @@ -23,8 +23,8 @@ public class BackToolFeatureRenderer extends Playe public ItemStack offStack = ItemStack.EMPTY; public Arm mainArm = Arm.RIGHT; - public BackToolFeatureRenderer(FeatureRendererContext context, ItemRenderer heldItemRenderer) { - super(context, heldItemRenderer); + public BackToolFeatureRenderer(FeatureRendererContext context) { + super(context); } @Override diff --git a/src/main/java/com/daniking/backtools/BackTools.java b/src/main/java/com/daniking/backtools/BackTools.java index 6531166..419002f 100644 --- a/src/main/java/com/daniking/backtools/BackTools.java +++ b/src/main/java/com/daniking/backtools/BackTools.java @@ -3,6 +3,8 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.ModInitializer; import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.Version; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -11,12 +13,13 @@ public class BackTools implements ModInitializer { public static final Logger LOGGER = LoggerFactory.getLogger(BackTools.class); - public static final String VERSION = "1.21.3-0"; - @Override public void onInitialize() { - BackTools.run(EnvType.SERVER, () -> () -> LOGGER.info("You are loading " + this.getClass().getName() + " on a server." + this.getClass().getName() + " is a client side-only mod!")); - BackTools.run(EnvType.CLIENT, () -> () -> LOGGER.info("BackTools V{} Initialized", VERSION)); + final @NotNull String modName = this.getClass().getSimpleName(); + final @NotNull Version version = FabricLoader.getInstance().getModContainer(modName.toLowerCase()).orElseThrow().getMetadata().getVersion(); + + BackTools.run(EnvType.SERVER, () -> () -> LOGGER.info("You are loading " + modName + " on a server." + modName + " is a client side-only mod!")); + BackTools.run(EnvType.CLIENT, () -> () -> LOGGER.info("{} V{} Initialized", modName, version.getFriendlyString())); } public static void run(final EnvType type, final Supplier supplier) { diff --git a/src/main/java/com/daniking/backtools/mixin/PlayerEntityRendererMixin.java b/src/main/java/com/daniking/backtools/mixin/PlayerEntityRendererMixin.java index b1b1489..be23d88 100644 --- a/src/main/java/com/daniking/backtools/mixin/PlayerEntityRendererMixin.java +++ b/src/main/java/com/daniking/backtools/mixin/PlayerEntityRendererMixin.java @@ -25,6 +25,6 @@ public PlayerEntityRendererMixin(EntityRendererFactory.Context ctx, M model, flo @Inject(method = "", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILSOFT) private void addRender(EntityRendererFactory.Context ctx, boolean slim, CallbackInfo ci) { - this.addFeature(new BackToolFeatureRenderer(this, ctx.getItemRenderer())); + this.addFeature(new BackToolFeatureRenderer(this)); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 88a04ba..2ddbf05 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "backtools", - "version": "${version}", + "version": "${modVersion}", "name": "BackTools", "description": "Shows the last used tool on the player's back. Purely aesthetic.", "authors": [ @@ -29,7 +29,7 @@ "depends": { "fabricloader": "*", "fabric": "*", - "minecraft": ">=1.21.3", + "minecraft": "=${mcVersion}", "cloth-config2": "*" } }