@@ -34,17 +34,15 @@ public final class LogoutSpotsHack extends Hack
3434{
3535 private static final class Entry
3636 {
37- final UUID uuid ;
3837 final String name ;
3938 final Box box ;
40- final float health ;
39+ final String dimKey ;
4140
42- Entry (UUID u , String n , Box b , float h )
41+ Entry (UUID u , String n , Box b , float h , String dim )
4342 {
44- uuid = u ;
4543 name = n ;
4644 box = b ;
47- health = h ;
45+ dimKey = dim ;
4846 }
4947 }
5048
@@ -112,8 +110,8 @@ public void onUpdate()
112110 {
113111 Box b = p .getBoundingBox ();
114112 float h = p .getHealth ();
115- spots .put (id ,
116- new Entry ( id , p . getName (). getString (), b , h ));
113+ spots .put (id , new Entry ( id , p . getName (). getString (), b ,
114+ h , currentDimKey () ));
117115 }
118116 }
119117 snapshot ();
@@ -126,6 +124,13 @@ public void onUpdate()
126124 }
127125 }
128126
127+ private String currentDimKey ()
128+ {
129+ if (MC .world == null )
130+ return "overworld" ;
131+ return MC .world .getRegistryKey ().getValue ().getPath ();
132+ }
133+
129134 private void snapshot ()
130135 {
131136 if (MC .getNetworkHandler () != null )
@@ -145,11 +150,15 @@ public void onRender(MatrixStack matrices, float partialTicks)
145150 {
146151 if (spots .isEmpty ())
147152 return ;
153+ String curDim = currentDimKey ();
148154 int sides = sideColor .getColorI (0x40 );
149155 int lines = lineColor .getColorI (0xFF );
150- var boxes = new java .util .ArrayList <Box >(spots . size () );
156+ var boxes = new java .util .ArrayList <Box >();
151157 for (var e : spots .values ())
152- boxes .add (e .box );
158+ if (e .dimKey .equals (curDim ))
159+ boxes .add (e .box );
160+ if (boxes .isEmpty ())
161+ return ;
153162 RenderUtils .drawSolidBoxes (matrices , boxes , sides , false );
154163 RenderUtils .drawOutlinedBoxes (matrices , boxes , lines , false );
155164 // (Optional) draw tracers to centers
@@ -160,6 +169,8 @@ public void onRender(MatrixStack matrices, float partialTicks)
160169 }
161170 for (var e : spots .values ())
162171 {
172+ if (!e .dimKey .equals (curDim ))
173+ continue ;
163174 var c = e .box .getCenter ();
164175 drawWorldLabel (matrices , e .name , c .x , e .box .maxY + 0.5 , c .z ,
165176 0xFFFFFFFF , scale .getValueF ());
@@ -184,6 +195,7 @@ private void drawWorldLabel(MatrixStack matrices, String text, double x,
184195 var matrix = matrices .peek ().getPositionMatrix ();
185196 tr .draw (text , -w , 0 , argb , false , matrix , vcp ,
186197 TextRenderer .TextLayerType .SEE_THROUGH , bg , 0xF000F0 );
198+ vcp .draw ();
187199 matrices .pop ();
188200 }
189201}
0 commit comments