5757import net .wurstclient .util .RenderUtils ;
5858import net .wurstclient .util .RenderUtils .ColoredBox ;
5959import net .wurstclient .util .RenderUtils .ColoredPoint ;
60+ import net .wurstclient .nicewurst .NiceWurstModule ;
6061import net .wurstclient .util .chunk .ChunkUtils ;
6162import com .google .gson .Gson ;
6263import com .google .gson .GsonBuilder ;
@@ -474,6 +475,7 @@ public void onRender(PoseStack matrices, float partialTicks)
474475 fillShapes .isChecked () ? new ArrayList <>() : null ;
475476 ArrayList <ColoredPoint > tracerTargets =
476477 drawTracers .isChecked () ? new ArrayList <>() : null ;
478+ ArrayList <OverlayEntry > overlays = new ArrayList <>();
477479
478480 // Render vault ESP boxes and simple status labels while hack is enabled
479481 if (!vaults .isEmpty ())
@@ -516,9 +518,10 @@ public void onRender(PoseStack matrices, float partialTicks)
516518 lines .add (new OverlayLine (status , 0xFFFFFFFF ));
517519 if (ominous && openedVaultKeys .contains (key ))
518520 lines .add (new OverlayLine ("Opened" , 0xFFDD4444 ));
519- Vec3 labelPos = Vec3 .atCenterOf (vpos ).add (0 , 1.0 , 0 );
520- labelPos = resolveLabelPosition (labelPos );
521- drawLabel (matrices , labelPos , lines , overlayScale .getValueF ());
521+ Vec3 original = Vec3 .atCenterOf (vpos ).add (0 , 1.0 , 0 );
522+ Vec3 resolved = resolveLabelPosition (original );
523+ overlays .add (new OverlayEntry (original , resolved , lines ,
524+ overlayScale .getValueF ()));
522525 }
523526 }
524527
@@ -548,12 +551,12 @@ public void onRender(PoseStack matrices, float partialTicks)
548551 drawActivationRadius (matrices , info , logic , color );
549552
550553 if (showVaultLink .isChecked () && info .vault () != null )
551- drawVaultLink (matrices , info , color );
554+ drawVaultLink (matrices , info , color , overlays );
552555
553556 // spawn tracers removed
554557
555558 if (showOverlay .isChecked ())
556- drawOverlay (matrices , info , logic , state , color );
559+ drawOverlay (matrices , info , logic , state , color , overlays );
557560 }
558561
559562 if (filledBoxes != null && !filledBoxes .isEmpty ())
@@ -563,6 +566,19 @@ public void onRender(PoseStack matrices, float partialTicks)
563566 if (tracerTargets != null && !tracerTargets .isEmpty ())
564567 RenderUtils .drawTracers (matrices , partialTicks , tracerTargets ,
565568 false );
569+
570+ // draw overlays after all ESP geometry so labels are not overwritten
571+ java .util .HashSet <BlockPos > drawn = new java .util .HashSet <>();
572+ for (OverlayEntry e : overlays )
573+ {
574+ if (!NiceWurstModule .shouldRenderTarget (e .original ()))
575+ continue ;
576+ BlockPos key = BlockPos .containing (e .original ());
577+ if (drawn .contains (key ))
578+ continue ;
579+ drawn .add (key );
580+ drawLabel (matrices , e .resolved (), e .lines (), e .scale ());
581+ }
566582 }
567583
568584 private void drawActivationRadius (PoseStack matrices , TrialSpawnerInfo info ,
@@ -596,7 +612,7 @@ private void drawActivationRadius(PoseStack matrices, TrialSpawnerInfo info,
596612 }
597613
598614 private void drawVaultLink (PoseStack matrices , TrialSpawnerInfo info ,
599- int stateColor )
615+ int stateColor , ArrayList < OverlayEntry > overlays )
600616 {
601617 if (MC .level == null || info .vault () == null )
602618 return ;
@@ -614,12 +630,15 @@ private void drawVaultLink(PoseStack matrices, TrialSpawnerInfo info,
614630 String status = describeVaultState (state );
615631 List <OverlayLine > lines = List .of (new OverlayLine ("Vault" , stateColor ),
616632 new OverlayLine (status , color ));
617- Vec3 labelPos = end .add (0 , 0.6 , 0 );
618- drawLabel (matrices , labelPos , lines , overlayScale .getValueF ());
633+ Vec3 original = end .add (0 , 0.6 , 0 );
634+ Vec3 resolved = resolveLabelPosition (original );
635+ overlays .add (new OverlayEntry (original , resolved , lines ,
636+ overlayScale .getValueF ()));
619637 }
620638
621639 private void drawOverlay (PoseStack matrices , TrialSpawnerInfo info ,
622- TrialSpawner logic , TrialSpawnerState state , int headerColor )
640+ TrialSpawner logic , TrialSpawnerState state , int headerColor ,
641+ ArrayList <OverlayEntry > overlays )
623642 {
624643 if (MC .level == null )
625644 return ;
@@ -731,9 +750,10 @@ private void drawOverlay(PoseStack matrices, TrialSpawnerInfo info,
731750 lines .add (new OverlayLine ("Vault: " + vaultInfo , 0xFFFFFFFF ));
732751 }
733752
734- Vec3 labelPos = Vec3 .atCenterOf (info .pos ()).add (0 , 1.6 , 0 );
735- labelPos = resolveLabelPosition (labelPos );
736- drawLabel (matrices , labelPos , lines , overlayScale .getValueF ());
753+ Vec3 original = Vec3 .atCenterOf (info .pos ()).add (0 , 1.6 , 0 );
754+ Vec3 resolved = resolveLabelPosition (original );
755+ overlays .add (new OverlayEntry (original , resolved , lines ,
756+ overlayScale .getValueF ()));
737757 }
738758
739759 private void drawLabel (PoseStack matrices , Vec3 position ,
@@ -768,7 +788,8 @@ private void drawLabel(PoseStack matrices, Vec3 position,
768788 {
769789 OverlayLine line = lines .get (i );
770790 int y = i * lineHeight ;
771- DisplayMode layerType = DisplayMode .SEE_THROUGH ;
791+ DisplayMode layerType =
792+ NiceWurstModule .enforceTextLayer (DisplayMode .SEE_THROUGH );
772793 tr .drawInBatch (line .text (), x , y , line .color (), false ,
773794 matrices .last ().pose (), vcp , layerType , bg , 0xF000F0 );
774795 }
@@ -1264,6 +1285,10 @@ private record VaultInfo(BlockPos pos)
12641285 private record OverlayLine (String text , int color )
12651286 {}
12661287
1288+ private record OverlayEntry (Vec3 original , Vec3 resolved ,
1289+ List <OverlayLine > lines , float scale )
1290+ {}
1291+
12671292 private enum TrialStatus
12681293 {
12691294 IDLE ,
0 commit comments