From d7ff8d17cb28e8f4624eb4573733fe2cd64112bc Mon Sep 17 00:00:00 2001 From: Jess Date: Mon, 17 Jun 2024 03:46:41 +0100 Subject: [PATCH] misc fixes + hud stuff --- .../feature/modules/client/AltControl.java | 5 ++ .../modules/player/AntiLevitation.java | 1 + .../client/feature/modules/render/HUD.java | 59 +++++++++++++++++-- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Client/src/main/java/de/com/baseband/client/feature/modules/client/AltControl.java b/Client/src/main/java/de/com/baseband/client/feature/modules/client/AltControl.java index 3d6b69d..292903e 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/modules/client/AltControl.java +++ b/Client/src/main/java/de/com/baseband/client/feature/modules/client/AltControl.java @@ -72,6 +72,11 @@ public class AltControl extends Feature { BaseBand.publish(new RemoteSendMessageEvent(String.join(" ", args))); } + @Override + public void onTick() { + this.meta = String.valueOf(BaseBand.REMOTE_EVENT_BUS.clients.size()); + } + @Override public String toString() { return "AltControl"; diff --git a/Client/src/main/java/de/com/baseband/client/feature/modules/player/AntiLevitation.java b/Client/src/main/java/de/com/baseband/client/feature/modules/player/AntiLevitation.java index 985ee50..0768f0b 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/modules/player/AntiLevitation.java +++ b/Client/src/main/java/de/com/baseband/client/feature/modules/player/AntiLevitation.java @@ -23,6 +23,7 @@ public class AntiLevitation extends Feature { @Override public void onTick() { + meta = mode.name(); if(mc.player.isPotionActive(MobEffects.LEVITATION) && mode == Mode.Effect) { mc.player.getActivePotionMap().remove(MobEffects.LEVITATION); } diff --git a/Client/src/main/java/de/com/baseband/client/feature/modules/render/HUD.java b/Client/src/main/java/de/com/baseband/client/feature/modules/render/HUD.java index 36515f7..2c6ab37 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/modules/render/HUD.java +++ b/Client/src/main/java/de/com/baseband/client/feature/modules/render/HUD.java @@ -23,6 +23,7 @@ import net.minecraft.entity.Entity; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.awt.*; import java.text.SimpleDateFormat; import java.util.*; @@ -79,6 +80,11 @@ public class HUD extends Feature { Future } + public enum ModuleColor { + Normal, + Future, + Trans + } public enum NotificationLocation { Left, Center, Right @@ -145,14 +151,13 @@ public class HUD extends Feature { @Config("Module Status Color") public ModuleMetaColor moduleMetaColor = ModuleMetaColor.Normal; + @Config("Module Color") + public ModuleColor moduleColor = ModuleColor.Normal; + @Config("HUD background") @Description("Renders a slightly transparent background below the HUD") public boolean background = true; - @Config("Module HashColors") - @Description("Gets the Module color from a hash of the module's name") - public boolean hashColor = false; - @Config("Text shadow") public boolean textShadow = true; @@ -246,8 +251,9 @@ public class HUD extends Feature { TextSplitter.drawString(initString, 3,3, theme.getGreenColor(), textShadow, false); int y = 3 + TextSplitter.getStringHeight(initString); - for (Feature f : renderFeatures) { - mc.fontRenderer.drawString(f.getHUDText(), 3, y, hashColor ? f.getHashColor() : theme.getGreenColor(), textShadow); + for (int i = 0; i < renderFeatures.length; i++) { + Feature f = renderFeatures[i]; + mc.fontRenderer.drawString(f.getHUDText(), 3, y, getColor(f, i), textShadow); y = y + mc.fontRenderer.FONT_HEIGHT; } @@ -335,6 +341,47 @@ public class HUD extends Feature { } } + public int getColor(Feature feature, int featureIndex) { + switch (moduleColor) { + case Normal: + GuiTheme.ITheme theme = Features.getFeature(Client.class).getTheme(); + return theme.getGreenColor(); + case Future: + return feature.getHashColor(); + case Trans: + return getCuteColor(featureIndex); + default: + return 0; //should not be possible fuck you + } + } + + private int getCuteColor(int index) { + int size = (int) Arrays.stream(Features.features).filter(m -> m.enabled && m.displayOnHUD()).count(); + + int light_blue = new Color(91, 206, 250).getRGB(); + int white = Color.WHITE.getRGB(); + int pink = new Color(245, 169, 184).getRGB(); + + int part = (int) ((float) index / size * 5); + + + if (part == 0) { + return light_blue; + } + if (part == 1) { + return pink; + } + if (part == 2) { + return white; + } + if (part == 3) { + return pink; + } + + + return light_blue; //fail + } + @Render public static class ShowTPS extends Feature {