diff --git a/src/main/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java b/src/main/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java index ce03cff..a24772f 100644 --- a/src/main/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java +++ b/src/main/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java @@ -2,6 +2,7 @@ import at.ridgo8.moreoverlays.MoreOverlays; import at.ridgo8.moreoverlays.config.Config; +import at.ridgo8.moreoverlays.lightoverlay.LightOverlayHandler; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import com.mojang.math.Matrix4f; @@ -35,6 +36,8 @@ public static void renderOverlays(PoseStack matrixstack) { RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth.get()); RenderSystem.setShader(GameRenderer::getPositionColorShader); + Quaternion cameraRotation = Minecraft.getInstance().gameRenderer.getMainCamera().rotation(); + if (Minecraft.getInstance().options.graphicsMode != GraphicsStatus.FABULOUS) { // Use old renderer RenderSystem.depthMask(false); @@ -42,9 +45,7 @@ public static void renderOverlays(PoseStack matrixstack) { } else { // Use new renderer matrixstack.pushPose(); - Minecraft minecraft = Minecraft.getInstance(); - Quaternion cameraRotation = minecraft.gameRenderer.getMainCamera().rotation(); // Rotate yaw by 180 degrees. Parameters: (pitch, yaw, roll), angle, usingDegrees cameraRotation.mul(new Quaternion(new Vector3f(0, -1, 0), 180, true)); Matrix4f translateMatrix = new Matrix4f(cameraRotation); @@ -126,6 +127,13 @@ public static void renderOverlays(PoseStack matrixstack) { } else { RenderSystem.lineWidth(1.0F); RenderSystem.enableBlend(); + + if(!LightOverlayHandler.isEnabled()){ + cameraRotation.mul(new Quaternion(new Vector3f(0, -1, 0), -180, true)); + Matrix4f translateMatrix = new Matrix4f(cameraRotation); + matrixstack.mulPoseMatrix(translateMatrix); + } + matrixstack.popPose(); } } diff --git a/src/main/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java b/src/main/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java index c99fc60..46d0900 100644 --- a/src/main/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java +++ b/src/main/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java @@ -97,6 +97,8 @@ public void renderOverlays(ILightScanner scanner, PoseStack matrixstack) { RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth.get()); RenderSystem.setShader(GameRenderer::getPositionColorShader); + Quaternion cameraRotation = Minecraft.getInstance().gameRenderer.getMainCamera().rotation(); + if (Minecraft.getInstance().options.graphicsMode != GraphicsStatus.FABULOUS) { // Use old renderer RenderSystem.depthMask(false); @@ -104,9 +106,7 @@ public void renderOverlays(ILightScanner scanner, PoseStack matrixstack) { } else { // Use new renderer matrixstack.pushPose(); - Minecraft minecraft = Minecraft.getInstance(); - Quaternion cameraRotation = minecraft.gameRenderer.getMainCamera().rotation(); // Only rotate when pose is not already rotated by ChunkBoundsRenderer if(ChunkBoundsHandler.getMode() == ChunkBoundsHandler.RenderMode.NONE){ // Rotate yaw by 180 degrees. Parameters: (pitch, yaw, roll), angle, usingDegrees @@ -143,6 +143,11 @@ else if (mode == 2) } else { RenderSystem.lineWidth(1.0F); RenderSystem.enableBlend(); + + cameraRotation.mul(new Quaternion(new Vector3f(0, -1, 0), -180, true)); + Matrix4f translateMatrix = new Matrix4f(cameraRotation); + matrixstack.mulPoseMatrix(translateMatrix); + matrixstack.popPose(); } }