diff options
Diffstat (limited to 'src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java')
-rw-r--r-- | src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java index 544d131..4fe081c 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java +++ b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java @@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import makamys.lodmod.LODMod; import makamys.lodmod.renderer.MyRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.EntityRenderer; @@ -22,23 +23,29 @@ abstract class MixinEntityRenderer { @Inject(method = "setupCameraTransform", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/EntityRenderer;farPlaneDistance:F", shift = At.Shift.AFTER, args = "log=true", ordinal = 0)) private void onConstructed(CallbackInfo ci) { - farPlaneDistance *= 4; + if(LODMod.isActive()) { + farPlaneDistance *= 4; + } } @Inject(method = "renderWorld", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glAlphaFunc(IF)V", shift = At.Shift.AFTER, ordinal = 1)) private void afterSortAndRender(float alpha, long something, CallbackInfo ci) { - Minecraft.getMinecraft().entityRenderer.enableLightmap((double)alpha); - MyRenderer.beforeRenderTerrain(); - Minecraft.getMinecraft().entityRenderer.disableLightmap((double)alpha); + if(LODMod.isActive()) { + Minecraft.getMinecraft().entityRenderer.enableLightmap((double)alpha); + LODMod.renderer.beforeRenderTerrain(); + Minecraft.getMinecraft().entityRenderer.disableLightmap((double)alpha); + } } @Redirect(method = "setupFog", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V")) private void afterSetupFog(int pname, float param, int mode, float alpha) { - EntityLivingBase var3 = Minecraft.getMinecraft().renderViewEntity; - if(pname == GL11.GL_FOG_START && mode != 999 && mode != -1 && !var3.isPotionActive(Potion.blindness) && !Minecraft.getMinecraft().theWorld.provider.doesXZShowFog((int)var3.posX, (int)var3.posZ)) { - GL11.glFogf(pname, farPlaneDistance * 0.2f); - } else { - GL11.glFogf(pname, param); + if(LODMod.isActive()) { + EntityLivingBase var3 = Minecraft.getMinecraft().renderViewEntity; + if(pname == GL11.GL_FOG_START && mode != 999 && mode != -1 && !var3.isPotionActive(Potion.blindness) && !Minecraft.getMinecraft().theWorld.provider.doesXZShowFog((int)var3.posX, (int)var3.posZ)) { + GL11.glFogf(pname, farPlaneDistance * 0.2f); + } else { + GL11.glFogf(pname, param); + } } } } |