From f5a236d3c6973ef97754d67be72570095e595249 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 19 Jan 2024 21:58:57 +0600 Subject: [PATCH] (feature) scoreboard bg color --- .../java/net/silentclient/client/Client.java | 6 ++++++ .../client/mods/hud/ScoreboardMod.java | 17 ++++++++++++++--- .../client/mods/player/PerspectiveMod.java | 2 -- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/silentclient/client/Client.java b/src/main/java/net/silentclient/client/Client.java index 9cf5cd2..7ede738 100644 --- a/src/main/java/net/silentclient/client/Client.java +++ b/src/main/java/net/silentclient/client/Client.java @@ -8,6 +8,7 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.resources.data.IMetadataSerializer; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Session; import net.silentclient.client.config.ConfigManager; import net.silentclient.client.cosmetics.Cosmetics; import net.silentclient.client.event.EventManager; @@ -26,6 +27,7 @@ import net.silentclient.client.keybinds.KeyBindManager; import net.silentclient.client.mixin.SilentClientTweaker; import net.silentclient.client.mixin.accessors.MinecraftAccessor; import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt; +import net.silentclient.client.mixin.ducks.MinecraftExt; import net.silentclient.client.mods.ModInstances; import net.silentclient.client.mods.SettingsManager; import net.silentclient.client.mods.settings.CosmeticsMod; @@ -201,6 +203,10 @@ public class Client { if(acc != null) { Client.getInstance().setAccount(acc.getAccount()); + if(ClientUtils.isDevelopment()) { + Session session = new Session(account.original_username, AccountManager.nameToUuid(account.original_username), "0", "legacy"); + ((MinecraftExt) Minecraft.getMinecraft()).setSession(session); + } } logger.info("STARTING > settings-manager"); settingsManager = new SettingsManager(); diff --git a/src/main/java/net/silentclient/client/mods/hud/ScoreboardMod.java b/src/main/java/net/silentclient/client/mods/hud/ScoreboardMod.java index b59dd5b..47a81e8 100644 --- a/src/main/java/net/silentclient/client/mods/hud/ScoreboardMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/ScoreboardMod.java @@ -14,6 +14,7 @@ import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; import org.lwjgl.opengl.GL11; +import java.awt.*; import java.util.ArrayList; import java.util.Iterator; @@ -25,7 +26,12 @@ public class ScoreboardMod extends Mod { @Override public void setup() { this.addSliderSetting("Scale", this, 1, 0.3, 2, false); + + this.addBooleanSetting("Header Background", this, true); + this.addColorSetting("Header Background Color", this, new Color(0, 0, 0), 96); + this.addBooleanSetting("Background", this, true); + this.addColorSetting("Background Color", this, new Color(0, 0, 0), 80); this.addBooleanSetting("Font Shadow", this, true); this.addBooleanSetting("Numbers", this, false); @@ -35,6 +41,9 @@ public class ScoreboardMod extends Mod { if (Client.getInstance().getModInstances().getModByClass(ScoreboardMod.class).isEnabled()) { boolean redNumbers = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Numbers").getValBoolean(); boolean background = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Background").getValBoolean(); + Color bgColor = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Background Color").getValColor(); + boolean headerBackground = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Header Background").getValBoolean(); + Color headerBgColor = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Header Background Color").getValColor(); boolean fontShadow = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Font Shadow").getValBoolean(); float scale = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Scale").getValFloat(); @@ -87,7 +96,7 @@ public class ScoreboardMod extends Mod { int scoreY = sidebarY - k * fr.FONT_HEIGHT; if(background) { - Gui.drawRect(sidebarX - 2, scoreY, scoreX, scoreY + fr.FONT_HEIGHT, 1342177280); + Gui.drawRect(sidebarX - 2, scoreY, scoreX, scoreY + fr.FONT_HEIGHT, bgColor.getRGB()); } fr.drawString(s1, sidebarX, scoreY, -1, fontShadow); fr.drawString(s21, scoreX - fr.getStringWidth(s21), scoreY, -1, fontShadow); @@ -95,8 +104,10 @@ public class ScoreboardMod extends Mod { String s3 = sidebar.getDisplayName(); if(background) { - Gui.drawRect(sidebarX - 2, scoreY - fr.FONT_HEIGHT - 1, scoreX, scoreY - 1, 1610612736); - Gui.drawRect(sidebarX - 2, scoreY - 1, scoreX, scoreY, 1342177280); + if(headerBackground) { + Gui.drawRect(sidebarX - 2, scoreY - fr.FONT_HEIGHT - 1, scoreX, scoreY - 1, headerBgColor.getRGB()); + } + Gui.drawRect(sidebarX - 2, scoreY - 1, scoreX, scoreY, bgColor.getRGB()); } fr.drawString(s3, sidebarX + (sidebarWidth - fr.getStringWidth(s3)) / 2, scoreY - fr.FONT_HEIGHT, -1, fontShadow); } diff --git a/src/main/java/net/silentclient/client/mods/player/PerspectiveMod.java b/src/main/java/net/silentclient/client/mods/player/PerspectiveMod.java index a9bbd20..494c2d9 100644 --- a/src/main/java/net/silentclient/client/mods/player/PerspectiveMod.java +++ b/src/main/java/net/silentclient/client/mods/player/PerspectiveMod.java @@ -113,7 +113,6 @@ public class PerspectiveMod extends Mod { private void start() { if(!active) { - Client.logger.info("perspective active"); active = true; previousPerspective = mc.gameSettings.thirdPersonView; mc.gameSettings.thirdPersonView = 3; @@ -125,7 +124,6 @@ public class PerspectiveMod extends Mod { private void stop() { if(active) { - Client.logger.info("perspective deactive"); active = false; mc.gameSettings.thirdPersonView = previousPerspective; mc.renderGlobal.setDisplayListEntitiesDirty();