diff --git a/build.gradle b/build.gradle index 75e03f9..139c6e2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,10 @@ plugins { - id 'org.quiltmc.loom' version '1.6.+' + id 'fabric-loom' version '1.7-SNAPSHOT' + id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = JavaVersion.VERSION_21 +targetCompatibility = JavaVersion.VERSION_21 archivesBaseName = project.archives_base_name version = project.mod_version @@ -37,7 +38,7 @@ processResources { tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" - it.options.release = 17 + it.options.release = 21 } java { diff --git a/gradle.properties b/gradle.properties index ff024c3..c34a037 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,19 @@ # Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs=-Xmx3G org.gradle.parallel=true # Fabric Properties - # check these on https://fabricmc.net/versions.html - minecraft_version=1.20.2 - yarn_mappings=1.20.2+build.4 - loader_version=0.14.22 +# check these on https://fabricmc.net/versions.html +minecraft_version=1.21 +yarn_mappings=1.21+build.9 +loader_version=0.16.0 # Mod Properties - mod_version = 1.1.5 - maven_group = hibi.boathud - archives_base_name = boathud +mod_version=1.1.5 +maven_group=hibi.boathud +archives_base_name=boathud # Dependencies - fabric_version=0.88.5+1.20.2 - menu_version=8.0.0-beta.2 - cloth_version=12.0.107 +fabric_version=0.100.7+1.21 +menu_version=11.0.1 +cloth_version=15.0.128 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..2c35211 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 b82aa23..09523c0 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.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..f5feea6 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,8 @@ 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 +' "$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 6689b85..9b42019 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/hibi/boathud/HudData.java b/src/main/java/hibi/boathud/HudData.java index 0c3924f..6d41ff9 100644 --- a/src/main/java/hibi/boathud/HudData.java +++ b/src/main/java/hibi/boathud/HudData.java @@ -23,7 +23,7 @@ public class HudData { private final PlayerListEntry listEntry; public HudData(){ - this.name = Common.client.player.getEntityName(); + this.name = Common.client.player.getName().getString(); this.listEntry = Common.client.getNetworkHandler().getPlayerListEntry(Common.client.player.getUuid()); } diff --git a/src/main/java/hibi/boathud/HudRenderer.java b/src/main/java/hibi/boathud/HudRenderer.java index 2d0be0a..11e066d 100644 --- a/src/main/java/hibi/boathud/HudRenderer.java +++ b/src/main/java/hibi/boathud/HudRenderer.java @@ -9,7 +9,7 @@ public class HudRenderer { - private static final Identifier WIDGETS_TEXTURE = new Identifier("boathud","textures/widgets.png"); + private static final Identifier WIDGETS_TEXTURE = Identifier.of("boathud","textures/widgets.png"); private final MinecraftClient client; private int scaledWidth; private int scaledHeight; diff --git a/src/main/java/hibi/boathud/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/hibi/boathud/mixin/ClientPlayNetworkHandlerMixin.java index 5684abd..4953c49 100644 --- a/src/main/java/hibi/boathud/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/hibi/boathud/mixin/ClientPlayNetworkHandlerMixin.java @@ -1,18 +1,16 @@ package hibi.boathud.mixin; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - import hibi.boathud.Common; import hibi.boathud.HudData; -import net.minecraft.client.world.ClientWorld; import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.network.packet.s2c.play.EntityPassengersSetS2CPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ClientPlayNetworkHandler.class) public class ClientPlayNetworkHandlerMixin { @@ -29,7 +27,7 @@ public class ClientPlayNetworkHandlerMixin { ) ) private void checkBoatEntry(EntityPassengersSetS2CPacket packet, CallbackInfo info) { - if(!(world.getEntityById(packet.getId()) instanceof BoatEntity)) return; + if(!(world.getEntityById(packet.getEntityId()) instanceof BoatEntity)) return; Common.ridingBoat = true; Common.hudData = new HudData(); } diff --git a/src/main/java/hibi/boathud/mixin/InGameHudMixin.java b/src/main/java/hibi/boathud/mixin/InGameHudMixin.java index c67f10b..623c66d 100644 --- a/src/main/java/hibi/boathud/mixin/InGameHudMixin.java +++ b/src/main/java/hibi/boathud/mixin/InGameHudMixin.java @@ -1,29 +1,36 @@ package hibi.boathud.mixin; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - import hibi.boathud.Common; import hibi.boathud.Config; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.gui.screen.ChatScreen; +import net.minecraft.client.render.RenderTickCounter; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(InGameHud.class) public class InGameHudMixin { - @Inject( - method = "render", - at = @At( - value = "INVOKE", - target = "net/minecraft/client/MinecraftClient.getProfiler()Lnet/minecraft/util/profiler/Profiler;", - ordinal = 8 - ) - ) - public void render(DrawContext graphics, float tickDelta, CallbackInfo info) { + //@Inject( + // method = "render", + // at = @At( + // value = "INVOKE", + // target = "net/minecraft/client/MinecraftClient.getProfiler()Lnet/minecraft/util/profiler/Profiler;", + // ordinal = 8 + // ) + //) + //public void render(DrawContext graphics, float tickDelta, CallbackInfo info) { + // if(Config.enabled && Common.ridingBoat && !(Common.client.currentScreen instanceof ChatScreen)) { + // Common.hudRenderer.render(graphics, tickDelta); + // } + //} + + @Inject(method = "renderChat", at = @At(value = "TAIL")) + public void render(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { if(Config.enabled && Common.ridingBoat && !(Common.client.currentScreen instanceof ChatScreen)) { - Common.hudRenderer.render(graphics, tickDelta); + Common.hudRenderer.render(context, tickCounter.getTickDelta(false)); } } } diff --git a/src/main/resources/boathud.mixins.json b/src/main/resources/boathud.mixins.json index 288dc38..ff4786d 100644 --- a/src/main/resources/boathud.mixins.json +++ b/src/main/resources/boathud.mixins.json @@ -3,7 +3,6 @@ "minVersion": "0.8", "package": "hibi.boathud.mixin", "compatibilityLevel": "JAVA_17", - "mixins": [], "client": [ "ClientPlayNetworkHandlerMixin", "InGameHudMixin" @@ -11,4 +10,4 @@ "injectors": { "defaultRequire": 1 } -} \ No newline at end of file +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index b31d92f..e6eddfe 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -2,38 +2,30 @@ "schemaVersion": 1, "id": "boathud", "version": "${version}", - "name": "BoatHud", "description": "This mod adds a racing style HUD, configurable, for riding a boat, and is designed mostly for racing boats on ice.", "authors": [ - "hibi" + "hibi", + "LordEnder_Kitty" ], "contact": { "homepage": "https://hibiscus.pet/mods/boathud", "sources": "https://github.com/Hibiii/BoatHud", "issues": "https://github.com/Hibiii/BoatHud/issues" }, - "license": "Unlicense", "icon": "assets/boathud/icon.png", - "environment": "client", "entrypoints": { - "client": [ - "hibi.boathud.Common" - ], - "modmenu": [ - "hibi.boathud.MenuInteg" - ] + "client": [ "hibi.boathud.Common" ], + "modmenu": [ "hibi.boathud.MenuInteg" ] }, - "mixins": [ - "boathud.mixins.json" - ], + "mixins": [ "boathud.mixins.json" ], "depends": { "fabricloader": ">=0.14.22", "fabric": "*", - "minecraft": ">=1.20.2", - "java": ">=17", + "minecraft": ">=1.21", + "java": ">=21", "cloth-config2": ">=12.0" }, "custom": { @@ -45,4 +37,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json index 762910f..96c1eec 100644 --- a/src/main/resources/quilt.mod.json +++ b/src/main/resources/quilt.mod.json @@ -8,7 +8,8 @@ "name": "BoatHud", "description": "This mod adds a racing style HUD, configurable, for riding a boat, and is designed mostly for racing boats on ice.", "contributors": { - "hibi": "Owner" + "hibi": "Owner", + "LordEnder_Kitty": "Contributor" }, "contact": { "homepage": "https://hibiscus.pet/mods/boathud", @@ -28,7 +29,7 @@ }, { "id": "minecraft", - "versions": ">=1.20.2" + "versions": ">=1.21" }, { "id": "cloth-config2", @@ -44,4 +45,4 @@ } }, "mixin": "boathud.mixins.json" -} \ No newline at end of file +}