Better Blur

This commit is contained in:
kirillsaint 2023-07-22 04:48:02 +06:00
parent 9e052f1bd2
commit 67c4277cb6
17 changed files with 53 additions and 48 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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());

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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");

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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);
}