Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit a72869e

Browse files
committed
fix levelhead rendering bugs
1 parent 1618433 commit a72869e

File tree

10 files changed

+48
-214
lines changed

10 files changed

+48
-214
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/mixin/EntityRendererMixin.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import io.github.axolotlclient.modules.hypixel.LevelHead;
3030
import io.github.axolotlclient.modules.hypixel.NickHider;
3131
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
32+
import io.github.axolotlclient.util.ClientColors;
3233
import io.github.axolotlclient.util.Util;
3334
import net.minecraft.client.MinecraftClient;
3435
import net.minecraft.client.font.TextRenderer;
@@ -123,9 +124,13 @@ public abstract class EntityRendererMixin<T extends Entity> {
123124
float x = -textRenderer.getWidth(text) / 2F;
124125
float y = string.getString().contains("deadmau5") ? -20 : -10;
125126

127+
if (LevelHead.getInstance().background.get()) {
128+
y -= 2;
129+
}
130+
126131
Matrix4f matrix4f = matrices.peek().getModel();
127132
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
128-
LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(),
133+
ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(),
129134
matrix4f, vertexConsumers, true, LevelHead.getInstance().background.get() ? bgColor : 0,
130135
light);
131136
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
@@ -139,9 +144,13 @@ public abstract class EntityRendererMixin<T extends Entity> {
139144
float x = -textRenderer.getWidth(text) / 2F;
140145
float y = string.getString().contains("deadmau5") ? -20 : -10;
141146

147+
if (LevelHead.getInstance().background.get()) {
148+
y -= 2;
149+
}
150+
142151
Matrix4f matrix4f = matrices.peek().getModel();
143152
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
144-
LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(),
153+
ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(),
145154
matrix4f, vertexConsumers, true, LevelHead.getInstance().background.get() ? bgColor : 0,
146155
light);
147156
MinecraftClient.getInstance().textRenderer.draw(text, x, y,

1.16_combat-6/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
import com.mojang.blaze3d.systems.RenderSystem;
3333
import io.github.axolotlclient.AxolotlClient;
3434
import io.github.axolotlclient.api.requests.UserRequest;
35-
import io.github.axolotlclient.api.util.UUIDHelper;
36-
import io.github.axolotlclient.modules.hypixel.LevelHead;
3735
import io.github.axolotlclient.modules.hypixel.NickHider;
3836
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsGame;
3937
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
@@ -52,7 +50,6 @@
5250
import net.minecraft.scoreboard.ScoreboardObjective;
5351
import net.minecraft.text.StringVisitable;
5452
import net.minecraft.text.Text;
55-
import net.minecraft.util.Formatting;
5653
import org.spongepowered.asm.mixin.Final;
5754
import org.spongepowered.asm.mixin.Mixin;
5855
import org.spongepowered.asm.mixin.Shadow;
@@ -95,16 +92,6 @@ private Text nickHider(PlayerListEntry entry, Operation<Text> original) {
9592
}
9693
if (Tablist.getInstance().numericalPing.get())
9794
width += (instance.getWidth(String.valueOf(entry.getLatency())) - 10);
98-
if (BedwarsMod.getInstance().isEnabled() && BedwarsMod.getInstance().isWaiting()) {
99-
if (!entry.getProfile().getName().contains(Formatting.OBFUSCATED.toString())) {
100-
try {
101-
String uuid = UUIDHelper.toUndashed(entry.getProfile().getId());
102-
String render = LevelHead.getDisplayString(LevelHead.Mode.BEDWARS, uuid);
103-
width += instance.getWidth(render) + 2;
104-
} catch (Exception ignored) {
105-
}
106-
}
107-
}
10895
return width;
10996
}
11097

@@ -159,35 +146,6 @@ private Text nickHider(PlayerListEntry entry, Operation<Text> original) {
159146
return Tablist.getInstance().alwaysShowHeadLayer.get() || instance.isPartVisible(modelPart);
160147
}
161148

