diff options
author | makamys <makamys@outlook.com> | 2021-05-06 16:37:21 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2021-05-06 16:37:21 +0200 |
commit | aef53a74b1bc577aa504f17488db3e5a4dad2e78 (patch) | |
tree | 235443bdec265462a9ee7f57c1b3893cad7e660c /src/main | |
parent | 2e5e9784206b8f49a7d95442fd41847284f2cf59 (diff) | |
download | Neodymium-aef53a74b1bc577aa504f17488db3e5a4dad2e78.tar.gz Neodymium-aef53a74b1bc577aa504f17488db3e5a4dad2e78.tar.bz2 Neodymium-aef53a74b1bc577aa504f17488db3e5a4dad2e78.zip |
foggy
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java index 16ea13c..0727b31 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java +++ b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java @@ -1,12 +1,18 @@ package makamys.lodmod.mixin; +import org.lwjgl.opengl.GL11; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; 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.LocalCapture; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.Potion; @Mixin(EntityRenderer.class) abstract class MixinEntityRenderer { @@ -14,10 +20,27 @@ abstract class MixinEntityRenderer { @Shadow private float farPlaneDistance; - @Inject(method = "setupCameraTransform", at = @At(value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;renderDistanceChunks:I", shift = At.Shift.AFTER)) + @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) { - System.out.println("it's " + farPlaneDistance); + //System.out.println("farPlaneDistance before: " + farPlaneDistance); + farPlaneDistance *= 4; + //System.out.println("farPlaneDistance after: " + farPlaneDistance); } + @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); + } + @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); + } + } } |