diff --git a/.gitignore b/.gitignore index 439658c..e5d0260 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ bin/ run/ **/build/ !src/**/build/ +remappedSrc/ # Ignore Gradle GUI config gradle-app.setting diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 626e0e1..76cd23b 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,13 @@ +# +#Wed May 01 20:37:56 IDT 2024 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=17 diff --git a/Hudder_client.launch b/Hudder_client.launch index 88d853e..98ce82c 100644 --- a/Hudder_client.launch +++ b/Hudder_client.launch @@ -1,22 +1,16 @@ - - - - - + - - - + diff --git a/Hudder_server.launch b/Hudder_server.launch index 10be6b6..9f05a3e 100644 --- a/Hudder_server.launch +++ b/Hudder_server.launch @@ -1,18 +1,15 @@ - + - - - diff --git a/build.gradle b/build.gradle index 5c6df37..9a39e77 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.5-SNAPSHOT' + id 'fabric-loom' version '1.6.5' id 'maven-publish' } @@ -51,8 +51,11 @@ dependencies { // https://mvnrepository.com/artifact/com.github.oshi/oshi-core //provided group: 'com.github.oshi', name: 'oshi-core', version: '6.5.0' - modImplementation("com.terraformersmc:modmenu:9.0.0-pre.1") - modImplementation("me.shedaniel.cloth:cloth-config-fabric:13.0.121") + modImplementation("com.terraformersmc:modmenu:10.0.0-beta.1") + modImplementation("me.shedaniel.cloth:cloth-config-fabric:14.0.126") + //modApi("me.shedaniel.cloth:cloth-config-fabric:14.0.126") { + // exclude(group: "net.fabricmc.fabric-api") + //} } processResources { diff --git a/gradle.properties b/gradle.properties index 47f06a9..0964bb1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.3 -loader_version=0.15.7 +minecraft_version=1.20.6 +yarn_mappings=1.20.6+build.1 +loader_version=0.15.10 # Mod Properties mod_version=3.0.0 @@ -14,4 +14,4 @@ maven_group=io.github.ngspace.hudder archives_base_name=hudder # Dependencies -fabric_version=0.96.4+1.20.4 \ No newline at end of file +fabric_version=0.97.8+1.20.6 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..e644113 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 ac72c34..b82aa23 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.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1..1aa94a4 100644 --- a/gradlew +++ b/gradlew @@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_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" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,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 +57,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/io/github/ngspace/hudder/data_management/StringData.java b/src/main/java/io/github/ngspace/hudder/data_management/StringData.java index b69bf43..1f3b1e7 100644 --- a/src/main/java/io/github/ngspace/hudder/data_management/StringData.java +++ b/src/main/java/io/github/ngspace/hudder/data_management/StringData.java @@ -34,23 +34,23 @@ public static String getString(String key) { if (i.isPresent()) yield i.get().getValue().toString(); yield null; - case "looking_at","block_in_front": { - HitResult vec = ins.player.raycast(PlayerEntity.getReachDistance(ins.player.isCreative()),0,true); - if (vec.getType()==Type.BLOCK) { - BlockHitResult res = (BlockHitResult) vec; - BlockState state = ins.player.getWorld().getBlockState(res.getBlockPos()); - yield Registries.BLOCK.getId(state.getBlock()).toString(); - } - yield ""; - } - case "looking_at_pos": { - HitResult vec = ins.player.raycast(PlayerEntity.getReachDistance(ins.player.isCreative()),0,true); - if (vec.getType()==Type.BLOCK) { - BlockPos res = ((BlockHitResult) vec).getBlockPos(); - yield "" + res.getX() + ' ' + res.getY() + ' ' + res.getZ(); - } - yield ""; - } +// case "looking_at","block_in_front": { +// HitResult vec = ins.player.raycast(PlayerEntity.getReachDistance(ins.player.isCreative()),0,true); +// if (vec.getType()==Type.BLOCK) { +// BlockHitResult res = (BlockHitResult) vec; +// BlockState state = ins.player.getWorld().getBlockState(res.getBlockPos()); +// yield Registries.BLOCK.getId(state.getBlock()).toString(); +// } +// yield ""; +// } +// case "looking_at_pos": { +// HitResult vec = ins.player.raycast(PlayerEntity.getReachDistance(ins.player.isCreative()),0,true); +// if (vec.getType()==Type.BLOCK) { +// BlockPos res = ((BlockHitResult) vec).getBlockPos(); +// yield "" + res.getX() + ' ' + res.getY() + ' ' + res.getZ(); +// } +// yield ""; +// } /* Hudder */ case "compilertype": yield ConfigManager.getConfig().compilertype; diff --git a/src/main/java/io/github/ngspace/hudder/meta/elements/GameHudElement.java b/src/main/java/io/github/ngspace/hudder/meta/elements/GameHudElement.java index 03cc486..f15bf26 100644 --- a/src/main/java/io/github/ngspace/hudder/meta/elements/GameHudElement.java +++ b/src/main/java/io/github/ngspace/hudder/meta/elements/GameHudElement.java @@ -2,10 +2,12 @@ import io.github.ngspace.hudder.Hudder; import io.github.ngspace.hudder.mixin.InGameHudAccessor; +import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.JumpingMount; +import static io.github.ngspace.hudder.Hudder.ins; /** * This element is a merging of all builtin GUI elements (Status bars) @@ -34,7 +36,6 @@ public GameHudElement(int x, int y, GuiType type) { @Override public void RenderElement(DrawContext context, float delta) { try { - InGameHud hud = Hudder.ins.inGameHud; InGameHudAccessor acchud = (InGameHudAccessor) (Hudder.ins.inGameHud); float scaledWidth = context.getScaledWindowWidth(); float scaledHeight = context.getScaledWindowHeight(); @@ -53,19 +54,33 @@ public GameHudElement(int x, int y, GuiType type) { JumpingMount jumpingMount = Hudder.ins.player.getJumpingMount(); if (jumpingMount != null) { matrixStack.translate(x-scaledWidth/2, y-scaledHeight + 39, 0f); - hud.renderMountJumpBar(jumpingMount, context, i); + acchud.callRenderMountJumpBar(jumpingMount, context, i); } else if (Hudder.ins.interactionManager.hasExperienceBar()) { matrixStack.translate(x-scaledWidth/2, y-scaledHeight + 35, 0f); - hud.renderExperienceBar(context, i); + TextRenderer textRenderer = ins.textRenderer; + int jj = ins.player.experienceLevel; + if (ins.interactionManager.hasExperienceBar() && jj > 0) { + ins.getProfiler().push("expLevel"); + String string = "" + jj; + int j = (context.getScaledWindowWidth() - textRenderer.getWidth(string)) / 2; + int k = context.getScaledWindowHeight() - 31 - 8; + context.drawText(textRenderer, string, j + 1, k, 0, false); + context.drawText(textRenderer, string, j - 1, k, 0, false); + context.drawText(textRenderer, string, j, k + 1, 0, false); + context.drawText(textRenderer, string, j, k - 1, 0, false); + context.drawText(textRenderer, string, j, k, 8453920, false); + ins.getProfiler().pop(); + } + acchud.callRenderExperienceBar(context, i); } break; case HOTBAR: matrixStack.translate(x-scaledWidth/2, y-scaledHeight, 0f); - acchud.callRenderHotbar(delta, context); + acchud.callRenderHotbar(context, delta); break; case ITEM_TOOLTIP: matrixStack.translate(x-scaledWidth/2, y-scaledHeight+45, 0f); - hud.renderHeldItemTooltip(context); + acchud.callRenderHeldItemTooltip(context); break; default: break; diff --git a/src/main/java/io/github/ngspace/hudder/mixin/InGameHudAccessor.java b/src/main/java/io/github/ngspace/hudder/mixin/InGameHudAccessor.java index 5f965b0..5bcd34d 100644 --- a/src/main/java/io/github/ngspace/hudder/mixin/InGameHudAccessor.java +++ b/src/main/java/io/github/ngspace/hudder/mixin/InGameHudAccessor.java @@ -5,10 +5,16 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; +import net.minecraft.entity.JumpingMount; @Mixin(InGameHud.class) public interface InGameHudAccessor { - @Invoker void callRenderStatusBars(DrawContext context); - @Invoker void callRenderMountHealth(DrawContext context); - @Invoker void callRenderHotbar(float timeDelta, DrawContext context); + @Invoker public void callRenderStatusBars(DrawContext context); + @Invoker public void callRenderMountHealth(DrawContext context); + @Invoker public void callRenderMountJumpBar(JumpingMount mount, DrawContext context, int x); + @Invoker public void callRenderExperienceBar(DrawContext context, int x); + @Invoker public void callRenderExperienceLevel(DrawContext context, float x); + @Invoker public void callRenderHeldItemTooltip(DrawContext context); + /** Mfers switched the parameters in 1.20.5... */ + @Invoker public void callRenderHotbar(DrawContext context, float timeDelta); } diff --git a/src/main/java/io/github/ngspace/hudder/mixin/InGameHudInjections.java b/src/main/java/io/github/ngspace/hudder/mixin/InGameHudInjections.java index 72c4a53..36b9c40 100644 --- a/src/main/java/io/github/ngspace/hudder/mixin/InGameHudInjections.java +++ b/src/main/java/io/github/ngspace/hudder/mixin/InGameHudInjections.java @@ -1,69 +1,24 @@ package io.github.ngspace.hudder.mixin; -import static io.github.ngspace.hudder.Hudder.config; -import static io.github.ngspace.hudder.Hudder.ins; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import io.github.ngspace.hudder.Hudder; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; -import net.minecraft.entity.JumpingMount; @Environment(EnvType.CLIENT) @Mixin(InGameHud.class) public class InGameHudInjections { - - public boolean shouldDraw() {return (!config.removegui)||(!config.shouldCompile(ins));} - - //Mount Jump Bar - - @Redirect(method = "render", at = @At(value = "INVOKE", target= - "Lnet/minecraft/client/gui/hud/InGameHud;renderMountJumpBar(Lnet/minecraft/entity/JumpingMount;Lnet/minecraft/client/gui/DrawContext;I)V")) - public void disableMountJumpBar(InGameHud hud, JumpingMount mount, DrawContext context, int x) { - if (shouldDraw()) hud.renderMountJumpBar(mount, context, x); - } - - //EXP - - @Redirect(method = "render", at = @At(value = "INVOKE", target= - "Lnet/minecraft/client/gui/hud/InGameHud;renderExperienceBar(Lnet/minecraft/client/gui/DrawContext;I)V")) - public void disableExperienceBar(InGameHud hud, DrawContext context, int x) { - if (shouldDraw()) hud.renderExperienceBar(context, x); - } - - //Hotbar - - @Redirect(method = "render", at = @At(value = "INVOKE", target= - "Lnet/minecraft/client/gui/hud/InGameHud;renderHotbar(FLnet/minecraft/client/gui/DrawContext;)V")) - public void disabledHotbar(InGameHud hud, float tickdelta, DrawContext context) { - if (shouldDraw()) ((InGameHudAccessor)hud).callRenderHotbar(tickdelta, context); - } - - //Status Bars - - @Redirect(method = "render", at = @At(value = "INVOKE", target= - "Lnet/minecraft/client/gui/hud/InGameHud;renderStatusBars(Lnet/minecraft/client/gui/DrawContext;)V")) - public void disableStatusBars(InGameHud hud, DrawContext context) { - if (shouldDraw()) ((InGameHudAccessor)hud).callRenderStatusBars(context); - } - - //Mount Health - - @Redirect(method = "render", at = @At(value = "INVOKE", target= - "Lnet/minecraft/client/gui/hud/InGameHud;renderMountHealth(Lnet/minecraft/client/gui/DrawContext;)V")) - public void disableMountHealth(InGameHud hud, DrawContext context) { - if (shouldDraw()) ((InGameHudAccessor)hud).callRenderMountHealth(context); - } - //Mount Health - - @Redirect(method = "render", at = @At(value = "INVOKE", target= - "Lnet/minecraft/client/gui/hud/InGameHud;renderHeldItemTooltip(Lnet/minecraft/client/gui/DrawContext;)V")) - public void renderHeldItemTooltip(InGameHud hud, DrawContext context) { - if (shouldDraw()) hud.renderHeldItemTooltip(context); - } -} + public boolean shouldNotDraw() {return Hudder.config.removegui&&Hudder.config.shouldCompile(Hudder.ins);} + + @Inject(method = "renderMainHud", at = @At("HEAD"),cancellable=true) + public void disableMainHud(DrawContext context, float x, CallbackInfo i) {if (shouldNotDraw()) i.cancel();} + @Inject(method = "renderExperienceLevel", at = @At("HEAD"),cancellable=true) + public void disableExperienceLevel(DrawContext context, float x, CallbackInfo i) {if (shouldNotDraw()) i.cancel();} +} \ No newline at end of file