Skip to content

Commit 64371d4

Browse files
authored
Fix a crash caused by the HotbarHud on 1.20.1 (#88)
- fix x scaling of the Hotbar Texture on 1.20.1 - no other changes
2 parents d38a4ea + c400ded commit 64371d4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

1.20/src/main/java/io/github/axolotlclient/mixin/InGameHudMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ public abstract class InGameHudMixin {
131131
public void axolotlclient$setItemNamePos(Args args) {
132132
HotbarHUD hud = (HotbarHUD) HudManager.getInstance().get(HotbarHUD.ID);
133133
if (hud.isEnabled()) {
134-
args.set(2, ((Integer) hud.getX()).floatValue() + ((hud.getWidth() * hud.getScale())
134+
args.set(2, hud.getX() + (int)((hud.getWidth() * hud.getScale())
135135
- MinecraftClient.getInstance().textRenderer.getWidth((StringVisitable) args.get(1))) / 2);
136-
args.set(3, ((Integer) hud.getY()).floatValue() - 36
136+
args.set(3, hud.getY() - 36
137137
+ (!MinecraftClient.getInstance().interactionManager.hasStatusBars() ? 14 : 0));
138138
}
139139
}

1.20/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/vanilla/HotbarHUD.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void renderComponent(GuiGraphics graphics, float delta) {
5656
ItemStack itemStack = playerEntity.getOffHandStack();
5757
Arm arm = playerEntity.getMainArm().getOpposite();
5858
DrawPosition pos = getPos();
59-
int i = (pos.x() + getWidth()) / 2;
59+
int i = pos.x() + getWidth() / 2;
6060
graphics.getMatrices().push();
6161
graphics.getMatrices().translate(0.0F, 0.0F, -90.0F);
6262
graphics.drawTexture(WIDGETS_TEXTURE, i - 91, pos.y(), 0, 0, 182, 22);

0 commit comments

Comments
 (0)