162-
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;renderLatencyIcon(Lnet/minecraft/client/util/math/MatrixStack;IIILnet/minecraft/client/network/PlayerListEntry;)V"))
163-
private void axolotlclient$renderWithoutObjective(PlayerListHud instance, MatrixStack matrixStack, int width, int x, int y, PlayerListEntry playerListEntry, Operation<Void> original) {
164-
if (!BedwarsMod.getInstance().isEnabled() || !BedwarsMod.getInstance().isWaiting()) {
165-
original.call(instance, matrixStack, width, x, y, playerListEntry);
166-
return;
167-
}
168-
int endX = x + width - 1;
169-
String render;
170-
try {
171-
if (playerListEntry.getProfile().getName().contains(Formatting.OBFUSCATED.toString())) {
172-
original.call(instance, matrixStack, width, x, y, playerListEntry);
173-
return;
174-
}
175-
176-
String uuid = UUIDHelper.toUndashed(playerListEntry.getProfile().getId());
177-
render = LevelHead.getDisplayString(LevelHead.Mode.BEDWARS, uuid);
178-
} catch (Exception e) {
179-
original.call(instance, matrixStack, width, x, y, playerListEntry);
180-
return;
181-
}
182-
DrawableHelper.drawStringWithShadow(matrixStack,
183-
client.textRenderer,
184-
render,
185-
(endX - this.client.textRenderer.getWidth(render)) + 20,
186-
y,
187-
-1
188-
);
189-
}
190-
191149
@Inject(
192150
method = "renderScoreboardObjective",
193151
at = @At(

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import io.github.axolotlclient.modules.hypixel.LevelHead;
3131
import io.github.axolotlclient.modules.hypixel.NickHider;
3232
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
33+
import io.github.axolotlclient.util.ClientColors;
3334
import io.github.axolotlclient.util.Util;
3435
import net.minecraft.client.MinecraftClient;
3536
import net.minecraft.client.font.TextRenderer;
@@ -138,9 +139,13 @@ private boolean enableShadows(boolean par5, @Local Matrix4f matrix4f) {
138139
float x = -textRenderer.getWidth(text) / 2F;
139140
float y = string.getString().contains("deadmau5") ? -20 : -10;
140141

142+
if (LevelHead.getInstance().background.get()) {
143+
y -= 2;
144+
}
145+
141146
Matrix4f matrix4f = matrices.peek().getModel();
142147
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
143-
LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(),
148+
ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(),
144149
matrix4f, vertexConsumers, TextRenderer.TextLayerType.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0,
145150
light);
146151
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
@@ -153,9 +158,13 @@ private boolean enableShadows(boolean par5, @Local Matrix4f matrix4f) {
153158
float x = -textRenderer.getWidth(text) / 2F;
154159
float y = string.getString().contains("deadmau5") ? -20 : -10;
155160

161+
if (LevelHead.getInstance().background.get()) {
162+
y -= 2;
163+
}
164+
156165
Matrix4f matrix4f = matrices.peek().getModel();
157166
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
158-
LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(),
167+
ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(),
159168
matrix4f, vertexConsumers, TextRenderer.TextLayerType.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0,
160169
light);
161170
MinecraftClient.getInstance().textRenderer.draw(text, x, y,

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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import com.mojang.blaze3d.systems.RenderSystem;
3434
import io.github.axolotlclient.AxolotlClient;
3535
import io.github.axolotlclient.api.requests.UserRequest;
36-
import io.github.axolotlclient.api.util.UUIDHelper;
37-
import io.github.axolotlclient.modules.hypixel.LevelHead;
3836
import io.github.axolotlclient.modules.hypixel.NickHider;
3937
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsGame;
4038
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
@@ -50,7 +48,6 @@
5048
import net.minecraft.scoreboard.ScoreboardObjective;
5149
import net.minecraft.text.StringVisitable;
5250
import net.minecraft.text.Text;
53-
import net.minecraft.util.Formatting;
5451
import org.spongepowered.asm.mixin.Final;
5552
import org.spongepowered.asm.mixin.Mixin;
5653
import org.spongepowered.asm.mixin.Shadow;
@@ -92,16 +89,6 @@ private Text nickHider(PlayerListEntry entry, Operation<Text> original) {
9289
}
9390
if (Tablist.getInstance().numericalPing.get())
9491
width += (instance.getWidth(String.valueOf(entry.getLatency())) - 10);
95-
if (BedwarsMod.getInstance().isEnabled() && BedwarsMod.getInstance().isWaiting()) {
96-
if (!entry.getProfile().getName().contains(Formatting.OBFUSCATED.toString())) {
97-
try {
98-
String uuid = UUIDHelper.toUndashed(entry.getProfile().getId());
99-
String render = LevelHead.getDisplayString(LevelHead.Mode.BEDWARS, uuid);
100-
width += instance.getWidth(render) + 2;
101-
} catch (Exception ignored) {
102-
}
103-
}
104-
}
10592
return width;
10693
}
10794

@@ -155,34 +142,6 @@ private Text nickHider(PlayerListEntry entry, Operation<Text> original) {
155142
return drawHat || Tablist.getInstance().alwaysShowHeadLayer.get();
156143
}
157144

158-
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;renderLatencyIcon(Lnet/minecraft/client/gui/GuiGraphics;IIILnet/minecraft/client/network/PlayerListEntry;)V"))
159-
private void axolotlclient$renderWithoutObjective(PlayerListHud instance, GuiGraphics guiGraphics, int width, int x, int y, PlayerListEntry playerListEntry, Operation<Void> original) {
160-
if (!BedwarsMod.getInstance().isEnabled() || !BedwarsMod.getInstance().isWaiting()) {
161-
original.call(instance, guiGraphics, width, x, y, playerListEntry);
162-
return;
163-
}
164-
int endX = x + width - 1;
165-
String render;
166-
try {
167-
if (playerListEntry.getProfile().getName().contains(Formatting.OBFUSCATED.toString())) {
168-
original.call(instance, guiGraphics, width, x, y, playerListEntry);
169-
return;
170-
}
171-
172-
String uuid = UUIDHelper.toUndashed(playerListEntry.getProfile().getId());
173-
render = LevelHead.getDisplayString(LevelHead.Mode.BEDWARS, uuid);
174-
} catch (Exception e) {
175-
original.call(instance, guiGraphics, width, x, y, playerListEntry);
176-
return;
177-
}
178-
guiGraphics.drawShadowedText(client.textRenderer,
179-
render,
180-
(endX - this.client.textRenderer.getWidth(render)) + 20,
181-
y,
182-
-1
183-
);
184-
}
185-
186145
@Inject(
187146
method = "renderScoreboardObjective",
188147
at = @At(

1.21.7/src/main/java/io/github/axolotlclient/mixin/EntityRendererMixin.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import io.github.axolotlclient.modules.hypixel.LevelHead;
3030
import io.github.axolotlclient.modules.hypixel.NickHider;
3131
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
32+
import io.github.axolotlclient.util.ClientColors;
3233
import io.github.axolotlclient.util.Util;
3334
import net.minecraft.client.Minecraft;
3435
import net.minecraft.client.gui.Font;
@@ -146,8 +147,12 @@ private int getNameOffset(Player entity) {
146147
float x = -textRenderer.width(text) / 2F;
147148
float y = c.getString().contains("deadmau5") ? -20 : -10;
148149

150+
if (LevelHead.getInstance().background.get()) {
151+
y -= 2;
152+
}
153+
149154
Matrix4f matrix4f = matrices.last().pose();
150-
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0, light);
155+
textRenderer.drawInBatch(text, x, y, ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0, light);
151156
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.NORMAL, 0, light);
152157
}
153158
} else if (LevelHead.getInstance().enabled.get()) {
@@ -156,8 +161,12 @@ private int getNameOffset(Player entity) {
156161
float x = -textRenderer.width(text) / 2F;
157162
float y = c.getString().contains("deadmau5") ? -20 : -10;
158163

164+
if (LevelHead.getInstance().background.get()) {
165+
y -= 2;
166+
}
167+
159168
Matrix4f matrix4f = matrices.last().pose();
160-
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0, light);
169+
textRenderer.drawInBatch(text, x, y, ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.SEE_THROUGH, LevelHead.getInstance().background.get() ? bgColor : 0, light);
161170
textRenderer.drawInBatch(text, x, y, LevelHead.getInstance().textColor.get().toInt(), AxolotlClient.config().useShadows.get(), matrix4f, vertexConsumers, Font.DisplayMode.NORMAL, 0, light);
162171
}
163172
}

