Skip to content

Commit e32a7c5

Browse files
committed
NiceWurst ESP Fix
1 parent e7f20cd commit e32a7c5

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2014-2025 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.mixin;
9+
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.injection.At;
12+
import org.spongepowered.asm.mixin.injection.ModifyVariable;
13+
14+
import net.minecraft.client.font.TextRenderer;
15+
import net.minecraft.client.font.TextRenderer.TextLayerType;
16+
import net.wurstclient.nicewurst.NiceWurstModule;
17+
18+
@Mixin(TextRenderer.class)
19+
public abstract class TextRendererMixin
20+
{
21+
@ModifyVariable(
22+
method = "draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)V",
23+
at = @At("HEAD"),
24+
argsOnly = true,
25+
ordinal = 0)
26+
private TextLayerType nicewurst$enforceDepthOnStringLabels(
27+
TextLayerType originalLayer)
28+
{
29+
return NiceWurstModule.enforceTextLayer(originalLayer);
30+
}
31+
32+
@ModifyVariable(
33+
method = "draw(Lnet/minecraft/text/Text;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)V",
34+
at = @At("HEAD"),
35+
argsOnly = true,
36+
ordinal = 0)
37+
private TextLayerType nicewurst$enforceDepthOnComponentLabels(
38+
TextLayerType originalLayer)
39+
{
40+
return NiceWurstModule.enforceTextLayer(originalLayer);
41+
}
42+
}

src/main/java/net/wurstclient/nicewurst/NiceWurstModule.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Set;
1919
import java.util.TreeMap;
2020

21+
import net.minecraft.client.font.TextRenderer.TextLayerType;
2122
import net.minecraft.client.render.Camera;
2223
import net.minecraft.client.render.RenderLayer;
2324
import net.minecraft.entity.LivingEntity;
@@ -65,6 +66,8 @@ public final class NiceWurstModule
6566
"net.wurstclient.hacks.TridentEspHack");
6667
private static final Set<String> ENTITY_OVERLAY_CALLERS =
6768
Set.of("net.wurstclient.hacks.MobEspHack");
69+
private static final Set<String> TEXT_DEPTH_TEST_CALLERS =
70+
Set.of("net.wurstclient.hacks.TrialSpawnerEspHack");
6871
private static final Set<String> TRACER_VISIBILITY_EXCEPTIONS =
6972
Set.of("net.wurstclient.hacks.WaypointsHack");
7073

@@ -252,6 +255,23 @@ public static Integer filterGlowColor(LivingEntity entity, Integer color)
252255
return shouldRenderTarget(target) ? color : null;
253256
}
254257

258+
public static TextLayerType enforceTextLayer(TextLayerType originalLayer)
259+
{
260+
if(originalLayer == null || !isActive())
261+
return originalLayer;
262+
263+
if(originalLayer != TextLayerType.SEE_THROUGH)
264+
return originalLayer;
265+
266+
for(StackTraceElement element : Thread.currentThread().getStackTrace())
267+
{
268+
if(TEXT_DEPTH_TEST_CALLERS.contains(element.getClassName()))
269+
return TextLayerType.NORMAL;
270+
}
271+
272+
return originalLayer;
273+
}
274+
255275
public static boolean shouldOverlayEntityShapes()
256276
{
257277
return isActive() && isEntityOverlayCall();

src/main/resources/wurst.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"StatsScreenMixin",
7171
"StatusEffectInstanceMixin",
7272
"TelemetryManagerMixin",
73+
"TextRendererMixin",
7374
"TextVisitFactoryMixin",
7475
"TrialSpawnerDataAccessor",
7576
"TitleScreenMixin",

0 commit comments

Comments
 (0)