Applied Energistics 2

Applied Energistics 2

156M Downloads

Spatial Anchor Loaded Chunk Visualization is bugged.

Kazuhiko-Gushiken opened this issue ยท 4 comments

commented

Describe the bug

Spatial Anchor Loaded Chunk Visualization is bugged. Doesn't seem to display properly.
If you're in the Applied Energistics Discord Server, this is a message link to a video that is too large to share here: Link

How to reproduce the bug

Place down spatial anchor
Power it
Turn on visualization
tada?

Expected behavior

Chunk Borders

Additional details

No response

Which minecraft version are you using?

1.21

On which mod loaders does it happen?

NeoForge

Crash log

https://gist.github.com/Kazuhiko-Gushiken/73b9484bbdbf1a2278c1dc29689f8556

commented

seems to be a bug since at least 1.20.1 (#7880)

commented

Position changes (x, y, z) affect the overlay rendering, changes in rotation/angles of the camera (yaw and pitch) do not. My guess is that somehow the rotation must be part of the poseStack. All lines in x/y direction are thus always parallel to the screen edges.

commented

In src/main/java/appeng/client/render/overlay/OverlayManager.java I've added a line that might fix the problem.

diff --git a/src/main/java/appeng/client/render/overlay/OverlayManager.java b/src/main/java/appeng/client/render/overlay/OverlayManager.java
index c0d718d8f..4a346459e 100644
--- a/src/main/java/appeng/client/render/overlay/OverlayManager.java
+++ b/src/main/java/appeng/client/render/overlay/OverlayManager.java
@@ -60,6 +60,7 @@ public void renderWorldLastEvent(RenderLevelStageEvent event) {
         poseStack.pushPose();

         Vec3 projectedView = minecraft.gameRenderer.getMainCamera().getPosition();
+        poseStack.mulPose(minecraft.gameRenderer.getMainCamera().rotation().invert());
         poseStack.translate(-projectedView.x, -projectedView.y, -projectedView.z);

         for (OverlayRenderer handler : overlayHandlers.entrySet().stream()

I'm still not entirely convinced because to me in my super flat test world it seems kinda odd because of the way the overlay goes beyond the floor all the way down to bedrock which is only a few block down in a super flat world.

commented

It gets weirder every time. I have one normal test world where clipping the overlay works and another where it doesn't. The one where it works started out as not working as well and I have no idea what fixed it. And just as I was typing this message it broke again while doing nothing at all.

The code change I posted earlier seems to work for me, I'll make a PR out of this. The clipping issue is due to the fact that BLOCK_HIGHLIGHT_FACE and BLOCK_HIGHLIGHT_LINE have setDepthTestState(NO_DEPTH_TEST) rather than setDepthTestState(RenderStateShard.LEQUAL_DEPTH_TEST). I'm not sure if that is intentional or not, thus I'll make a separate commit out of this in the same PR.