diff --git a/src/main/java/net/aoba/gui/HudManager.java b/src/main/java/net/aoba/gui/HudManager.java index 5b4012e..ef8a46a 100644 --- a/src/main/java/net/aoba/gui/HudManager.java +++ b/src/main/java/net/aoba/gui/HudManager.java @@ -1,12 +1,18 @@ package net.aoba.gui; -import java.util.Hashtable; +import java.util.ArrayList; +import java.util.List; import org.lwjgl.glfw.GLFW; import org.lwjgl.opengl.GL11; import net.aoba.module.Module; import net.aoba.Aoba; -import net.aoba.gui.elements.ModuleComponent; +import net.aoba.gui.hud.AbstractHud; +import net.aoba.gui.hud.ArmorHud; +import net.aoba.gui.hud.InfoHud; +import net.aoba.gui.hud.ModuleSelectorHud; +import net.aoba.gui.hud.RadarHud; import net.aoba.gui.tabs.*; +import net.aoba.gui.tabs.components.ModuleComponent; import net.aoba.misc.RainbowColor; import net.aoba.misc.RenderUtils; import net.aoba.module.Module.Category; @@ -19,77 +25,102 @@ public class HudManager { - public MinecraftClient mc; - public Hashtable tabs = new Hashtable(); + protected MinecraftClient mc = MinecraftClient.getInstance(); + protected RenderUtils renderUtils = new RenderUtils(); + + private KeyBinding clickGuiButton = new KeyBinding("key.clickgui", GLFW.GLFW_KEY_GRAVE_ACCENT, "key.categories.aoba"); private KeyBinding esc = new KeyBinding("key.esc", GLFW.GLFW_KEY_ESCAPE, "key.categories.aoba"); private boolean clickGuiOpen = false; - private RenderUtils renderUtils;; - public IngameGUI hud; - public ArmorHUD armorHud; - public static Tab currentGrabbed = null; + public static IMoveable currentGrabbed = null; private int lastMouseX = 0; private int lastMouseY = 0; private int mouseX; private int mouseY; + + private List activeHuds = new ArrayList(); private boolean wasTildaPressed = false; - - public InfoTab infoTab; - public OptionsTab optionsTab; - public RadarTab radarTab; - public AuthCrackerTab authCrackerTab; - + + public NavigationBar clickGuiNavBar; + public SliderSetting hue = new SliderSetting("Hue", "color_hue", 4, 0, 360, 1); public SliderSetting effectSpeed = new SliderSetting("Effect Spd", "color_speed", 4, 1, 20, 0.1); public BooleanSetting rainbow = new BooleanSetting("Rainbow", "rainbow_mode"); public BooleanSetting ah = new BooleanSetting("ArmorHUD", "armorhud_toggle"); - + private Color currentColor; private Color color; private RainbowColor rainbowColor; public HudManager() { mc = MinecraftClient.getInstance(); - hud = new IngameGUI(); - armorHud = new ArmorHUD(); + renderUtils = Aoba.getInstance().renderUtils; color = new Color(hue.getValueFloat(), 1f, 1f); currentColor = color; rainbowColor = new RainbowColor(); rainbow.setValue(Settings.getSettingBoolean("rainbowUI")); + + clickGuiNavBar = new NavigationBar(); + + NavigationPane modulesPane = new NavigationPane("Modules"); + NavigationPane toolsPane = new NavigationPane("Tools"); + NavigationPane hudPane = new NavigationPane("Hud"); + NavigationPane settingsPane = new NavigationPane("Settings"); + + toolsPane.AddHud(new AuthCrackerTab("Auth Cracker", 810, 500)); + + ModuleSelectorHud moduleSelector = new ModuleSelectorHud(); + ArmorHud armorHud = new ArmorHud(790, 500, 200, 50); + RadarHud radarHud = new RadarHud(590, 500, 180, 180); + InfoHud infoHud = new InfoHud(100, 500); - infoTab = new InfoTab("InfoTab", 100, 500); - optionsTab = new OptionsTab("Options", 370, 500, hue, rainbow, ah, effectSpeed); - radarTab = new RadarTab("Radar", 590, 500); - authCrackerTab = new AuthCrackerTab("Auth Cracker", 810, 500); + // TODO: Dumb workaround but I would like to be able to add HUDs through the pane found on the NavBar + this.activeHuds.add(moduleSelector); + this.activeHuds.add(armorHud); + this.activeHuds.add(infoHud); + this.activeHuds.add(infoHud); + + hudPane.AddHud(moduleSelector); + hudPane.AddHud(armorHud); + hudPane.AddHud(infoHud); + hudPane.AddHud(infoHud); + + settingsPane.AddHud(new OptionsTab("Options", 370, 500, hue, rainbow, ah, effectSpeed)); int xOffset = 335; for (Category category : Module.Category.values()) { - ClickGuiTab tab = new ClickGuiTab(category.name(), xOffset, 1); + ClickGuiTab tab = new ClickGuiTab(category.name(), xOffset, 75, true); for (Module module : Aoba.getInstance().moduleManager.modules) { if (module.getCategory() == category) { ModuleComponent button = new ModuleComponent(module.getName(), tab, module); tab.addChild(button); } } - tabs.put(category.name(), tab); + modulesPane.AddHud(tab); xOffset += tab.getWidth() + 10; } - tabs.put(infoTab.getTitle(), infoTab); - tabs.put(optionsTab.getTitle(), optionsTab); - tabs.put(radarTab.getTitle(), radarTab); - tabs.put(authCrackerTab.getTitle(), authCrackerTab); + + clickGuiNavBar.addPane(modulesPane); + clickGuiNavBar.addPane(toolsPane); + clickGuiNavBar.addPane(hudPane); + clickGuiNavBar.addPane(settingsPane); } - + + /** + * Getter for the current color used by the GUI for text rendering. + * @return Current Color + */ public Color getColor() { return this.currentColor; } + public Color getOriginalColor() { return this.color; @@ -99,13 +130,38 @@ public void update() { boolean mouseClicked = mc.mouse.wasLeftButtonClicked(); if(!Aoba.getInstance().isGhosted()){ - for (ClickGuiTab tab : tabs.values()) { - if (clickGuiOpen || tab.getPinned()) { - tab.preupdate(); - tab.update(mouseX, mouseY, mouseClicked); - tab.postupdate(); + + mouseX = (int) Math.ceil(mc.mouse.getX()); + mouseY = (int) Math.ceil(mc.mouse.getY()); + + /** + * Moves the selected Tab to where the user moves their mouse. + */ + if (this.clickGuiOpen) { + clickGuiNavBar.update(mouseX, mouseY, mouseClicked); + + int dx = (int) Math.ceil(mouseX); + int dy = (int) Math.ceil(mouseY); + if (!mouseClicked) + currentGrabbed = null; + else if (currentGrabbed != null) { + int newX = Math.max(0, currentGrabbed.getX() - (lastMouseX - dx)); + int newY = Math.max(0, currentGrabbed.getY() - (lastMouseY - dy)); + + currentGrabbed.setX(newX); + currentGrabbed.setY(newY); } + this.lastMouseX = dx; + this.lastMouseY = dy; + } + + /** + * Updates each of the Tab GUIs that are currently on the screen. + */ + for(AbstractHud hud : activeHuds) { + hud.update(lastMouseX, lastMouseY, mouseClicked); } + if (this.clickGuiButton.isPressed() && !wasTildaPressed) { wasTildaPressed = true; @@ -120,6 +176,11 @@ public void update() { this.toggleMouse(); } } + + /** + * Updates the Color. + * TODO: Remove this and move to event-based. + */ if(this.rainbow.getValue()) { rainbowColor.update(this.effectSpeed.getValueFloat()); this.currentColor = rainbowColor.getColor(); @@ -130,57 +191,49 @@ public void update() { } public void draw(DrawContext drawContext, float tickDelta) { - if (!Aoba.getInstance().isGhosted()) { - boolean mouseClicked = mc.mouse.wasLeftButtonClicked(); - mouseX = (int) Math.ceil(mc.mouse.getX()) ; - mouseY = (int) Math.ceil(mc.mouse.getY()) ; - hud.update(mouseX, mouseY, mouseClicked); - if (this.clickGuiOpen) { - int dx = (int) Math.ceil(mouseX); - int dy = (int) Math.ceil(mouseY); - if (!mc.mouse.wasLeftButtonClicked()) - currentGrabbed = null; - if (currentGrabbed != null) - currentGrabbed.moveWindow((lastMouseX - dx), (lastMouseY - dy)); - this.lastMouseX = dx; - this.lastMouseY = dy; - } - - } - GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - + MatrixStack matrixStack = drawContext.getMatrices(); matrixStack.push(); matrixStack.scale(1.0f/mc.options.getGuiScale().getValue(), 1.0f/mc.options.getGuiScale().getValue(), 1.0f); - + Window window = mc.getWindow(); + /** + * Render ClickGUI and Sidebar + */ if (this.clickGuiOpen) { renderUtils.drawBox(matrixStack, 0, 0, window.getWidth(), window.getHeight(), 0.1f, 0.1f, 0.1f, 0.4f); - } - this.hud.draw(drawContext, tickDelta, this.currentColor); - for (ClickGuiTab tab : tabs.values()) { - if (clickGuiOpen || tab.getPinned()) { - tab.draw(drawContext, tickDelta, this.currentColor); + clickGuiNavBar.draw(drawContext, tickDelta, this.currentColor); + }else { + for(AbstractHud hud : activeHuds) { + hud.draw(drawContext, tickDelta, this.currentColor); } } + + matrixStack.pop(); GL11.glEnable(GL11.GL_CULL_FACE); } + /** + * Gets whether or not the Click GUI is currently open. + * @return State of the Click GUI. + */ public boolean isClickGuiOpen() { return this.clickGuiOpen; } - - // TODO Toggle Mouse - public void toggleMouse() { - if(this.mc.mouse.isCursorLocked()) { - this.mc.mouse.unlockCursor(); - }else { - this.mc.mouse.lockCursor(); - } - } + + /** + * Locks and unlocks the Mouse. + */ + public void toggleMouse() { + if(this.mc.mouse.isCursorLocked()) { + this.mc.mouse.unlockCursor(); + }else { + this.mc.mouse.lockCursor(); + } + } } diff --git a/src/main/java/net/aoba/gui/IMoveable.java b/src/main/java/net/aoba/gui/IMoveable.java new file mode 100644 index 0000000..0ea9499 --- /dev/null +++ b/src/main/java/net/aoba/gui/IMoveable.java @@ -0,0 +1,12 @@ +package net.aoba.gui; + +public interface IMoveable { + public int getX(); + public int getY(); + public int getHeight(); + public int getWidth(); + public void setX(int x); + public void setY(int y); + public void setWidth(int width); + public void setHeight(int height); +} diff --git a/src/main/java/net/aoba/gui/NavigationBar.java b/src/main/java/net/aoba/gui/NavigationBar.java new file mode 100644 index 0000000..62cfdca --- /dev/null +++ b/src/main/java/net/aoba/gui/NavigationBar.java @@ -0,0 +1,80 @@ +package net.aoba.gui; + +import java.util.ArrayList; +import java.util.List; +import net.aoba.Aoba; +import net.aoba.misc.RenderUtils; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.util.Window; +import net.minecraft.client.util.math.MatrixStack; + +public class NavigationBar { + MinecraftClient mc = MinecraftClient.getInstance(); + + private List options; + + private int selectedIndex; + private RenderUtils renderUtils; + + public NavigationBar() { + options = new ArrayList(); + renderUtils = new RenderUtils(); + } + + public void addPane(NavigationPane pane) { + options.add(pane); + } + + public int getSelectedIndex() { + return this.selectedIndex; + } + + public void update(double mouseX, double mouseY, boolean mouseClicked) { + + Window window = mc.getWindow(); + + int width = 100 * options.size(); + int centerX = (window.getWidth() / 2); + + int x = centerX - (width / 2); + if (Aoba.getInstance().hudManager.isClickGuiOpen()) { + if (mouseX >= (x) && mouseX <= (x + width)) { + if (mouseY >= (25) && mouseY <= (50)) { + if (mouseClicked) { + int mouseXInt = (int) mouseX; + int selection = (mouseXInt - x) / 100; + this.selectedIndex = selection; + } + } + } + } + + if(options.size() > 0) { + options.get(selectedIndex).update(mouseX, mouseY, mouseClicked); + } + } + + public void draw(DrawContext drawContext, float partialTicks, Color color) { + Window window = mc.getWindow(); + + int centerX = (window.getWidth() / 2); + + MatrixStack matrixStack = drawContext.getMatrices(); + + int width = 100 * options.size(); + renderUtils.drawRoundedBox(matrixStack, centerX - (width / 2), 25, width, 25, 6, new Color(30,30,30), 0.4f); + renderUtils.drawRoundedOutline(matrixStack, centerX - (width / 2), 25, width, 25, 6, new Color(0,0,0), 0.8f); + + renderUtils.drawRoundedBox(drawContext.getMatrices(), centerX - (width / 2) + (100 * this.selectedIndex), 25, 100, 25, 5, new Color(150, 150, 150), 0.4f); + + for(int i = 0; i < options.size(); i++) { + NavigationPane pane = options.get(i); + if(i == selectedIndex) { + pane.render(drawContext, partialTicks, color); + } + renderUtils.drawString(drawContext, pane.title, centerX - (width / 2) + 50 + (100 * i) - mc.textRenderer.getWidth(pane.title), 30, color); + } + + } +} \ No newline at end of file diff --git a/src/main/java/net/aoba/gui/NavigationPane.java b/src/main/java/net/aoba/gui/NavigationPane.java new file mode 100644 index 0000000..e1a31db --- /dev/null +++ b/src/main/java/net/aoba/gui/NavigationPane.java @@ -0,0 +1,32 @@ +package net.aoba.gui; + +import java.util.ArrayList; +import java.util.List; + +import net.aoba.gui.hud.AbstractHud; +import net.minecraft.client.gui.DrawContext; + +public class NavigationPane { + protected String title; + protected List tabs = new ArrayList(); + + public NavigationPane(String title) { + this.title = title; + } + + public void AddHud(AbstractHud hud) { + tabs.add(hud); + } + + public void update(double mouseX, double mouseY, boolean mouseClicked) { + for(AbstractHud tab : tabs) { + tab.update(mouseX, mouseY, mouseClicked); + } + } + + public void render(DrawContext drawContext, float partialTicks, Color color) { + for(AbstractHud tab : tabs) { + tab.draw(drawContext, partialTicks, color); + } + } +} diff --git a/src/main/java/net/aoba/gui/tabs/Tab.java b/src/main/java/net/aoba/gui/hud/AbstractHud.java similarity index 55% rename from src/main/java/net/aoba/gui/tabs/Tab.java rename to src/main/java/net/aoba/gui/hud/AbstractHud.java index 694740f..819a892 100644 --- a/src/main/java/net/aoba/gui/tabs/Tab.java +++ b/src/main/java/net/aoba/gui/hud/AbstractHud.java @@ -1,25 +1,27 @@ -package net.aoba.gui.tabs; +package net.aoba.gui.hud; +import net.aoba.Aoba; import net.aoba.gui.Color; +import net.aoba.gui.HudManager; +import net.aoba.gui.IMoveable; import net.aoba.misc.RenderUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; -public abstract class Tab { +public abstract class AbstractHud implements IMoveable { protected int x; protected int y; protected int width; protected int height; + protected RenderUtils renderUtils = new RenderUtils(); protected MinecraftClient mc = MinecraftClient.getInstance(); - public abstract void update(double mouseX, double mouseY, boolean mouseClicked) ; - - public abstract void draw(DrawContext drawContext, float partialTicks, Color color); - - public void moveWindow(int x, int y) { - this.x = (int) Math.max(width, (this.x - x)); - this.y = (int) Math.max(width,(this.y - y)); + public AbstractHud(int x, int y, int width, int height) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; } public int getX() { @@ -53,5 +55,19 @@ public void setWidth(int width) { public void setHeight(int height) { this.height = height; } - + public void update(double mouseX, double mouseY, boolean mouseClicked) { + if (Aoba.getInstance().hudManager.isClickGuiOpen()) { + if (HudManager.currentGrabbed == null) { + if (mouseX >= (x) && mouseX <= (x + width)) { + if (mouseY >= (y) && mouseY <= (y + height)) { + if (mouseClicked) { + HudManager.currentGrabbed = this; + } + } + } + } + } + } + + public abstract void draw(DrawContext drawContext, float partialTicks, Color color); } diff --git a/src/main/java/net/aoba/gui/ArmorHUD.java b/src/main/java/net/aoba/gui/hud/ArmorHud.java similarity index 70% rename from src/main/java/net/aoba/gui/ArmorHUD.java rename to src/main/java/net/aoba/gui/hud/ArmorHud.java index b451f97..be712fb 100644 --- a/src/main/java/net/aoba/gui/ArmorHUD.java +++ b/src/main/java/net/aoba/gui/hud/ArmorHud.java @@ -20,49 +20,32 @@ * A class to represent a Tab containing Armor Information */ -package net.aoba.gui; +package net.aoba.gui.hud; -import net.aoba.Aoba; -import net.aoba.gui.tabs.Tab; +import net.aoba.gui.Color; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.collection.DefaultedList; -public class ArmorHUD extends Tab{ +public class ArmorHud extends AbstractHud{ private ItemRenderer itemRenderer; - public ArmorHUD() { + public ArmorHud(int x, int y, int width, int height) { + super(x,y,width,height); itemRenderer = mc.getItemRenderer(); this.x = 300; this.y = 300; this.width = 64; this.height = 256; } - - @Override - public void update(double mouseX, double mouseY, boolean mouseClicked) { - if (Aoba.getInstance().hudManager.isClickGuiOpen()) { - if (HudManager.currentGrabbed == null) { - if (mouseX >= (x) && mouseX <= (x + width)) { - if (mouseY >= (y) && mouseY <= (y + height)) { - if (mouseClicked) { - HudManager.currentGrabbed = this; - } - } - } - } - } - } @Override public void draw(DrawContext drawContext, float partialTicks, Color color) { DefaultedList armors = mc.player.getInventory().armor; int yOff = 16; - System.out.println(armors.get(0).getName().getString()); for(ItemStack armor : armors) { if(armor.getItem() == Items.AIR) continue; drawContext.drawItem(armor, this.x, this.y + this.height - yOff); diff --git a/src/main/java/net/aoba/gui/hud/InfoHud.java b/src/main/java/net/aoba/gui/hud/InfoHud.java new file mode 100644 index 0000000..52833f2 --- /dev/null +++ b/src/main/java/net/aoba/gui/hud/InfoHud.java @@ -0,0 +1,67 @@ +package net.aoba.gui.hud; + +import net.aoba.gui.Color; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.util.math.MatrixStack; + +public class InfoHud extends AbstractHud { + + String positionText = ""; + String timeText = ""; + String fpsText = ""; + + // + public InfoHud(int x, int y) { + super(x, y, 190, 60); + } + + @Override + public void update(double mouseX, double mouseY, boolean mouseClicked) { + super.update(mouseX, mouseY, mouseClicked); + + MinecraftClient mc = MinecraftClient.getInstance(); + + int time = ((int)mc.world.getTime() + 6000)% 24000; + String suffix = time >= 12000 ? "PM" : "AM"; + String timeString = (time / 10) % 1200 + ""; + for (int n = timeString.length(); n < 4; ++n) { + timeString = "0" + timeString; + } + final String[] strsplit = timeString.split(""); + String hours = strsplit[0] + strsplit[1]; + if(hours.equalsIgnoreCase("00")) { + hours = "12"; + } + final int minutes = (int)Math.floor(Double.parseDouble(strsplit[2] + strsplit[3]) / 100.0 * 60.0); + String sm = minutes + ""; + if (minutes < 10) { + sm = "0" + minutes; + } + timeString = hours + ":" + sm.charAt(0) + sm.charAt(1) + suffix; + positionText = "XYZ: " + (int)mc.player.getBlockX() + ", " + (int)mc.player.getBlockY() + ", " + (int)mc.player.getBlockZ(); + timeText = "Time: " + timeString; + fpsText = "FPS: " + mc.fpsDebugString.split(" ", 2)[0] + " Day: " + (int) (mc.world.getTime() / 24000); + + int newWidth = (int)(mc.textRenderer.getWidth(positionText) * 2) + 20; + if(this.getWidth()!= newWidth) { + if(newWidth >= 190) { + this.setWidth(newWidth); + }else { + this.setWidth(190); + } + } + } + + @Override + public void draw(DrawContext drawContext, float partialTicks, Color color) { + MatrixStack matrixStack = drawContext.getMatrices(); + // Draws background depending on components width and height + renderUtils.drawRoundedBox(matrixStack, x, y, width, height, 6, new Color(30,30,30), 0.4f); + renderUtils.drawRoundedOutline(matrixStack, x, y, width, height, 6, new Color(0,0,0), 0.8f); + + renderUtils.drawString(drawContext, positionText, x + 5, y + 4, color); + renderUtils.drawString(drawContext, timeText, x + 5, y + 24, color); + renderUtils.drawString(drawContext, fpsText, x + 5, y + 44, color); + } +} diff --git a/src/main/java/net/aoba/gui/IngameGUI.java b/src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java similarity index 90% rename from src/main/java/net/aoba/gui/IngameGUI.java rename to src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java index 0e60dfe..661eba1 100644 --- a/src/main/java/net/aoba/gui/IngameGUI.java +++ b/src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java @@ -1,11 +1,11 @@ -package net.aoba.gui; +package net.aoba.gui.hud; import java.util.ArrayList; import org.lwjgl.glfw.GLFW; import net.aoba.settings.Settings; import net.aoba.Aoba; import net.aoba.AobaClient; -import net.aoba.gui.tabs.Tab; +import net.aoba.gui.Color; import net.aoba.module.Module; import net.aoba.module.Module.Category; import net.minecraft.client.MinecraftClient; @@ -14,7 +14,7 @@ import net.minecraft.client.util.Window; import net.minecraft.client.util.math.MatrixStack; -public class IngameGUI extends Tab { +public class ModuleSelectorHud extends AbstractHud { private KeyBinding keybindUp; private KeyBinding keybindDown; private KeyBinding keybindLeft; @@ -29,35 +29,21 @@ public class IngameGUI extends Tab { Category[] categories; ArrayList modules = new ArrayList(); - public IngameGUI() { + public ModuleSelectorHud() { + super(Settings.getSettingInt("x"), Settings.getSettingInt("y"), 150, 30); this.keybindUp = new KeyBinding("key.tabup", GLFW.GLFW_KEY_UP, "key.categories.aoba"); this.keybindDown = new KeyBinding("key.tabdown", GLFW.GLFW_KEY_DOWN, "key.categories.aoba"); this.keybindLeft = new KeyBinding("key.tableft", GLFW.GLFW_KEY_LEFT, "key.categories.aoba"); this.keybindRight = new KeyBinding("key.tabright", GLFW.GLFW_KEY_RIGHT, "key.categories.aoba"); categories = Module.Category.values(); - this.x = Settings.getSettingInt("x"); - this.y = Settings.getSettingInt("y"); - this.width = 150; - this.height = 30; this.aoba = Aoba.getInstance(); } @Override public void update(double mouseX, double mouseY, boolean mouseClicked) { - { - // If the click GUI is open, and the - if (aoba.hudManager.isClickGuiOpen()) { - if (HudManager.currentGrabbed == null) { - if (mouseX >= (x) && mouseX <= (x + width)) { - if (mouseY >= (y) && mouseY <= (y + height)) { - if (mouseClicked) { - HudManager.currentGrabbed = this; - } - } - } - } - } + + super.update(mouseX, mouseY, mouseClicked); if (!aoba.isGhosted()) { if (this.keybindUp.isPressed()) { @@ -105,7 +91,7 @@ public void update(double mouseX, double mouseY, boolean mouseClicked) { this.keybindLeft.setPressed(false); } } - } + } @Override diff --git a/src/main/java/net/aoba/gui/hud/RadarHud.java b/src/main/java/net/aoba/gui/hud/RadarHud.java new file mode 100644 index 0000000..9c2dea3 --- /dev/null +++ b/src/main/java/net/aoba/gui/hud/RadarHud.java @@ -0,0 +1,83 @@ +package net.aoba.gui.hud; + +import net.aoba.Aoba; +import net.aoba.gui.Color; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.network.AbstractClientPlayerEntity; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.mob.Monster; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.player.PlayerEntity; + +public class RadarHud extends AbstractHud { + + float distance = 50; + public RadarHud( int x, int y, int width, int height) { + super(x, y, width, height); + } + + @Override + public void draw(DrawContext drawContext, float partialTicks, Color color) { + MatrixStack matrixStack = drawContext.getMatrices(); + // Draws background depending on components width and height + renderUtils.drawRoundedBox(matrixStack, x, y, width, height, 6, new Color(30,30,30), 0.4f); + renderUtils.drawRoundedOutline(matrixStack, x, y, width, height, 6, new Color(0,0,0), 0.8f); + + // Draw the 'Radar' + renderUtils.drawBox(matrixStack, x , y + (height / 2), width - 1, 1, new Color(128,128,128), 1.0f); + renderUtils.drawBox(matrixStack, x + (width / 2), y, 1, height, new Color(128,128,128), 1.0f); + renderUtils.drawBox(matrixStack, x + (width / 2) - 2, y + (height / 2) - 2, 5, 5, Aoba.getInstance().hudManager.getColor(), 1.0f); + + float sin_theta = (float) Math.sin(Math.toRadians(-mc.player.getRotationClient().y)); + float cos_theta = (float) Math.cos(Math.toRadians(-mc.player.getRotationClient().y)); + + int center_x = x + (width / 2); + int center_y = y - 2 + (height / 2); + + // Render Entities + for (Entity entity : mc.world.getEntities()) { + Color c ; + if (entity instanceof LivingEntity && !(entity instanceof PlayerEntity)) { + if (entity instanceof AnimalEntity) { + c = new Color(0, 255, 0); + } else if (entity instanceof Monster) { + c = new Color(255, 0, 0); + } else { + c = new Color(0, 0, 255); + } + }else { + continue; + } + + float ratio_x = (float)((entity.getX() - mc.player.getX())) / (distance); + float ratio_y = (float)((entity.getZ() - mc.player.getZ())) / (distance); + + float fake_x = (x + (width / 2) - (width * ratio_x / 2)); + float fake_y = (y - 2 + (height / 2) - (width * ratio_y / 2)); + + float radius_x = (float)((cos_theta * (fake_x - center_x)) - (sin_theta * (fake_y - center_y))) + center_x; + float radius_y = (float)((sin_theta * (fake_x - center_x)) + (cos_theta * (fake_y - center_y))) + center_y; + + renderUtils.drawBox(matrixStack, (int)(Math.min(x + width - 5, Math.max(x, radius_x))) , (int)(Math.min(y - 5 + height, Math.max(y, radius_y))), 3, 3, c, 1.0f); + } + + // Render Players + for (AbstractClientPlayerEntity entity : mc.world.getPlayers()) { + if(entity != mc.player) { + float ratio_x = (float)((entity.getX() - mc.player.getX())) / (distance); + float ratio_y = (float)((entity.getZ() - mc.player.getZ())) / (distance); + + float fake_x = (x + (width / 2) - (width * ratio_x / 2)); + float fake_y = (y + 28 + (height / 2) - (width * ratio_y / 2)); + + float radius_x = (float)((cos_theta * (fake_x - center_x)) - (sin_theta * (fake_y - center_y))) + center_x; + float radius_y = (float)((sin_theta * (fake_x - center_x)) + (cos_theta * (fake_y - center_y))) + center_y; + + renderUtils.drawBox(matrixStack, (int)(Math.min(x + width - 5, Math.max(x, radius_x))), (int)(Math.min(y + 25 + height, Math.max(y, radius_y))), 3, 3, new Color(255, 255, 255), 1.0f); + renderUtils.drawStringWithScale(drawContext, entity.getName().getString(), (int)(Math.min(x + width - 5, Math.max(x, radius_x))) - (mc.textRenderer.getWidth(entity.getName()) * 0.5f), (int)(Math.min(y + 25 + height, Math.max(y, radius_y))) - 10, color, 1.0f); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/net/aoba/gui/screens/AddAltScreen.java b/src/main/java/net/aoba/gui/screens/AddAltScreen.java index f61685e..bfc1c1c 100644 --- a/src/main/java/net/aoba/gui/screens/AddAltScreen.java +++ b/src/main/java/net/aoba/gui/screens/AddAltScreen.java @@ -7,7 +7,7 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.CheckboxWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; + import net.minecraft.text.OrderedText; import net.minecraft.text.Style; import net.minecraft.text.Text; diff --git a/src/main/java/net/aoba/gui/screens/AltScreen.java b/src/main/java/net/aoba/gui/screens/AltScreen.java index 7e7d249..d83edbe 100644 --- a/src/main/java/net/aoba/gui/screens/AltScreen.java +++ b/src/main/java/net/aoba/gui/screens/AltScreen.java @@ -7,7 +7,6 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; public class AltScreen extends Screen { diff --git a/src/main/java/net/aoba/gui/screens/DirectLoginAltScreen.java b/src/main/java/net/aoba/gui/screens/DirectLoginAltScreen.java index 9421dac..c770af3 100644 --- a/src/main/java/net/aoba/gui/screens/DirectLoginAltScreen.java +++ b/src/main/java/net/aoba/gui/screens/DirectLoginAltScreen.java @@ -7,7 +7,6 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.CheckboxWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.OrderedText; import net.minecraft.text.Style; import net.minecraft.text.Text; diff --git a/src/main/java/net/aoba/gui/screens/EditAltScreen.java b/src/main/java/net/aoba/gui/screens/EditAltScreen.java index c50156c..2f5e128 100644 --- a/src/main/java/net/aoba/gui/screens/EditAltScreen.java +++ b/src/main/java/net/aoba/gui/screens/EditAltScreen.java @@ -7,7 +7,6 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.CheckboxWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.OrderedText; import net.minecraft.text.Style; import net.minecraft.text.Text; diff --git a/src/main/java/net/aoba/gui/screens/MCLeaksLoginScreen.java b/src/main/java/net/aoba/gui/screens/MCLeaksLoginScreen.java index 2b3154a..95f556e 100644 --- a/src/main/java/net/aoba/gui/screens/MCLeaksLoginScreen.java +++ b/src/main/java/net/aoba/gui/screens/MCLeaksLoginScreen.java @@ -9,7 +9,6 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; public class MCLeaksLoginScreen extends Screen{ diff --git a/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java b/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java index 2162d9e..af77bb2 100644 --- a/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java +++ b/src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java @@ -4,9 +4,10 @@ import java.net.URL; import java.util.Scanner; import java.util.concurrent.TimeUnit; -import net.aoba.gui.elements.ButtonComponent; -import net.aoba.gui.elements.SliderComponent; -import net.aoba.gui.elements.StringComponent; + +import net.aoba.gui.tabs.components.ButtonComponent; +import net.aoba.gui.tabs.components.SliderComponent; +import net.aoba.gui.tabs.components.StringComponent; import net.aoba.settings.SliderSetting; import net.minecraft.client.MinecraftClient; diff --git a/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java b/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java index 01e5dec..0ad3866 100644 --- a/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java +++ b/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java @@ -26,14 +26,17 @@ import net.aoba.Aoba; import net.aoba.gui.Color; import net.aoba.gui.HudManager; -import net.aoba.gui.elements.Component; +import net.aoba.gui.hud.AbstractHud; +import net.aoba.gui.tabs.components.Component; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.math.MatrixStack; -public class ClickGuiTab extends Tab { +public class ClickGuiTab extends AbstractHud{ protected String title; + + protected boolean pinnable = false; protected boolean isPinned = false; protected boolean pinWasClicked = false; protected boolean drawBorder = true; @@ -42,12 +45,22 @@ public class ClickGuiTab extends Tab { protected ArrayList children = new ArrayList<>(); public ClickGuiTab(String title, int x, int y) { + super(x, y, 180, 0); this.title = title; this.x = x; this.y = y; this.width = 180; this.mc = MinecraftClient.getInstance(); } + + public ClickGuiTab(String title, int x, int y, boolean pinnable) { + super(x, y, 180, 0); + this.x = x; + this.y = y; + this.width = 180; + this.mc = MinecraftClient.getInstance(); + this.pinnable = pinnable; + } public final String getTitle() { return title; @@ -134,9 +147,11 @@ public void update(double mouseX, double mouseY, boolean mouseClicked) { if (mouseY >= (y) && mouseY <= (y + 28)) { if (mouseClicked) { boolean isInsidePinButton = false; - if (mouseX >= (x + width - 24) && mouseX <= (x + width - 2)) { - if (mouseY >= (y + 4) && mouseY <= (y + 20)) { - isInsidePinButton = true; + if(this.pinnable) { + if (mouseX >= (x + width - 24) && mouseX <= (x + width - 2)) { + if (mouseY >= (y + 4) && mouseY <= (y + 20)) { + isInsidePinButton = true; + } } } if (isInsidePinButton) { @@ -175,20 +190,19 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { MatrixStack matrixStack = drawContext.getMatrices(); if(drawBorder) { // Draws background depending on components width and height - //renderUtils.drawRoundedBox(matrixStack, x, y, width, 29, 50, new Color(30,30,30), 0.4f); - //renderUtils.drawRoundedBox(matrixStack, x, y + 29, width, height, 50, new Color(30,30,30), 0.4f); - - renderUtils.drawRoundedBox(matrixStack, x, y, width, height + 30, 12, new Color(30,30,30), 0.4f); - renderUtils.drawRoundedOutline(matrixStack, x, y, width, height + 30, 12, new Color(0,0,0), 0.8f); + renderUtils.drawRoundedBox(matrixStack, x, y, width, height + 30, 6, new Color(30,30,30), 0.4f); + renderUtils.drawRoundedOutline(matrixStack, x, y, width, height + 30, 6, new Color(0,0,0), 0.8f); renderUtils.drawString(drawContext, this.title, x + 8, y + 8, Aoba.getInstance().hudManager.getColor()); renderUtils.drawLine(matrixStack, x, y + 30, x + width, y + 30, new Color(0,0,0), 0.4f); - if (this.isPinned) { - renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(154,0,0), 0.8f); - renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.8f); - } else { - renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(128,128,128), 0.2f); - renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.2f); + if(this.pinnable) { + if (this.isPinned) { + renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(154,0,0), 0.8f); + renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.8f); + } else { + renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(128,128,128), 0.2f); + renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.2f); + } } } int i = 30; diff --git a/src/main/java/net/aoba/gui/tabs/InfoTab.java b/src/main/java/net/aoba/gui/tabs/InfoTab.java deleted file mode 100644 index 61ad189..0000000 --- a/src/main/java/net/aoba/gui/tabs/InfoTab.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.aoba.gui.tabs; - -import net.aoba.gui.elements.StringComponent; -import net.minecraft.client.MinecraftClient; - -public class InfoTab extends ClickGuiTab { - - private StringComponent positionComponent = new StringComponent("X: Y: Z:", this); - private StringComponent timeComponent = new StringComponent("Time:", this); - private StringComponent fpsDayComponent = new StringComponent("FPS: Day:", this); - - // - public InfoTab(String title, int x, int y) { - super(title, x, y); - this.setWidth(190); - this.addChild(positionComponent); - this.addChild(timeComponent); - this.addChild(fpsDayComponent); - } - - @Override - public void preupdate() { - MinecraftClient mc = MinecraftClient.getInstance(); - - int time = ((int)mc.world.getTime() + 6000)% 24000; - String suffix = time >= 12000 ? "PM" : "AM"; - String timeString = (time / 10) % 1200 + ""; - for (int n = timeString.length(); n < 4; ++n) { - timeString = "0" + timeString; - } - final String[] strsplit = timeString.split(""); - String hours = strsplit[0] + strsplit[1]; - if(hours.equalsIgnoreCase("00")) { - hours = "12"; - } - final int minutes = (int)Math.floor(Double.parseDouble(strsplit[2] + strsplit[3]) / 100.0 * 60.0); - String sm = minutes + ""; - if (minutes < 10) { - sm = "0" + minutes; - } - timeString = hours + ":" + sm.charAt(0) + sm.charAt(1) + suffix; - positionComponent.setText("XYZ: " + (int)mc.player.getBlockX() + ", " + (int)mc.player.getBlockY() + ", " + (int)mc.player.getBlockZ()); - timeComponent.setText("Time: " + timeString); - fpsDayComponent.setText("FPS: " + mc.fpsDebugString.split(" ", 2)[0] + " Day: " + (int) (mc.world.getTime() / 24000)); - - int newWidth = (int)(mc.textRenderer.getWidth(positionComponent.getText()) * 2) + 20; - if(this.getWidth()!= newWidth) { - if(newWidth >= 190) { - this.setWidth(newWidth); - }else { - this.setWidth(190); - } - } - } -} diff --git a/src/main/java/net/aoba/gui/tabs/OptionsTab.java b/src/main/java/net/aoba/gui/tabs/OptionsTab.java index aecf39c..1ae6560 100644 --- a/src/main/java/net/aoba/gui/tabs/OptionsTab.java +++ b/src/main/java/net/aoba/gui/tabs/OptionsTab.java @@ -1,8 +1,8 @@ package net.aoba.gui.tabs; -import net.aoba.gui.elements.CheckboxComponent; -import net.aoba.gui.elements.SliderComponent; -import net.aoba.gui.elements.StringComponent; +import net.aoba.gui.tabs.components.CheckboxComponent; +import net.aoba.gui.tabs.components.SliderComponent; +import net.aoba.gui.tabs.components.StringComponent; import net.aoba.settings.BooleanSetting; import net.aoba.settings.SliderSetting; diff --git a/src/main/java/net/aoba/gui/tabs/RadarTab.java b/src/main/java/net/aoba/gui/tabs/RadarTab.java deleted file mode 100644 index 106517b..0000000 --- a/src/main/java/net/aoba/gui/tabs/RadarTab.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.aoba.gui.tabs; - -import net.aoba.Aoba; -import net.aoba.gui.Color; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.mob.Monster; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.PlayerEntity; - -public class RadarTab extends ClickGuiTab { - - float distance = 50; - public RadarTab(String title, int x, int y) { - super(title, x, y); - this.setWidth(190); - this.setHeight(190); - this.inheritHeightFromChildren = false; - } - - - @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { - MatrixStack matrixStack = drawContext.getMatrices(); - if(drawBorder) { - // Draws background depending on components width and height - renderUtils.drawRoundedBox(matrixStack, x, y, width, height + 30, 12, new Color(30,30,30), 0.4f); - renderUtils.drawRoundedOutline(matrixStack, x, y, width, height + 30, 12, new Color(0,0,0), 0.8f); - renderUtils.drawString(drawContext, this.title, x + 8, y + 8, Aoba.getInstance().hudManager.getColor()); - renderUtils.drawLine(matrixStack, x, y + 30, x + width, y + 30, new Color(0,0,0), 0.4f); - - - // Draw the 'Radar' - renderUtils.drawBox(matrixStack, x , y + 30 + (height / 2), width - 1, 1, new Color(128,128,128), 1.0f); - renderUtils.drawBox(matrixStack, x + (width / 2), y + 30, 1, height, new Color(128,128,128), 1.0f); - renderUtils.drawBox(matrixStack, x + (width / 2) - 2, y + 30 + (height / 2) - 2, 5, 5, Aoba.getInstance().hudManager.getColor(), 1.0f); - - float sin_theta = (float) Math.sin(Math.toRadians(-mc.player.getRotationClient().y)); - float cos_theta = (float) Math.cos(Math.toRadians(-mc.player.getRotationClient().y)); - - int center_x = x + (width / 2); - int center_y = y + 28 + (height / 2); - - // Render Entities - for (Entity entity : mc.world.getEntities()) { - Color c ; - if (entity instanceof LivingEntity && !(entity instanceof PlayerEntity)) { - if (entity instanceof AnimalEntity) { - c = new Color(0, 255, 0); - } else if (entity instanceof Monster) { - c = new Color(255, 0, 0); - } else { - c = new Color(0, 0, 255); - } - }else { - continue; - } - - float ratio_x = (float)((entity.getX() - mc.player.getX())) / (distance); - float ratio_y = (float)((entity.getZ() - mc.player.getZ())) / (distance); - - float fake_x = (x + (width / 2) - (width * ratio_x / 2)); - float fake_y = (y + 28 + (height / 2) - (width * ratio_y / 2)); - - float radius_x = (float)((cos_theta * (fake_x - center_x)) - (sin_theta * (fake_y - center_y))) + center_x; - float radius_y = (float)((sin_theta * (fake_x - center_x)) + (cos_theta * (fake_y - center_y))) + center_y; - - renderUtils.drawBox(matrixStack, (int)(Math.min(x + width - 5, Math.max(x, radius_x))) , (int)(Math.min(y + 25 + height, Math.max(y + 30, radius_y))), 3, 3, c, 1.0f); - } - - // Render Players - for (AbstractClientPlayerEntity entity : mc.world.getPlayers()) { - if(entity != mc.player) { - float ratio_x = (float)((entity.getX() - mc.player.getX())) / (distance); - float ratio_y = (float)((entity.getZ() - mc.player.getZ())) / (distance); - - float fake_x = (x + (width / 2) - (width * ratio_x / 2)); - float fake_y = (y + 28 + (height / 2) - (width * ratio_y / 2)); - - float radius_x = (float)((cos_theta * (fake_x - center_x)) - (sin_theta * (fake_y - center_y))) + center_x; - float radius_y = (float)((sin_theta * (fake_x - center_x)) + (cos_theta * (fake_y - center_y))) + center_y; - - renderUtils.drawBox(matrixStack, (int)(Math.min(x + width - 5, Math.max(x, radius_x))), (int)(Math.min(y + 25 + height, Math.max(y + 30, radius_y))), 3, 3, new Color(255, 255, 255), 1.0f); - renderUtils.drawStringWithScale(drawContext, entity.getName().getString(), (int)(Math.min(x + width - 5, Math.max(x, radius_x))) - (mc.textRenderer.getWidth(entity.getName()) * 0.5f), (int)(Math.min(y + 25 + height, Math.max(y + 30, radius_y))) - 10, color, 1.0f); - } - } - - if (this.isPinned) { - renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(154,0,0), 0.8f); - renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.8f); - } else { - renderUtils.drawRoundedBox(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(128,128,128), 0.2f); - renderUtils.drawRoundedOutline(matrixStack, x + width - 23, y + 8, 15, 15, 6f, new Color(0,0,0), 0.2f); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/net/aoba/gui/elements/ButtonComponent.java b/src/main/java/net/aoba/gui/tabs/components/ButtonComponent.java similarity index 98% rename from src/main/java/net/aoba/gui/elements/ButtonComponent.java rename to src/main/java/net/aoba/gui/tabs/components/ButtonComponent.java index 670e456..d863784 100644 --- a/src/main/java/net/aoba/gui/elements/ButtonComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/ButtonComponent.java @@ -1,4 +1,4 @@ -package net.aoba.gui.elements; +package net.aoba.gui.tabs.components; import net.aoba.gui.Color; import net.aoba.gui.HudManager; diff --git a/src/main/java/net/aoba/gui/elements/CheckboxComponent.java b/src/main/java/net/aoba/gui/tabs/components/CheckboxComponent.java similarity index 98% rename from src/main/java/net/aoba/gui/elements/CheckboxComponent.java rename to src/main/java/net/aoba/gui/tabs/components/CheckboxComponent.java index dc1c30c..0ca4fe4 100644 --- a/src/main/java/net/aoba/gui/elements/CheckboxComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/CheckboxComponent.java @@ -1,4 +1,4 @@ -package net.aoba.gui.elements; +package net.aoba.gui.tabs.components; import net.aoba.gui.Color; import net.aoba.gui.HudManager; diff --git a/src/main/java/net/aoba/gui/elements/Component.java b/src/main/java/net/aoba/gui/tabs/components/Component.java similarity index 96% rename from src/main/java/net/aoba/gui/elements/Component.java rename to src/main/java/net/aoba/gui/tabs/components/Component.java index 2536002..bf3b892 100644 --- a/src/main/java/net/aoba/gui/elements/Component.java +++ b/src/main/java/net/aoba/gui/tabs/components/Component.java @@ -1,4 +1,4 @@ -package net.aoba.gui.elements; +package net.aoba.gui.tabs.components; import net.aoba.Aoba; import net.aoba.gui.Color; diff --git a/src/main/java/net/aoba/gui/elements/ListComponent.java b/src/main/java/net/aoba/gui/tabs/components/ListComponent.java similarity index 98% rename from src/main/java/net/aoba/gui/elements/ListComponent.java rename to src/main/java/net/aoba/gui/tabs/components/ListComponent.java index e4f7798..7dcbab2 100644 --- a/src/main/java/net/aoba/gui/elements/ListComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/ListComponent.java @@ -1,4 +1,4 @@ -package net.aoba.gui.elements; +package net.aoba.gui.tabs.components; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/net/aoba/gui/elements/ModuleComponent.java b/src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java similarity index 99% rename from src/main/java/net/aoba/gui/elements/ModuleComponent.java rename to src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java index fc42169..524345e 100644 --- a/src/main/java/net/aoba/gui/elements/ModuleComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java @@ -1,4 +1,4 @@ -package net.aoba.gui.elements; +package net.aoba.gui.tabs.components; import java.util.ArrayList; import java.util.List; @@ -51,6 +51,8 @@ public ModuleComponent(String text, ClickGuiTab parent, Module module) { RecalculateExpandedHeight(); } + + public void update(int offset, double mouseX, double mouseY, boolean mouseClicked) { int parentX = parent.getX(); diff --git a/src/main/java/net/aoba/gui/elements/SliderComponent.java b/src/main/java/net/aoba/gui/tabs/components/SliderComponent.java similarity index 98% rename from src/main/java/net/aoba/gui/elements/SliderComponent.java rename to src/main/java/net/aoba/gui/tabs/components/SliderComponent.java index f9e587d..944976a 100644 --- a/src/main/java/net/aoba/gui/elements/SliderComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/SliderComponent.java @@ -1,4 +1,4 @@ -package net.aoba.gui.elements; +package net.aoba.gui.tabs.components; import net.aoba.gui.Color; import net.aoba.gui.HudManager; diff --git a/src/main/java/net/aoba/gui/elements/StringComponent.java b/src/main/java/net/aoba/gui/tabs/components/StringComponent.java similarity index 96% rename from src/main/java/net/aoba/gui/elements/StringComponent.java rename to src/main/java/net/aoba/gui/tabs/components/StringComponent.java index 7c4a966..339400a 100644 --- a/src/main/java/net/aoba/gui/elements/StringComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/StringComponent.java @@ -1,4 +1,4 @@ -package net.aoba.gui.elements; +package net.aoba.gui.tabs.components; import net.aoba.gui.Color; import net.aoba.gui.tabs.ClickGuiTab; diff --git a/src/main/java/net/aoba/misc/RenderUtils.java b/src/main/java/net/aoba/misc/RenderUtils.java index 4f5236a..231aa83 100644 --- a/src/main/java/net/aoba/misc/RenderUtils.java +++ b/src/main/java/net/aoba/misc/RenderUtils.java @@ -32,7 +32,6 @@ import net.minecraft.util.math.Box; import org.joml.Matrix4f; import org.lwjgl.opengl.GL11; - import net.minecraft.util.math.Vec3d; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; @@ -433,7 +432,7 @@ public void drawStringWithScale(DrawContext drawContext, String text, float x, f drawContext.drawText(mc.textRenderer, text, (int)x, (int)y, color.getColorAsInt(), false); matrixStack.pop(); } - + public void drawStringWithScale(DrawContext drawContext, String text, float x, float y, int color, float scale) { MinecraftClient mc = MinecraftClient.getInstance(); MatrixStack matrixStack = drawContext.getMatrices(); diff --git a/src/main/java/net/aoba/module/modules/combat/AutoSoup.java b/src/main/java/net/aoba/module/modules/combat/AutoSoup.java index 9d682fb..734618e 100644 --- a/src/main/java/net/aoba/module/modules/combat/AutoSoup.java +++ b/src/main/java/net/aoba/module/modules/combat/AutoSoup.java @@ -107,7 +107,6 @@ public void sortInventory() { for(int i = 0; i < PlayerInventory.getHotbarSize(); i++) { ItemStack stack = MC.player.getInventory().getStack(i); if(stack == null || stack.getItem() == Items.BOWL) { - System.out.println("New Slot: " + i); int nextSoup = findSoup(); if(nextSoup >= 0) { MC.interactionManager.clickSlot(0, nextSoup, 0, SlotActionType.PICKUP, MC.player); diff --git a/src/main/java/net/aoba/module/modules/combat/CrystalAura.java b/src/main/java/net/aoba/module/modules/combat/CrystalAura.java index 3fbe1ee..962015e 100644 --- a/src/main/java/net/aoba/module/modules/combat/CrystalAura.java +++ b/src/main/java/net/aoba/module/modules/combat/CrystalAura.java @@ -80,7 +80,6 @@ public void onUpdate() { if (block != Blocks.OBSIDIAN && block != Blocks.BEDROCK) continue; - System.out.println(player.getName().getString() + ": " + bs.getBlock().getName().getString()); for (int slot = 0; slot < 9; slot++) { Item item = MC.player.getInventory().getStack(slot).getItem(); if (item == Items.END_CRYSTAL) { diff --git a/src/main/java/net/aoba/settings/Settings.java b/src/main/java/net/aoba/settings/Settings.java index acf27f6..9de648f 100644 --- a/src/main/java/net/aoba/settings/Settings.java +++ b/src/main/java/net/aoba/settings/Settings.java @@ -58,12 +58,8 @@ public void saveSettings() { printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(aobaOptions), StandardCharsets.UTF_8)); // Write HUD information and 'other' settings. - printwriter.println("x:" + aoba.hudManager.hud.getX()); - printwriter.println("y:" + aoba.hudManager.hud.getY()); printwriter.println("color_hue:" + aoba.hudManager.getOriginalColor().hue); printwriter.println("rainbowUI:" + aoba.hudManager.rainbow.getValue()); - printwriter.println("armor_x:" + aoba.hudManager.armorHud.getX()); - printwriter.println("armor_y:" + aoba.hudManager.armorHud.getY()); // Write Module Settings for (Module module : aoba.moduleManager.modules) {