Fixed Menu Blur

This commit is contained in:
kirillsaint 2023-06-29 15:17:34 +06:00
parent 881f793520
commit 0b95f422f8
4 changed files with 17 additions and 10 deletions

View File

@ -201,10 +201,10 @@ public final class ConfigManager {
if(set.getName() == "Menu Background Blur") { if(set.getName() == "Menu Background Blur") {
if(Minecraft.getMinecraft().currentScreen != null) { if(Minecraft.getMinecraft().currentScreen != null) {
if(!set.getValBoolean()) { if(!set.getValBoolean()) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null); MenuBlurUtils.unloadBlur(true);
} else { } else {
MenuBlurUtils.loadBlur(); MenuBlurUtils.loadBlur(true);
} }
} }
} }
} catch (Exception err) { } catch (Exception err) {

View File

@ -2,7 +2,6 @@ package net.silentclient.client.mixin.mixins;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.silentclient.client.Client; import net.silentclient.client.Client;
@ -18,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = AbstractClientPlayer.class, priority = 2000) @Mixin(AbstractClientPlayer.class)
public abstract class AbstractClientPlayerMixin implements AbstractClientPlayerExt { public abstract class AbstractClientPlayerMixin implements AbstractClientPlayerExt {
@Unique private AnimatedResourceLocation silent$cape; @Unique private AnimatedResourceLocation silent$cape;
@Unique private AnimatedResourceLocation silent$bandana; @Unique private AnimatedResourceLocation silent$bandana;

View File

@ -53,9 +53,9 @@ public class GeneralMod extends Mod {
break; break;
case "Menu Background Blur": case "Menu Background Blur":
if(setting.getValBoolean()) { if(setting.getValBoolean()) {
MenuBlurUtils.loadBlur(); MenuBlurUtils.loadBlur(true);
} else { } else {
MenuBlurUtils.unloadBlur(); MenuBlurUtils.unloadBlur(true);
} }
break; break;
case "Menu Animations": case "Menu Animations":

View File

@ -8,13 +8,21 @@ import net.silentclient.client.mods.settings.GeneralMod;
public class MenuBlurUtils { public class MenuBlurUtils {
public static void loadBlur() { public static void loadBlur() {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) { loadBlur(false);
}
public static void loadBlur(boolean force) {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean() || force) {
((EntityRendererExt) Minecraft.getMinecraft().entityRenderer).silent$loadShader(new StaticResourceLocation("shaders/post/menu_blur.json")); ((EntityRendererExt) Minecraft.getMinecraft().entityRenderer).silent$loadShader(new StaticResourceLocation("shaders/post/menu_blur.json"));
} }
} }
public static void unloadBlur() { public static void unloadBlur() {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) { unloadBlur(false);
}
public static void unloadBlur(boolean force) {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean() || force) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null); Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
} }
} }