aboutsummaryrefslogtreecommitdiff
path: root/versions/src/main/java/cc/polyfrost/oneconfig/internal
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-08-18 13:31:23 +0200
committerGitHub <noreply@github.com>2022-08-18 12:31:23 +0100
commitf6ca23fcc1d13389ab9460c843a0f2126eb84443 (patch)
tree776a27cc56f2d603bc76b8e08392ebf4d38427b8 /versions/src/main/java/cc/polyfrost/oneconfig/internal
parent97f788ecd4be15b1556ee1f3d8bd057bdf06bf5f (diff)
downloadOneConfig-f6ca23fcc1d13389ab9460c843a0f2126eb84443.tar.gz
OneConfig-f6ca23fcc1d13389ab9460c843a0f2126eb84443.tar.bz2
OneConfig-f6ca23fcc1d13389ab9460c843a0f2126eb84443.zip
Blur (#94)
* blurring * api * update optifine hook
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/internal')
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java7
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/hooks/OptifineConfigHook.java6
2 files changed, 6 insertions, 7 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 eed82a2..50e8cef 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
@@ -29,8 +29,6 @@ package cc.polyfrost.oneconfig.internal.gui.impl;
import cc.polyfrost.oneconfig.events.event.RenderEvent;
import cc.polyfrost.oneconfig.events.event.ScreenOpenEvent;
import cc.polyfrost.oneconfig.events.event.Stage;
-import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.internal.config.Preferences;
import cc.polyfrost.oneconfig.internal.gui.BlurHandler;
import cc.polyfrost.oneconfig.internal.mixin.ShaderGroupAccessor;
//#if FABRIC==1
@@ -39,6 +37,7 @@ 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 cc.polyfrost.oneconfig.utils.gui.OneUIScreen;
import net.minecraft.client.shader.Shader;
import net.minecraft.client.shader.ShaderUniform;
import net.minecraft.util.ResourceLocation;
@@ -130,7 +129,7 @@ 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 (!isShaderActive() && gui instanceof OneConfigGui && Preferences.enableBlur) {
+ if (!isShaderActive() && (gui instanceof OneUIScreen && ((OneUIScreen) gui).hasBackgroundBlur())) {
//#if FABRIC==1
//$$ ((GameRendererAccessor) UMinecraft.getMinecraft().gameRenderer).invokeLoadShader(this.blurShader);
//#else
@@ -141,7 +140,7 @@ public class BlurHandlerImpl implements BlurHandler {
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 (isShaderActive() && (gui == null || !Preferences.enableBlur)) {
+ } else if (isShaderActive() && (gui == null || (gui instanceof OneUIScreen && !((OneUIScreen) gui).hasBackgroundBlur()))) {
String name = UMinecraft.getMinecraft().entityRenderer.getShaderGroup().getShaderGroupName();
// Only stop our specific blur ;)
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/hooks/OptifineConfigHook.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/hooks/OptifineConfigHook.java
index 197d9c2..124c44e 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/hooks/OptifineConfigHook.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/hooks/OptifineConfigHook.java
@@ -26,20 +26,20 @@
package cc.polyfrost.oneconfig.internal.plugin.hooks;
-import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.platform.Platform;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
+import cc.polyfrost.oneconfig.utils.gui.OneUIScreen;
import java.util.Optional;
public class OptifineConfigHook {
public static boolean shouldNotApplyFastRender() {
- if (Platform.getGuiPlatform().getCurrentScreen() instanceof OneConfigGui) {
+ if (Platform.getGuiPlatform().getCurrentScreen() instanceof OneUIScreen && ((OneUIScreen) Platform.getGuiPlatform().getCurrentScreen()).hasBackgroundBlur()) {
return true;
}
for (Optional screen : GuiUtils.getScreenQueue()) {
- if (screen.isPresent() && screen.get() instanceof OneConfigGui) {
+ if (screen.isPresent() && screen.get() instanceof OneUIScreen && ((OneUIScreen) screen.get()).hasBackgroundBlur()) {
return true;
}
}