diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-05 22:37:47 +0900 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-05 22:37:47 +0900 |
commit | 206063acf3a6e0edc0d16b07d206aa36207b42d4 (patch) | |
tree | 8d0f31d65cfa4b3f85a3d4f7f0844f6df65b2b7e /versions/src/main/java/cc/polyfrost/oneconfig/internal/gui | |
parent | fecb67e07ded0d20b12d3bdb48fea3e2e50b7f88 (diff) | |
download | OneConfig-206063acf3a6e0edc0d16b07d206aa36207b42d4.tar.gz OneConfig-206063acf3a6e0edc0d16b07d206aa36207b42d4.tar.bz2 OneConfig-206063acf3a6e0edc0d16b07d206aa36207b42d4.zip |
a
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/internal/gui')
-rw-r--r-- | versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java index 8d0d550..3424d2b 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java @@ -10,7 +10,6 @@ import cc.polyfrost.oneconfig.internal.mixin.ShaderGroupAccessor; import cc.polyfrost.oneconfig.libs.eventbus.Subscribe; import cc.polyfrost.oneconfig.libs.universal.UMinecraft; import cc.polyfrost.oneconfig.libs.universal.UScreen; -import net.minecraft.client.Minecraft; import net.minecraft.client.shader.Shader; import net.minecraft.client.shader.ShaderUniform; import net.minecraft.util.ResourceLocation; @@ -55,7 +54,7 @@ public class BlurHandlerImpl implements BlurHandler { } // Only update the shader if one is active - if (!UMinecraft.getMinecraft().entityRenderer.isShaderActive()) { + if (!isShaderActive()) { return; } if (progress >= 5) return; @@ -102,14 +101,14 @@ public class BlurHandlerImpl implements BlurHandler { // If a shader is not already active and the UI is // a one of ours, we should load our own blur! - if (!UMinecraft.getMinecraft().entityRenderer.isShaderActive() && gui instanceof OneConfigGui && Preferences.enableBlur) { + if (!isShaderActive() && gui instanceof OneConfigGui && Preferences.enableBlur) { UMinecraft.getMinecraft().entityRenderer.loadShader(this.blurShader); this.start = System.currentTimeMillis(); this.progress = 0; // If a shader is active and the incoming UI is null or we have blur disabled, stop using the shader. - } else if (UMinecraft.getMinecraft().entityRenderer.isShaderActive() && (gui == null || !Preferences.enableBlur)) { + } else if (isShaderActive() && (gui == null || !Preferences.enableBlur)) { String name = UMinecraft.getMinecraft().entityRenderer.getShaderGroup().getShaderGroupName(); // Only stop our specific blur ;) @@ -129,4 +128,12 @@ public class BlurHandlerImpl implements BlurHandler { private float getBlurStrengthProgress() { return Math.min((System.currentTimeMillis() - this.start) / 50F, 5.0F); } + + private boolean isShaderActive() { + return UMinecraft.getMinecraft().entityRenderer.getShaderGroup() != null + //#if MC<=11202 + && net.minecraft.client.renderer.OpenGlHelper.shadersSupported + //#endif + ; + } } |