diff options
author | makamys <makamys@outlook.com> | 2022-07-15 19:27:58 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-07-15 19:53:08 +0200 |
commit | e9b96c435214fb6125875ee015f8efedf9b0be07 (patch) | |
tree | bc9551566cf8921a26719b026c51e8ab6e29f386 /src | |
parent | 0c9070cf93b660b29b98c0916f319f3f7b3e1583 (diff) | |
download | Neodymium-e9b96c435214fb6125875ee015f8efedf9b0be07.tar.gz Neodymium-e9b96c435214fb6125875ee015f8efedf9b0be07.tar.bz2 Neodymium-e9b96c435214fb6125875ee015f8efedf9b0be07.zip |
O(O)F
Diffstat (limited to 'src')
5 files changed, 41 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/MixinConfigPlugin.java b/src/main/java/makamys/neodymium/MixinConfigPlugin.java index 6624a49..678fadd 100644 --- a/src/main/java/makamys/neodymium/MixinConfigPlugin.java +++ b/src/main/java/makamys/neodymium/MixinConfigPlugin.java @@ -43,6 +43,7 @@ public class MixinConfigPlugin implements IMixinConfigPlugin { if (OFUtil.isOptiFinePresent()) { System.out.println("Detected OptiFine"); mixins.add("MixinRenderGlobal_OptiFine"); + mixins.add("MixinGameSettings_OptiFine"); } if(Config.replaceOpenGLSplash) { diff --git a/src/main/java/makamys/neodymium/ducks/IMixinGameSettings_OptiFine.java b/src/main/java/makamys/neodymium/ducks/IMixinGameSettings_OptiFine.java new file mode 100644 index 0000000..f7f4850 --- /dev/null +++ b/src/main/java/makamys/neodymium/ducks/IMixinGameSettings_OptiFine.java @@ -0,0 +1,7 @@ +package makamys.neodymium.ducks; + +public interface IMixinGameSettings_OptiFine { + + public int getOfFogType(); + +} diff --git a/src/main/java/makamys/neodymium/mixin/MixinGameSettings_OptiFine.java b/src/main/java/makamys/neodymium/mixin/MixinGameSettings_OptiFine.java new file mode 100644 index 0000000..43fa0b9 --- /dev/null +++ b/src/main/java/makamys/neodymium/mixin/MixinGameSettings_OptiFine.java @@ -0,0 +1,21 @@ +package makamys.neodymium.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.Shadow; + +import makamys.neodymium.ducks.IMixinGameSettings_OptiFine; +import net.minecraft.client.settings.GameSettings; + +@Mixin(value = GameSettings.class, remap = false) +@Pseudo +public class MixinGameSettings_OptiFine implements IMixinGameSettings_OptiFine { + + @Shadow + private int ofFogType; + + public int getOfFogType() { + return ofFogType; + } + +} diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index 4fe459c..3762dea 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -29,6 +29,7 @@ import makamys.neodymium.config.Config; import makamys.neodymium.ducks.IWorldRenderer; import makamys.neodymium.renderer.Mesh.GPUStatus; import makamys.neodymium.util.GuiHelper; +import makamys.neodymium.util.OFUtil; import makamys.neodymium.util.Preprocessor; import makamys.neodymium.util.Util; import net.minecraft.client.Minecraft; @@ -616,7 +617,7 @@ public class NeoRenderer { case FALSE: return false; default: - return GL11.glIsEnabled(GL11.GL_FOG); + return GL11.glIsEnabled(GL11.GL_FOG) && !OFUtil.isFogOff(); } } diff --git a/src/main/java/makamys/neodymium/util/OFUtil.java b/src/main/java/makamys/neodymium/util/OFUtil.java index a26177f..c98a651 100644 --- a/src/main/java/makamys/neodymium/util/OFUtil.java +++ b/src/main/java/makamys/neodymium/util/OFUtil.java @@ -1,6 +1,8 @@ package makamys.neodymium.util; import makamys.neodymium.MixinConfigPlugin; +import makamys.neodymium.ducks.IMixinGameSettings_OptiFine; +import net.minecraft.client.Minecraft; public class OFUtil { private static boolean isOptiFinePresent = MixinConfigPlugin.class.getResource("/optifine/OptiFineTweaker.class") != null; @@ -8,4 +10,12 @@ public class OFUtil { public static boolean isOptiFinePresent() { return isOptiFinePresent; } + + public static boolean isFogOff() { + return isOptiFinePresent && getIsFogOff(); + } + + private static boolean getIsFogOff() { + return ((IMixinGameSettings_OptiFine)Minecraft.getMinecraft().gameSettings).getOfFogType() == 3; + } } |