From d80373ad654a1f2d580a96e5e433712eaf045946 Mon Sep 17 00:00:00 2001 From: makamys Date: Sat, 8 May 2021 00:43:36 +0200 Subject: less flicker --- src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java | 10 ++++++++++ src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java | 8 ++++++++ 2 files changed, 18 insertions(+) (limited to 'src/main/java/makamys/lodmod/mixin') diff --git a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java index 18f95a6..0f87216 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java +++ b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal.java @@ -6,6 +6,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; import makamys.lodmod.LODMod; import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.WorldRenderer; @Mixin(RenderGlobal.class) abstract class MixinRenderGlobal { @@ -16,4 +17,13 @@ abstract class MixinRenderGlobal { thiz.renderAllRenderLists(p1, p2); } } + + @Redirect(method = "renderSortedRenderers", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;getGLCallListForPass(I)I")) + public int redirectCallList(WorldRenderer thiz, int arg) { + int numba = thiz.getGLCallListForPass(arg); + if(numba != -1) { + LODMod.renderer.onWorldRendererFrustumChange(thiz, true); + } + return numba; + } } diff --git a/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java b/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java index e7595d9..8146431 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java +++ b/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java @@ -10,6 +10,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import makamys.lodmod.LODMod; import makamys.lodmod.ducks.ITessellator; @@ -36,6 +37,13 @@ abstract class MixinWorldRenderer implements IWorldRenderer { @Shadow public int posZ; + @Shadow + private boolean isInFrustum; + @Shadow + public boolean[] skipRenderPass; + @Shadow + private int glRenderList; + public List chunkMeshes = new ArrayList<>(); @Redirect(method = "setPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/Render;renderAABB(Lnet/minecraft/util/AxisAlignedBB;)V")) -- cgit