vanilla-fixes

Minecraft: Better than Adventure! mod that fixes some issues
git clone git://memoryshards.xyz/vanilla-fixes.git
Log | Files | Refs | README | LICENSE

FogManagerMixin.java (1707B)


      1 package ambos.vanillafixes.mixin;
      2 
      3 import net.minecraft.client.Minecraft;
      4 import net.minecraft.client.option.enums.RenderDistance;
      5 import net.minecraft.client.render.FogManager;
      6 
      7 import org.spongepowered.asm.mixin.Mixin;
      8 import org.spongepowered.asm.mixin.Shadow;
      9 import org.spongepowered.asm.mixin.injection.At;
     10 import org.spongepowered.asm.mixin.injection.ModifyArgs;
     11 import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
     12 
     13 import ambos.vanillafixes.VanillaFixes;
     14 
     15 @Mixin(value = FogManager.class, remap = false)
     16 public class FogManagerMixin {
     17     @Shadow
     18     private Minecraft mc;
     19 
     20     @ModifyArgs(method = "setupFog", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V"), require = 0)
     21     private void changeFogStart(Args args) {
     22         if (VanillaFixes.FOG
     23                 && !(Boolean) this.mc.gameSettings.fog.value
     24                 && args.get(0).equals(2915) // https://legacy.lwjgl.org/javadoc/constant-values.html
     25                 && this.mc.gameSettings.renderDistance.value.chunks == RenderDistance.EXTREME.chunks) {
     26             args.set(1, Float.valueOf(RenderDistance.EXTREME.chunks * 12));
     27         }
     28     }
     29 
     30     @ModifyArgs(method = "setupFog", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V"), require = 0)
     31     private void changeFogEnd(Args args) {
     32         if (VanillaFixes.FOG
     33                 && !(Boolean) this.mc.gameSettings.fog.value
     34                 && args.get(0).equals(2916) // https://legacy.lwjgl.org/javadoc/constant-values.html
     35                 && this.mc.gameSettings.renderDistance.value.chunks == RenderDistance.EXTREME.chunks) {
     36             args.set(1, Float.valueOf(RenderDistance.EXTREME.chunks * 16));
     37         }
     38     }
     39 }