diff options
4 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java index 70b8507..8cb07bd 100644 --- a/src/main/java/makamys/lodmod/LODMod.java +++ b/src/main/java/makamys/lodmod/LODMod.java @@ -220,4 +220,8 @@ public class LODMod } + public static boolean shouldRenderVanillaWorld() { + return !isActive() || (isActive() && renderer.renderWorld && !renderer.rendererActive); + } + } diff --git a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java index e03bc95..18f2177 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java +++ b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java @@ -26,7 +26,7 @@ abstract class MixinRenderGlobal { @Redirect(method = "renderSortedRenderers", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;renderAllRenderLists(ID)V")) private void redirectRenderAllRenderLists(RenderGlobal thiz, int p1, double p2) { - if(!LODMod.isActive() || (LODMod.isActive() && LODMod.renderer.renderWorld)) { + if(LODMod.shouldRenderVanillaWorld()) { thiz.renderAllRenderLists(p1, p2); } } diff --git a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java index 3ce0c4c..521bf1a 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java +++ b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java @@ -17,7 +17,7 @@ abstract class MixinRenderGlobal_OptiFine { // for OptiFine's Fast Render option @Redirect(method = "renderSortedRenderersFast", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallLists(Ljava/nio/IntBuffer;)V"), remap=false) private void redirectRenderAllRenderLists(IntBuffer buffer) { - if(!LODMod.isActive() || (LODMod.isActive() && LODMod.renderer.renderWorld)) { + if(LODMod.shouldRenderVanillaWorld()) { GL11.glCallLists(buffer); } } diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index d13f4e4..a053588 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -58,8 +58,8 @@ public class LODRenderer { private boolean[] wasDown = new boolean[256]; private int renderQuads = 0; - public boolean renderWorld = true; - public boolean renderLOD = true; + public boolean renderWorld; + public boolean rendererActive; private static int BUFFER_SIZE = 1024 * 1024 * 1024; private static int MAX_MESHES = 100000; @@ -103,6 +103,9 @@ public class LODRenderer { if(shouldRenderInWorld(world)) { hasInited = init(); } + + renderWorld = true; + rendererActive = true; } public void preRenderSortedRenderers(int renderPass, double alpha, WorldRenderer[] sortedWorldRenderers) { @@ -116,7 +119,7 @@ public class LODRenderer { if(hasInited) { mainLoop(); - if(LODMod.debugEnabled) { + if(LODMod.debugEnabled && Minecraft.getMinecraft().currentScreen == null) { handleKeyboard(); } if(lastGCTime == -1 || (System.currentTimeMillis() - lastGCTime) > gcInterval) { @@ -128,7 +131,7 @@ public class LODRenderer { lastSaveTime = System.currentTimeMillis(); } - if(renderLOD) { + if(rendererActive && renderWorld) { if(frameCount % LODMod.sortFrequency == 0) { sort(); } @@ -239,7 +242,7 @@ public class LODRenderer { private void handleKeyboard() { if(Keyboard.isKeyDown(Keyboard.KEY_F) && !wasDown[Keyboard.KEY_F]) { - renderLOD = !renderLOD; + rendererActive = !rendererActive; } if(Keyboard.isKeyDown(Keyboard.KEY_V) && !wasDown[Keyboard.KEY_V]) { renderWorld = !renderWorld; |