@@ -47,15 +47,15 @@ public final class WaypointsHack extends Hack implements RenderListener,
4747 private long lastDeathCreatedMs ;
4848
4949 private final SliderSetting textRenderDistance = new SliderSetting (
50- "Text render distance" , 127 , 0 , 2000 , 1 , ValueDisplay .INTEGER );
50+ "Text render distance" , 127 , 0 , 5000 , 1 , ValueDisplay .INTEGER );
5151 private final CheckboxSetting alwaysRenderText =
5252 new CheckboxSetting ("Always render text" , false );
5353 private final SliderSetting fadeDistance = new SliderSetting (
5454 "Waypoint fade distance" , 20 , 0 , 100 , 1 , ValueDisplay .INTEGER );
5555 private final SliderSetting maxDeathPositions = new SliderSetting (
5656 "Max death positions" , 4 , 0 , 20 , 1 , ValueDisplay .INTEGER );
5757 private final SliderSetting labelScale = new SliderSetting ("Label scale" ,
58- 2.0 , 0.5 , 10 .0 , 0.1 , ValueDisplay .DECIMAL );
58+ 2.0 , 0.5 , 5 .0 , 0.1 , ValueDisplay .DECIMAL );
5959 private final CheckboxSetting chatOnDeath =
6060 new CheckboxSetting ("Chat" , true );
6161 private final CheckboxSetting createDeathWaypoints =
@@ -165,8 +165,10 @@ public void onRender(MatrixStack matrices, float partialTicks)
165165
166166 // labels near distance
167167 double dist = Math .sqrt (distSq );
168- if (alwaysRenderText .isChecked ()
169- || dist <= textRenderDistance .getValue ())
168+ double trd = textRenderDistance .getValue ();
169+ boolean renderLabel = dist <= trd || alwaysRenderText .isChecked ();
170+ boolean beyond = trd == 0 || dist > trd ;
171+ if (renderLabel )
170172 {
171173 String title = w .getName () == null ? "" : w .getName ();
172174 String icon = iconChar (w .getIcon ());
@@ -177,11 +179,11 @@ public void onRender(MatrixStack matrices, float partialTicks)
177179 double lx = wp .getX () + 0.5 ;
178180 double ly = baseY ;
179181 double lz = wp .getZ () + 0.5 ;
180- // If always-render is on, anchor the label along the ray from
181- // the
182- // camera to the waypoint, to keep it within a stable render
183- // range .
184- if (alwaysRenderText .isChecked ())
182+ // If rendering beyond the text render distance and
183+ // always-render is
184+ // enabled, anchor the label along the camera->waypoint ray at a
185+ // fixed distance so it stays visible and consistently sized .
186+ if (alwaysRenderText .isChecked () && beyond )
185187 {
186188 Vec3d cam = RenderUtils .getCameraPos ();
187189 Vec3d target = new Vec3d (lx , ly , lz );
@@ -197,6 +199,16 @@ public void onRender(MatrixStack matrices, float partialTicks)
197199 }
198200 }
199201 float scale = (float )labelScale .getValue ();
202+ boolean anchored = alwaysRenderText .isChecked () && beyond ;
203+ // When not anchored, compensate by distance so on-screen size
204+ // remains approximately constant.
205+ if (!anchored )
206+ {
207+ Vec3d cam2 = RenderUtils .getCameraPos ();
208+ double dLabel = cam2 .distanceTo (new Vec3d (lx , ly , lz ));
209+ double compensate = Math .max (1.0 , dLabel * 0.1 );
210+ scale *= (float )compensate ;
211+ }
200212 // Keep a constant 10px separation using local pixel offset
201213 float sepPx = 10.0f ;
202214 drawWorldLabel (matrices , title , lx , ly , lz ,
0 commit comments