diff --git a/src/main/java/net/silentclient/client/config/AddConfigModal.java b/src/main/java/net/silentclient/client/config/AddConfigModal.java index 355386c..d4f13a8 100644 --- a/src/main/java/net/silentclient/client/config/AddConfigModal.java +++ b/src/main/java/net/silentclient/client/config/AddConfigModal.java @@ -7,12 +7,11 @@ import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.elements.IconButton; -import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.elements.Checkbox; +import net.silentclient.client.gui.elements.IconButton; import net.silentclient.client.gui.elements.Input; import net.silentclient.client.gui.font.SilentFontRenderer; -import net.silentclient.client.gui.notification.NotificationManager; +import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.NotificationUtils; @@ -67,7 +66,7 @@ public class AddConfigModal extends SilentScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); GlStateManager.pushMatrix(); int x = width / 2 - (this.modalWidth / 2); int y = height / 2 - (this.modalHeight / 2); diff --git a/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java b/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java index 60b50a9..77fe209 100644 --- a/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java +++ b/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java @@ -233,7 +233,7 @@ public class CosmeticsGui extends SilentScreen { GlStateManager.enableAlpha(); this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE); } else { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); } int addX = 190; diff --git a/src/main/java/net/silentclient/client/gui/ModalBase.java b/src/main/java/net/silentclient/client/gui/ModalBase.java index 51e0416..d096758 100644 --- a/src/main/java/net/silentclient/client/gui/ModalBase.java +++ b/src/main/java/net/silentclient/client/gui/ModalBase.java @@ -49,7 +49,7 @@ public class ModalBase extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); RenderUtils.drawRect(this.getContentX(), this.getContentY(), this.modalWidth, this.modalHeight, Theme.backgroundColor().getRGB()); Client.getInstance().getSilentFontRenderer().drawString(this.modalTitle, this.getContentX() + 3, this.getContentY() + 3, 14, SilentFontRenderer.FontType.TITLE); diff --git a/src/main/java/net/silentclient/client/gui/friends/AddFriendModal.java b/src/main/java/net/silentclient/client/gui/friends/AddFriendModal.java index 3a46cef..edaa8aa 100644 --- a/src/main/java/net/silentclient/client/gui/friends/AddFriendModal.java +++ b/src/main/java/net/silentclient/client/gui/friends/AddFriendModal.java @@ -6,12 +6,11 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; -import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.IconButton; import net.silentclient.client.gui.elements.Input; import net.silentclient.client.gui.font.SilentFontRenderer; -import net.silentclient.client.gui.notification.NotificationManager; +import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.NotificationUtils; @@ -68,7 +67,7 @@ public class AddFriendModal extends SilentScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); GlStateManager.pushMatrix(); int x = width / 2 - (this.modalWidth / 2); int y = height / 2 - (this.modalHeight / 2); diff --git a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java index cf4ce62..cb5059c 100644 --- a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java +++ b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java @@ -50,7 +50,7 @@ public class FriendsListOverlay extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); this.buttonList.get(2).displayString = "Requests (" + Client.getInstance().getFriends().getRequestCount() + ")"; SilentFontRenderer font = Client.getInstance().getSilentFontRenderer(); GlStateManager.pushMatrix(); diff --git a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java index c733416..ecf3d67 100644 --- a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java +++ b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java @@ -1,17 +1,5 @@ package net.silentclient.client.gui.hud; -import java.awt.Color; -import java.io.IOException; -import java.text.DecimalFormat; - -import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.lite.clickgui.ClickGUI; -import net.silentclient.client.gui.modmenu.ModMenu; -import net.silentclient.client.utils.MenuBlurUtils; -import net.silentclient.client.utils.MouseCursorHandler; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -19,19 +7,28 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MathHelper; import net.silentclient.client.Client; +import net.silentclient.client.gui.elements.Button; +import net.silentclient.client.gui.font.SilentFontRenderer; +import net.silentclient.client.gui.font.SilentFontRenderer.FontType; import net.silentclient.client.gui.lite.clickgui.ModSettings; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; -import net.silentclient.client.gui.font.SilentFontRenderer; -import net.silentclient.client.gui.font.SilentFontRenderer.FontType; import net.silentclient.client.mods.CustomFontRenderer; import net.silentclient.client.mods.CustomFontRenderer.RenderMode; -import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModDraggable; import net.silentclient.client.mods.Setting; +import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.utils.ColorUtils; +import net.silentclient.client.utils.MenuBlurUtils; +import net.silentclient.client.utils.MouseCursorHandler; import net.silentclient.client.utils.Sounds; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +import java.awt.*; +import java.io.IOException; +import java.text.DecimalFormat; public class HUDConfigScreen extends GuiScreen { @@ -68,7 +65,7 @@ public class HUDConfigScreen extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); final float zBackup = this.zLevel; this.zLevel = 200; ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java index 605e831..9e3e041 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java @@ -12,23 +12,22 @@ import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.animation.normal.Animation; import net.silentclient.client.gui.animation.normal.Direction; import net.silentclient.client.gui.animation.normal.impl.EaseBackIn; -import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; -import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Input; import net.silentclient.client.gui.elements.Switch; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.font.SilentFontRenderer.FontType; import net.silentclient.client.gui.hud.HUDConfigScreen; -import net.silentclient.client.gui.notification.NotificationManager; +import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; +import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.theme.Theme; +import net.silentclient.client.gui.theme.button.DefaultButtonTheme; +import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.premium.PremiumGui; -import net.silentclient.client.gui.theme.button.DefaultButtonTheme; -import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.utils.ColorUtils; import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.Sounds; @@ -98,7 +97,7 @@ public class ClickGUI extends SilentScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); int addX = 190; int addY = 110; diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java index d8bbd77..fe84b79 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java @@ -84,7 +84,7 @@ public class GuiColorPicker extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); int addX = 190; int addY = 110; diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java index 79a2e59..941cb0b 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java @@ -98,7 +98,7 @@ public class ModSettings extends SilentScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); int addX = 190; int addY = 110; diff --git a/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java b/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java index 7d3fb2c..67f2a2a 100644 --- a/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java +++ b/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java @@ -1,7 +1,5 @@ package net.silentclient.client.gui.minecraft; -import java.io.IOException; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; import net.minecraft.client.gui.achievement.GuiAchievements; @@ -15,17 +13,19 @@ import net.silentclient.client.admin.AdminRender; import net.silentclient.client.cosmetics.Cosmetics; import net.silentclient.client.cosmetics.gui.CosmeticsGui; import net.silentclient.client.event.impl.ServerLeaveEvent; -import net.silentclient.client.gui.elements.IconButton; -import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.GuiMultiplayerInGame; -import net.silentclient.client.gui.lite.clickgui.ClickGUI; +import net.silentclient.client.gui.elements.Button; +import net.silentclient.client.gui.elements.IconButton; import net.silentclient.client.gui.friends.FriendsListOverlay; import net.silentclient.client.gui.hud.Watermark; +import net.silentclient.client.gui.lite.clickgui.ClickGUI; import net.silentclient.client.gui.modmenu.ModMenu; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.utils.MenuBlurUtils; +import java.io.IOException; + public class GuiIngameMenu extends GuiScreen { /** @@ -159,7 +159,7 @@ public class GuiIngameMenu extends GuiScreen */ public void drawScreen(int mouseX, int mouseY, float partialTicks) { - this.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); new Watermark().render((this.width / 2) - (110 / 2), 40); super.drawScreen(mouseX, mouseY, partialTicks); diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java b/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java index ec3bd6b..f2f8bdb 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java @@ -7,9 +7,7 @@ import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Checkbox; -import net.silentclient.client.gui.elements.Slider; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; -import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.theme.button.DefaultButtonTheme; import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.gui.util.RenderUtil; @@ -73,7 +71,7 @@ public class ColorPicker extends SilentScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); ModMenu.drawOverlayListBase(height, "Choose a color"); diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java b/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java index a707608..7796479 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java @@ -122,7 +122,7 @@ public class ModMenu extends SilentScreen { if(ModMenu.introAnimation.getValue() == 0) { ModMenu.loaded = true; } - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); ModMenu.drawOverlayListBase(height, modCategory == ModCategory.PLUS ? "Premium" : null); super.drawScreen(mouseX, mouseY, partialTicks); diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java index 4791b7c..500381a 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java @@ -69,7 +69,7 @@ public class ModSettings extends SilentScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); ModMenu.drawOverlayListBase(height, mod.getName()); super.drawScreen(mouseX, mouseY, partialTicks); diff --git a/src/main/java/net/silentclient/client/mixin/accessors/GuiAccessor.java b/src/main/java/net/silentclient/client/mixin/accessors/GuiAccessor.java index 4cd5593..4421f92 100644 --- a/src/main/java/net/silentclient/client/mixin/accessors/GuiAccessor.java +++ b/src/main/java/net/silentclient/client/mixin/accessors/GuiAccessor.java @@ -2,11 +2,12 @@ package net.silentclient.client.mixin.accessors; import net.minecraft.client.gui.Gui; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(Gui.class) public interface GuiAccessor { @Invoker("drawHorizontalLine") void silent$drawHorizontalLine(int startX, int endX, int y, int color); @Invoker("drawVerticalLine") void silent$drawVerticalLine(int x, int startY, int endY, int color); + + @Invoker("drawGradientRect") void silent$drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor); } diff --git a/src/main/java/net/silentclient/client/mods/player/AutoTextMod.java b/src/main/java/net/silentclient/client/mods/player/AutoTextMod.java index b441f88..68d53d9 100644 --- a/src/main/java/net/silentclient/client/mods/player/AutoTextMod.java +++ b/src/main/java/net/silentclient/client/mods/player/AutoTextMod.java @@ -257,7 +257,7 @@ public class AutoTextMod extends Mod { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); GlStateManager.pushMatrix(); int x = width / 2 - (this.modalWidth / 2); int y = height / 2 - (this.modalHeight / 2); diff --git a/src/main/java/net/silentclient/client/premium/PremiumGui.java b/src/main/java/net/silentclient/client/premium/PremiumGui.java index e9ae7f0..ed28356 100644 --- a/src/main/java/net/silentclient/client/premium/PremiumGui.java +++ b/src/main/java/net/silentclient/client/premium/PremiumGui.java @@ -151,7 +151,7 @@ public class PremiumGui { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); + MenuBlurUtils.renderBackground(this); int addX = 190; int addY = 110; diff --git a/src/main/java/net/silentclient/client/utils/MenuBlurUtils.java b/src/main/java/net/silentclient/client/utils/MenuBlurUtils.java index d798fb3..37eef4c 100644 --- a/src/main/java/net/silentclient/client/utils/MenuBlurUtils.java +++ b/src/main/java/net/silentclient/client/utils/MenuBlurUtils.java @@ -1,11 +1,15 @@ package net.silentclient.client.utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; import net.silentclient.client.Client; import net.silentclient.client.cosmetics.StaticResourceLocation; +import net.silentclient.client.mixin.accessors.GuiAccessor; import net.silentclient.client.mixin.ducks.EntityRendererExt; import net.silentclient.client.mods.settings.GeneralMod; +import java.awt.*; + public class MenuBlurUtils { public static void loadBlur() { loadBlur(false); @@ -17,6 +21,14 @@ public class MenuBlurUtils { } } + public static void renderBackground(GuiScreen instance) { + if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) { + ((GuiAccessor) instance).silent$drawGradientRect(0, 0, instance.width, instance.height, new Color(0, 0, 0, 0).getRGB(), new Color(0, 0, 0, 0).getRGB()); + } else { + instance.drawDefaultBackground(); + } + } + public static void unloadBlur() { unloadBlur(false); }