Skip to content

Commit 0163cfc

Browse files
committed
fix another small bug
1 parent 7e04d7b commit 0163cfc

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

1.20/src/main/java/io/github/axolotlclient/waypoints/waypoints/WaypointRenderer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
package io.github.axolotlclient.waypoints.waypoints;
2424

2525
import java.lang.Math;
26+
import java.util.HashSet;
27+
import java.util.Set;
2628
import java.util.concurrent.atomic.AtomicReference;
2729

2830
import com.mojang.blaze3d.systems.RenderSystem;
@@ -46,6 +48,7 @@ public class WaypointRenderer {
4648
private final Minecraft minecraft = Minecraft.getInstance();
4749
private final Matrix4f view = new Matrix4f();
4850
private final Vector4f viewProj = new Vector4f();
51+
private final Set<Waypoint> worldRendererWaypoints = new HashSet<>();
4952

5053
public void render(PoseStack stack, MultiBufferSource.BufferSource source, float tick) {
5154
var profiler = Minecraft.getInstance().getProfiler();
@@ -56,6 +59,7 @@ public void render(PoseStack stack, MultiBufferSource.BufferSource source, float
5659
minecraft.gameRenderer.resetProjectionMatrix(minecraft.gameRenderer.getProjectionMatrix(((GameRendererAccessor) minecraft.gameRenderer).invokeGetFov(cam, 0, false)));
5760
RenderSystem.enableBlend();
5861
float fov = (float) ((GameRendererAccessor) minecraft.gameRenderer).invokeGetFov(cam, tick, true);
62+
worldRendererWaypoints.clear();
5963

6064
for (Waypoint waypoint : AxolotlClientWaypoints.getCurrentWaypoints()) {
6165
if (waypoint.closerToThan(camPos.x(), camPos.y(), camPos.z(), CUTOFF_DIST / minecraft.getWindow().getGuiScale())) {
@@ -85,6 +89,7 @@ private void renderWaypoint(Waypoint waypoint, PoseStack stack, Vec3 camPos, Cam
8589
if (projWidth < width && projHeight < height) {
8690
return;
8791
}
92+
worldRendererWaypoints.add(waypoint);
8893

8994
stack.pushPose();
9095
stack.translate(waypoint.x() - camPos.x(), waypoint.y() - camPos.y(), waypoint.z() - camPos.z());
@@ -201,7 +206,7 @@ private void renderWaypoint(Waypoint waypoint, GuiGraphics graphics, float tick,
201206
pose.popPose();
202207
}
203208

204-
if ((projWidth >= width || projHeight >= height) && _3dOnScreen) {
209+
if ((projWidth >= width || projHeight >= height) && _3dOnScreen && worldRendererWaypoints.contains(waypoint)) {
205210
return;
206211
}
207212

1.21.8/src/main/java/io/github/axolotlclient/waypoints/waypoints/WaypointRenderer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
package io.github.axolotlclient.waypoints.waypoints;
2424

25+
import java.util.HashSet;
26+
import java.util.Set;
2527
import java.util.concurrent.atomic.AtomicReference;
2628

2729
import com.mojang.blaze3d.ProjectionType;
@@ -56,7 +58,7 @@ public class WaypointRenderer {
5658
private final RenderType QUADS = RenderType.create("waypoint_quads", 192 * 8, false, true, RenderPipelines.GUI, RenderType.CompositeState.builder().createCompositeState(false));
5759
private final Matrix4f view = new Matrix4f();
5860
private final Vector4f viewProj = new Vector4f();
59-
61+
private final Set<Waypoint> worldRendererWaypoints = new HashSet<>();
6062

6163
public void render(GraphicsResourceAllocator allocator, LevelTargetBundle targets, DeltaTracker deltaTracker) {
6264
if (!AxolotlClientWaypoints.renderWaypoints.get()) return;
@@ -80,6 +82,7 @@ public void render(GraphicsResourceAllocator allocator, LevelTargetBundle target
8082
stack.pushPose();
8183
stack.mulPose(cam.rotation().invert());
8284
var camPos = AxolotlClientWaypoints.WAYPOINT_RENDERER.minecraft.gameRenderer.getMainCamera().getPosition();
85+
worldRendererWaypoints.clear();
8386

8487
for (Waypoint waypoint : AxolotlClientWaypoints.getCurrentWaypoints()) {
8588
profiler.push(waypoint.name());
@@ -110,6 +113,7 @@ private void renderWaypoint(Waypoint waypoint, PoseStack stack, Vec3 camPos, Cam
110113
if (projWidth < width && projHeight < height) {
111114
return;
112115
}
116+
worldRendererWaypoints.add(waypoint);
113117

114118
stack.pushPose();
115119
stack.translate(waypoint.x() - camPos.x(), waypoint.y() - camPos.y(), waypoint.z() - camPos.z());
@@ -226,7 +230,7 @@ private void renderWaypoint(Waypoint waypoint, GuiGraphics graphics, DeltaTracke
226230
pose.popMatrix();
227231
}
228232

229-
if ((projWidth >= width || projHeight >= height) && _3dOnScreen) {
233+
if ((projWidth >= width || projHeight >= height) && _3dOnScreen && worldRendererWaypoints.contains(waypoint)) {
230234
return;
231235
}
232236

1.21/src/main/java/io/github/axolotlclient/waypoints/waypoints/WaypointRenderer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
package io.github.axolotlclient.waypoints.waypoints;
2424

2525
import java.lang.Math;
26+
import java.util.HashSet;
27+
import java.util.Set;
2628
import java.util.concurrent.atomic.AtomicReference;
2729

2830
import com.mojang.blaze3d.vertex.PoseStack;
@@ -46,7 +48,7 @@ public class WaypointRenderer {
4648
private final Minecraft minecraft = Minecraft.getInstance();
4749
private final Matrix4f view = new Matrix4f();
4850
private final Vector4f viewProj = new Vector4f();
49-
51+
private final Set<Waypoint> worldRendererWaypoints = new HashSet<>();
5052

5153
public void render(DeltaTracker deltaTracker) {
5254
if (!AxolotlClientWaypoints.renderWaypoints.get()) return;
@@ -63,6 +65,7 @@ public void render(DeltaTracker deltaTracker) {
6365
stack.mulPose(cam.rotation().invert());
6466
var camPos = minecraft.gameRenderer.getMainCamera().getPosition();
6567
float fov = (float) ((GameRendererAccessor) minecraft.gameRenderer).invokeGetFov(cam, deltaTracker.getGameTimeDeltaPartialTick(true), true);
68+
worldRendererWaypoints.clear();
6669

6770
for (Waypoint waypoint : AxolotlClientWaypoints.getCurrentWaypoints()) {
6871
profiler.push(waypoint.name());
@@ -91,6 +94,7 @@ private void renderWaypoint(Waypoint waypoint, PoseStack stack, Vec3 camPos, Cam
9194
if (projWidth < width && projHeight < height) {
9295
return;
9396
}
97+
worldRendererWaypoints.add(waypoint);
9498

9599
stack.pushPose();
96100
stack.translate(waypoint.x() - camPos.x(), waypoint.y() - camPos.y(), waypoint.z() - camPos.z());
@@ -207,7 +211,7 @@ private void renderWaypoint(Waypoint waypoint, GuiGraphics graphics, DeltaTracke
207211
pose.popPose();
208212
}
209213

210-
if ((projWidth >= width || projHeight >= height) && _3dOnScreen) {
214+
if ((projWidth >= width || projHeight >= height) && _3dOnScreen && worldRendererWaypoints.contains(waypoint)) {
211215
return;
212216
}
213217

1.8.9/src/main/java/io/github/axolotlclient/waypoints/waypoints/WaypointRenderer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class WaypointRenderer {
5151
private final Minecraft minecraft = Minecraft.getInstance();
5252
private final Matrix4f view = new Matrix4f();
5353
private final Vector4f viewProj = new Vector4f();
54-
5554
private final Set<Waypoint> worldRendererWaypoints = new HashSet<>();
5655

5756
public void render(float f) {

0 commit comments

Comments
 (0)