diff --git a/src/main/java/me/redcarlos/higtools/HIGTools.java b/src/main/java/me/redcarlos/higtools/HIGTools.java index 340b73c..def5081 100644 --- a/src/main/java/me/redcarlos/higtools/HIGTools.java +++ b/src/main/java/me/redcarlos/higtools/HIGTools.java @@ -5,7 +5,6 @@ import me.redcarlos.higtools.commands.Coordinates; import me.redcarlos.higtools.modules.highwayborers.*; import me.redcarlos.higtools.modules.hud.TextPresets; -import me.redcarlos.higtools.modules.hud.WelcomeHudHig; import me.redcarlos.higtools.modules.main.*; import me.redcarlos.higtools.system.HIGTab; import meteordevelopment.meteorclient.addons.MeteorAddon; @@ -31,7 +30,7 @@ public class HIGTools extends MeteorAddon { public static final HudGroup HUD; static { - METADATA = FabricLoader.getInstance().getModContainer("higtools").orElseThrow().getMetadata(); + METADATA = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata(); VERSION = METADATA.getVersion().getFriendlyString(); MAIN = new Category("HIG Tools", Items.NETHERITE_PICKAXE.getDefaultStack()); @@ -43,7 +42,8 @@ public class HIGTools extends MeteorAddon { public void onInitialize() { LogUtils.getLogger().info("Initializing HIGTools {}", HIGTools.VERSION); - BetterChat.registerCustomHead("[HIGTools]", identifier("chat/icon.png")); + // Systems + BetterChat.registerCustomHead("[HIG Tools]", identifier("icon.png")); Tabs.add(new HIGTab()); // Commands @@ -53,7 +53,6 @@ public void onInitialize() { // Hud Hud hud = Systems.get(Hud.class); hud.register(TextPresets.INFO); - hud.register(WelcomeHudHig.INFO); // Modules Modules modules = Modules.get(); diff --git a/src/main/java/me/redcarlos/higtools/modules/hud/TextPresets.java b/src/main/java/me/redcarlos/higtools/modules/hud/TextPresets.java index 964ca22..cf1c3a1 100644 --- a/src/main/java/me/redcarlos/higtools/modules/hud/TextPresets.java +++ b/src/main/java/me/redcarlos/higtools/modules/hud/TextPresets.java @@ -12,15 +12,18 @@ private static TextHud create() { } static { - addPreset("Player-Coords", "XYZ: #1{roundToString(player.pos.x, 1)}, {floor(player.pos.y)}, {roundToString(player.pos.z, 1)}", 0); - addPreset("Opposite-Coords", "{player.opposite_dimension != \"End\" ? player.opposite_dimension + \":\" : \"\"} #1{player.opposite_dimension != \"End\" ? \"\" + floor(player.opposite_dim_pos.x) + \", \" + floor(player.opposite_dim_pos.z) : \"\"}", 0); - addPreset("KM/H-Speed", "Speed: #1{roundToString(player.speed*3.6, 1)} km/h", 0); + // These use a different and more accurate rounding method than Meteor's, do not remove + addPreset("Player Coords", "XYZ: #1{roundToString(player.pos.x, 1)}, {floor(player.pos.y)}, {roundToString(player.pos.z, 1)}"); + addPreset("Opposite Coords", "{player.opposite_dimension != \"End\" ? player.opposite_dimension + \":\" : \"\"} #1{player.opposite_dimension != \"End\" ? \"\" + floor(player.opposite_dim_pos.x) + \", \" + floor(player.opposite_dim_pos.z) : \"\"}"); + + addPreset("Welcome Hud", "Welcome to HIG Tools, #1{meteor.is_module_active(\"name-protect\") ? meteor.get_module_setting(\"name-protect\", \"name\") : player._toString}"); + addPreset("KM/H Speed", "Speed: #1{roundToString(player.speed * 3.6, 1)} km/h"); } - private static HudElementInfo.Preset addPreset(String title, String text, int updateDelay) { - return INFO.addPreset(title, textHud -> { + private static void addPreset(String title, String text) { + INFO.addPreset(title, textHud -> { if (text != null) textHud.text.set(text); - if (updateDelay != -1) textHud.updateDelay.set(updateDelay); + textHud.updateDelay.set(0); }); } } diff --git a/src/main/java/me/redcarlos/higtools/modules/hud/WelcomeHudHig.java b/src/main/java/me/redcarlos/higtools/modules/hud/WelcomeHudHig.java deleted file mode 100644 index dc43d17..0000000 --- a/src/main/java/me/redcarlos/higtools/modules/hud/WelcomeHudHig.java +++ /dev/null @@ -1,48 +0,0 @@ -package me.redcarlos.higtools.modules.hud; - -import me.redcarlos.higtools.HIGTools; -import meteordevelopment.meteorclient.systems.hud.HudElement; -import meteordevelopment.meteorclient.systems.hud.HudElementInfo; -import meteordevelopment.meteorclient.systems.hud.HudRenderer; -import meteordevelopment.meteorclient.systems.hud.elements.TextHud; -import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.misc.NameProtect; - -import static meteordevelopment.meteorclient.MeteorClient.mc; - -public class WelcomeHudHig extends HudElement { - public static final HudElementInfo INFO = new HudElementInfo<>(HIGTools.HUD, "HIG-welcome", "Displays a welcome message.", WelcomeHudHig::new); - - private String leftText; - private String rightText; - private double leftWidth; - - public WelcomeHudHig() { - super(INFO); - } - - @Override - public void tick(HudRenderer renderer) { - leftText = "Welcome to HIG Tools, "; - rightText = Modules.get().get(NameProtect.class).getName(mc.getSession().getUsername()); - - leftWidth = renderer.textWidth(leftText); - double rightWidth = renderer.textWidth(rightText); - - box.setSize((leftWidth + rightWidth), renderer.textHeight()); - } - - @Override - public void render(HudRenderer renderer) { - double x = this.x; - double y = this.y; - - if (isInEditor()) { - renderer.text("Welcome Hud", x, y, TextHud.getSectionColor(0), true); - return; - } - - renderer.text(leftText, x, y, TextHud.getSectionColor(0), true); - renderer.text(rightText, x + leftWidth, y, TextHud.getSectionColor(1), true); - } -} diff --git a/src/main/resources/assets/higtools/chat/icon.png b/src/main/resources/assets/higtools/icon.png similarity index 100% rename from src/main/resources/assets/higtools/chat/icon.png rename to src/main/resources/assets/higtools/icon.png diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9406450..710dd54 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -9,13 +9,12 @@ "Ethius" ], "contact": { - "homepage": "https://discord.gg/a4jkKGJNdJ", "issues": "https://github.com/RedCarlos26/HIGTools/issues", "sources": "https://github.com/RedCarlos26/HIGTools", "discord": "https://discord.gg/a4jkKGJNdJ" }, "license": "GPL-3.0", - "icon": "assets/higtools/chat/icon.png", + "icon": "assets/higtools/icon.png", "environment": "client", "entrypoints": { "meteor": [