File tree Expand file tree Collapse file tree
src/main/java/meteordevelopment/meteorclient/systems Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ private void onRender2D(Render2DEvent event) {
105105 Vector3d pos = new Vector3d (blockPos .getX () + 0.5 , blockPos .getY (), blockPos .getZ () + 0.5 );
106106 double dist = PlayerUtils .distanceToCamera (pos .x , pos .y , pos .z );
107107
108+ waypoint .hideWhenNear ((int ) Math .floor (dist ));
109+
108110 // Continue if this waypoint should not be rendered
109111 if (dist > waypoint .maxVisible .get ()) continue ;
110112 if (!NametagUtils .to2D (pos , waypoint .scale .get () - 0.2 )) continue ;
@@ -172,6 +174,10 @@ public void addDeath(Vec3d deathPos) {
172174 .dimension (PlayerUtils .getDimension ())
173175 .build ();
174176
177+ // Configure death waypoints to auto hide when the player is within 4 blocks
178+ waypoint .hideWhenNear .set (true );
179+ waypoint .hideWhenNearDistance .set (4 );
180+
175181 Waypoints .get ().add (waypoint );
176182 }
177183
Original file line number Diff line number Diff line change @@ -94,6 +94,21 @@ public class Waypoint implements ISerializable<Waypoint> {
9494 .build ()
9595 );
9696
97+ public Setting <Boolean > hideWhenNear = sgPosition .add (new BoolSetting .Builder ()
98+ .name ("hide-when-near" )
99+ .description ("Whether to set the waypoint to hidden when the player is near enough." )
100+ .defaultValue (false )
101+ .build ()
102+ );
103+
104+ public Setting <Integer > hideWhenNearDistance = sgPosition .add (new IntSetting .Builder ()
105+ .name ("hide-when-near-distance" )
106+ .description ("Hides the waypoint if the player is closer than this distance, and hide when near is enabled." )
107+ .defaultValue (8 )
108+ .sliderRange (0 , 32 )
109+ .build ()
110+ );
111+
97112 public final UUID uuid ;
98113
99114 private Waypoint () {
@@ -137,6 +152,13 @@ public BlockPos getPos() {
137152 };
138153 }
139154
155+ public void hideWhenNear (int distance ) {
156+ if (!hideWhenNear .get ()) { return ; }
157+ if (distance > hideWhenNearDistance .get ()) { return ; }
158+
159+ visible .set (false );
160+ }
161+
140162 private void validateIcon () {
141163 Map <String , AbstractTexture > icons = Waypoints .get ().icons ;
142164
You can’t perform that action at this time.
0 commit comments