1.21.7/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@
3232
import com.llamalad7.mixinextras.sugar.Local;
3333
import io.github.axolotlclient.AxolotlClient;
3434
import io.github.axolotlclient.api.requests.UserRequest;
35-
import io.github.axolotlclient.api.util.UUIDHelper;
36-
import io.github.axolotlclient.modules.hypixel.LevelHead;
3735
import io.github.axolotlclient.modules.hypixel.NickHider;
3836
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsGame;
3937
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
4038
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsPlayer;
4139
import io.github.axolotlclient.modules.tablist.Tablist;
42-
import net.minecraft.ChatFormatting;
4340
import net.minecraft.client.Minecraft;
4441
import net.minecraft.client.gui.Font;
4542
import net.minecraft.client.gui.GuiGraphics;
@@ -93,16 +90,6 @@ private Component nickHider(PlayerInfo playerInfo, Operation<Component> original
9390
UserRequest.getOnline(info.getProfile().getId().toString())) width += 10;
9491
if (Tablist.getInstance().numericalPing.get())
9592
width += (instance.width(String.valueOf(info.getLatency())) - 10);
96-
if (BedwarsMod.getInstance().isEnabled() && BedwarsMod.getInstance().isWaiting()) {
97-
if (!info.getProfile().getName().contains(ChatFormatting.OBFUSCATED.toString())) {
98-
try {
99-
String uuid = UUIDHelper.toUndashed(info.getProfile().getId());
100-
String render = LevelHead.getDisplayString(LevelHead.Mode.BEDWARS, uuid);
101-
width += instance.width(render) + 2;
102-
} catch (Exception ignored) {
103-
}
104-
}
105-
}
10693
return width;
10794
}
10895

