(feature) scoreboard bg color

This commit is contained in:
kirillsaint 2024-01-19 21:58:57 +06:00
parent c12baaa8d2
commit f5a236d3c6
3 changed files with 20 additions and 5 deletions

View File

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

View File

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

View File

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