blob: dda56a409b1503b488944468cb3a5048c91f43fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
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 makamys.lodmod.LODMod;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.entity.EntityLivingBase;
@Mixin(EntityRenderer.class)
abstract class MixinEntityRenderer {
@Shadow
private float farPlaneDistance;
@Inject(method = "setupCameraTransform", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/EntityRenderer;farPlaneDistance:F", shift = At.Shift.AFTER, ordinal = 0))
private void onConstructed(CallbackInfo ci) {
if(LODMod.isActive()) {
farPlaneDistance *= LODMod.renderer.getFarPlaneDistanceMultiplier();
}
}
@Inject(method = "setupFog", at = @At(value = "RETURN"))
private void afterSetupFog(int mode, float alpha, CallbackInfo ci) {
if(LODMod.isActive()) {
EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity;
if(LODMod.fogEventWasPosted && mode >= 0 && !Minecraft.getMinecraft().theWorld.provider.doesXZShowFog((int)entity.posX, (int)entity.posZ)) {
GL11.glFogf(GL11.GL_FOG_START, farPlaneDistance * 0.2f);
GL11.glFogf(GL11.GL_FOG_END, farPlaneDistance);
}
}
}
}
|