Skip to content

Commit

Permalink
Updated to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
LordEnder-Kitty committed Jul 27, 2024
1 parent 0e80fed commit 2286134
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 75 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -37,7 +38,7 @@ processResources {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
it.options.release = 21
}

java {
Expand Down
22 changes: 11 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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/.
Expand Down Expand Up @@ -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
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hibi/boathud/HudData.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hibi/boathud/HudRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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();
}
Expand Down
37 changes: 22 additions & 15 deletions src/main/java/hibi/boathud/mixin/InGameHudMixin.java
Original file line number Diff line number Diff line change
@@ -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));
}
}
}
3 changes: 1 addition & 2 deletions src/main/resources/boathud.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"minVersion": "0.8",
"package": "hibi.boathud.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [],
"client": [
"ClientPlayNetworkHandlerMixin",
"InGameHudMixin"
],
"injectors": {
"defaultRequire": 1
}
}
}
24 changes: 8 additions & 16 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -45,4 +37,4 @@
}
}
}
}
}
7 changes: 4 additions & 3 deletions src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -28,7 +29,7 @@
},
{
"id": "minecraft",
"versions": ">=1.20.2"
"versions": ">=1.21"
},
{
"id": "cloth-config2",
Expand All @@ -44,4 +45,4 @@
}
},
"mixin": "boathud.mixins.json"
}
}

0 comments on commit 2286134

Please sign in to comment.