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(Minecraft.getMinecraft().currentScreen != null) {
if(!set.getValBoolean()) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
} else {
MenuBlurUtils.loadBlur();
}
MenuBlurUtils.unloadBlur(true);
} else {
MenuBlurUtils.loadBlur(true);
}
}
}
} catch (Exception err) {

View File

@ -2,7 +2,6 @@ package net.silentclient.client.mixin.mixins;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraft.world.World;
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.callback.CallbackInfo;
@Mixin(value = AbstractClientPlayer.class, priority = 2000)
@Mixin(AbstractClientPlayer.class)
public abstract class AbstractClientPlayerMixin implements AbstractClientPlayerExt {
@Unique private AnimatedResourceLocation silent$cape;
@Unique private AnimatedResourceLocation silent$bandana;

View File

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

View File

@ -8,13 +8,21 @@ import net.silentclient.client.mods.settings.GeneralMod;
public class MenuBlurUtils {
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"));
}
}
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);
}
}