commit 0e4970fb1d0fd744c65613224bb731741af6b6fb
parent d0fc9f34cb3c830d990c23f5abdd5b737be65884
Author: Amb0s <ambos@disroot.org>
Date: Wed, 23 Aug 2023 16:47:26 +0200
Added condition to change fog distance based on the setting
Diffstat:
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/main/java/turniplabs/vanillafixes/mixin/WorldRendererMixin.java b/src/main/java/turniplabs/vanillafixes/mixin/WorldRendererMixin.java
@@ -1,5 +1,6 @@
package turniplabs.vanillafixes.mixin;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.render.WorldRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -10,17 +11,26 @@ import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
@Mixin(value = WorldRenderer.class, remap = false)
public class WorldRendererMixin {
@Shadow
+ private Minecraft mc;
+
+ @Shadow
private float farPlaneDistance = 0.0F;
@ModifyArgs(method = "setupFog", at = @At(value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V", ordinal = 2), require = 0)
- private void fixFogStart(Args args) {
- args.set(1, farPlaneDistance * 16);
+ private void changeFogStart(Args args) {
+ if (!(Boolean)this.mc.gameSettings.fog.value) {
+ // https://legacy.lwjgl.org/javadoc/constant-values.html
+ args.set(1, farPlaneDistance * 16);
+ }
}
@ModifyArgs(method = "setupFog", at = @At(value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V", ordinal = 3), require = 0)
- private void fixFogEnd(Args args) {
- args.set(1, farPlaneDistance * 32);
+ private void changeFogEnd(Args args) {
+ if (!(Boolean)this.mc.gameSettings.fog.value) {
+ // https://legacy.lwjgl.org/javadoc/constant-values.html
+ args.set(1, farPlaneDistance * 32);
+ }
}
}