@@ -163,34 +150,6 @@ private Component nickHider(PlayerInfo playerInfo, Operation<Component> original
163150
return drawHat || Tablist.getInstance().alwaysShowHeadLayer.get();
164151
}
165152

166-
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/PlayerTabOverlay;renderPingIcon(Lnet/minecraft/client/gui/GuiGraphics;IIILnet/minecraft/client/multiplayer/PlayerInfo;)V"))
167-
private void renderWithoutObjective(PlayerTabOverlay instance, GuiGraphics guiGraphics, int width, int x, int y, PlayerInfo playerInfo, Operation<Void> original) {
168-
if (!BedwarsMod.getInstance().isEnabled() || !BedwarsMod.getInstance().isWaiting()) {
169-
original.call(instance, guiGraphics, width, x, y, playerInfo);
170-
return;
171-
}
172-
int endX = x + width - 1;
173-
String render;
174-
try {
175-
if (playerInfo.getProfile().getName().contains(ChatFormatting.OBFUSCATED.toString())) {
176-
original.call(instance, guiGraphics, width, x, y, playerInfo);
177-
return;
178-
}
179-
180-
String uuid = UUIDHelper.toUndashed(playerInfo.getProfile().getId());
181-
render = LevelHead.getDisplayString(LevelHead.Mode.BEDWARS, uuid);
182-
} catch (Exception e) {
183-
original.call(instance, guiGraphics, width, x, y, playerInfo);
184-
return;
185-
}
186-
guiGraphics.drawString(minecraft.font,
187-
render,
188-
(endX - minecraft.font.width(render)) + 20,
189-
y,
190-
-1
191-
);
192-
}
193-
194153
@Inject(method = "renderTablistScore", at = @At(value = "INVOKE",
195154
target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;III)V"),
196155
cancellable = true)

1.21/src/main/java/io/github/axolotlclient/mixin/EntityRendererMixin.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import io.github.axolotlclient.modules.hypixel.LevelHead;
3131
import io.github.axolotlclient.modules.hypixel.NickHider;
3232
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
33+
import io.github.axolotlclient.util.ClientColors;
3334
import io.github.axolotlclient.util.Util;
3435
import net.minecraft.client.MinecraftClient;
3536
import net.minecraft.client.font.TextRenderer;
@@ -139,9 +140,13 @@ public abstract class EntityRendererMixin<T extends Entity> {
139140
float x = -textRenderer.getWidth(text) / 2F;
140141
float y = string.getString().contains("deadmau5") ? -20 : -10;
141142

143+
if (LevelHead.getInstance().background.get()) {
144+
y -= 2;
145+
}
146+
142147
Matrix4f matrix4f = matrices.peek().getModel();
143148
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
144-
LevelHead.getInstance().textColor.get().toInt(),
149+
ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()),
145150
AxolotlClient.config().useShadows.get(), matrix4f,
146151
vertexConsumers,
147152
TextRenderer.TextLayerType.SEE_THROUGH,
@@ -164,9 +169,13 @@ public abstract class EntityRendererMixin<T extends Entity> {
164169
float x = -textRenderer.getWidth(text) / 2F;
165170
float y = string.getString().contains("deadmau5") ? -20 : -10;
166171

172+
if (LevelHead.getInstance().background.get()) {
173+
y -= 2;
174+
}
175+
167176
Matrix4f matrix4f = matrices.peek().getModel();
168177
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
169-
LevelHead.getInstance().textColor.get().toInt(),
178+
ClientColors.ARGB.color(0x20, LevelHead.getInstance().textColor.get().toInt()),
170179
AxolotlClient.config().useShadows.get(), matrix4f,
171180
vertexConsumers, TextRenderer.TextLayerType.SEE_THROUGH,
172181
LevelHead.getInstance().background.get() ? bgColor : 0,

0 commit comments

Comments
 (0)