Skip to content

Commit

Permalink
Fixed particles not showing while overlay is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
r8420 committed Feb 6, 2022
1 parent 84aa51c commit 9ac386a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -35,16 +36,16 @@ 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);
RenderSystem.enableCull();
} 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);
Expand Down Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ 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);
RenderSystem.enableCull();
} 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
Expand Down Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 9ac386a

Please sign in to comment.