Skip to content

Commit

Permalink
fix for 1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
NGSpace committed May 2, 2024
1 parent 8940bc7 commit 5a225e8
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 117 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bin/
run/
**/build/
!src/**/build/
remappedSrc/

# Ignore Gradle GUI config
gradle-app.setting
Expand Down
9 changes: 9 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -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
10 changes: 2 additions & 8 deletions Hudder_client.launch
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Hudder"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
<mapEntry key="[debug]" value="org.eclipse.jdt.launching.localJavaApplication"/>
<mapEntry key="[run]" value="org.eclipse.jdt.launching.localJavaApplication"/>
</mapAttribute>
<mapAttribute key="org.eclipse.debug.core.environmentVariables"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.fabricmc.devlaunchinjector.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Hudder"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Hudder"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dfabric.dli.config=D:\GitsProj\Hudder\.gradle\loom-cache\launch.cfg -Dfabric.dli.env=client -Dfabric.dli.main=net.fabricmc.loader.impl.launch.knot.KnotClient"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:Hudder}/run"/>
Expand Down
5 changes: 1 addition & 4 deletions Hudder_server.launch
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Hudder"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<mapAttribute key="org.eclipse.debug.core.environmentVariables"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.fabricmc.devlaunchinjector.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Hudder"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="nogui"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Hudder"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dfabric.dli.config=D:\GitsProj\Hudder\.gradle\loom-cache\launch.cfg -Dfabric.dli.env=server -Dfabric.dli.main=net.fabricmc.loader.impl.launch.knot.KnotServer"/>
Expand Down
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.6.5'
id 'maven-publish'
}

Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ 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
maven_group=io.github.ngspace.hudder
archives_base_name=hudder

# Dependencies
fabric_version=0.96.4+1.20.4
fabric_version=0.97.8+1.20.6
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.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ 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
case $MAX_FD in #(
'' | 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
Expand Down Expand Up @@ -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" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
@@ -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();}
}

0 comments on commit 5a225e8

Please sign in to comment.