From d6f70abc688d05ed08325947724c7c34dbd36f3c Mon Sep 17 00:00:00 2001 From: ThisIsALegitUsername <73719631+ThisIsALegitUsername@users.noreply.github.com> Date: Tue, 28 Feb 2023 20:00:44 -0500 Subject: [PATCH] some more ui improvements --- src/main/java/dev/resent/module/impl/hud/Info.java | 7 +++++-- src/main/java/dev/resent/visual/ui/ClickGUI.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/resent/module/impl/hud/Info.java b/src/main/java/dev/resent/module/impl/hud/Info.java index e6575738..bd3397b7 100644 --- a/src/main/java/dev/resent/module/impl/hud/Info.java +++ b/src/main/java/dev/resent/module/impl/hud/Info.java @@ -20,7 +20,10 @@ public class Info extends RenderMod { public static final String[] directionsF = new String[] { "\u00A79S\u00A7r", "\u00A72W\u00A7r", "\u00A74N\u00A7r", "\u00A76E\u00A7r" }; public int getWidth() { - return mc.fontRendererObj.getStringWidth("X: " + mc.thePlayer.posX + " Dir: " + directionsF[MathHelper.floor_double(this.mc.thePlayer.rotationYaw * 4 / 360 + 0.5) & 3]); + int px = (int) mc.thePlayer.posX; + int py = (int) mc.thePlayer.posY; + int pz = (int) mc.thePlayer.posZ; + return 5 + mc.fontRendererObj.getStringWidth(" X: Biome:" + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName + Math.max(py, pz)); } public int getHeight() { @@ -41,7 +44,7 @@ public class Info extends RenderMod { if (direction.getValue()){ drawString(" Dir: ", this.x + 5 + mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow()); - mc.fontRendererObj.drawString(directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth("X: " + px), this.y + 14, -1, Theme.getTextShadow()); + mc.fontRendererObj.drawString(directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth(" X: Dir: " + px), this.y + 14, -1, Theme.getTextShadow()); } drawString(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow()); } diff --git a/src/main/java/dev/resent/visual/ui/ClickGUI.java b/src/main/java/dev/resent/visual/ui/ClickGUI.java index a331e488..b4d72105 100644 --- a/src/main/java/dev/resent/visual/ui/ClickGUI.java +++ b/src/main/java/dev/resent/visual/ui/ClickGUI.java @@ -1,6 +1,7 @@ package dev.resent.visual.ui; import java.io.IOException; +import java.util.Comparator; import dev.resent.client.ClientInfo; import dev.resent.client.Resent; @@ -59,6 +60,7 @@ public class ClickGUI extends GuiScreen { this.openedMod = null; } + Resent.INSTANCE.modManager.modsInCategory(selectedCategory).sort(Comparator.comparingInt(m -> fr.getStringWidth(m.getName()))); for (Mod m : Resent.INSTANCE.modManager.modsInCategory(selectedCategory) ) { int fh = 9; @@ -89,8 +91,7 @@ public class ClickGUI extends GuiScreen { if (openedMod != null) { int var = 0; - for (int asdf = 0; asdf < this.openedMod.settings.size(); asdf++) { - Setting s = this.openedMod.settings.get(asdf); + for (Setting s : this.openedMod.settings) { if (s instanceof BooleanSetting) { if (isMouseInside(mouseX, mouseY, this.x + 13, height - 9 + 50 - offset + var + 1, this.x + 20, height - 9 + 50 + 9 - offset + var - 1) && mouseButton == 0) { @@ -173,6 +174,8 @@ public class ClickGUI extends GuiScreen { //white line drawRect(x - 8, height + 29, width + 33, height + 30, -1); GlUtils.stopScale(); + + Resent.INSTANCE.modManager.modsInCategory(selectedCategory).sort(Comparator.comparingInt(m -> fr.getStringWidth(m.getName()))); for (Mod m : Resent.INSTANCE.modManager.modsInCategory(selectedCategory)) { if (this.openedMod == null) { int fh = 9;