From 39be1bb850ae0171e2d66d4f6a153d7596cf9b4c Mon Sep 17 00:00:00 2001 From: Colton Date: Mon, 1 Apr 2024 18:07:41 -0700 Subject: [PATCH] UI + Settings cleanup. Added some additional mixins. --- .../net/aoba/event/events/FoodLevelEvent.java | 54 ++++++++++++++++++ .../event/listeners/FoodLevelListener.java | 25 +++++++++ src/main/java/net/aoba/gui/AbstractGui.java | 2 +- src/main/java/net/aoba/gui/GuiManager.java | 42 +++++--------- src/main/java/net/aoba/gui/NavigationBar.java | 10 ++-- src/main/java/net/aoba/gui/Page.java | 4 +- .../java/net/aoba/gui/hud/AbstractHud.java | 2 +- src/main/java/net/aoba/gui/hud/ArmorHud.java | 3 +- src/main/java/net/aoba/gui/hud/InfoHud.java | 15 ++--- .../net/aoba/gui/hud/ModuleSelectorHud.java | 20 +++---- src/main/java/net/aoba/gui/hud/RadarHud.java | 10 ++-- .../java/net/aoba/gui/tabs/ClickGuiTab.java | 15 ++--- src/main/java/net/aoba/gui/tabs/HudsTab.java | 19 ++++--- .../net/aoba/gui/tabs/ModuleSettingsTab.java | 10 ++-- .../java/net/aoba/gui/tabs/OptionsTab.java | 11 ++-- .../gui/tabs/components/BlocksComponent.java | 5 +- .../gui/tabs/components/ButtonComponent.java | 2 +- .../tabs/components/CheckboxComponent.java | 5 +- .../tabs/components/ColorPickerComponent.java | 5 +- .../aoba/gui/tabs/components/Component.java | 4 +- .../gui/tabs/components/HudComponent.java | 4 +- .../gui/tabs/components/KeybindComponent.java | 4 +- .../gui/tabs/components/ListComponent.java | 2 +- .../gui/tabs/components/ModuleComponent.java | 9 +-- .../gui/tabs/components/SliderComponent.java | 10 ++-- .../gui/tabs/components/StringComponent.java | 2 +- src/main/java/net/aoba/misc/RenderUtils.java | 16 ------ .../AbstractClientPlayerEntityMixin.java | 17 ++++++ .../java/net/aoba/mixin/ChatScreenMixin.java | 4 +- .../net/aoba/mixin/ClientConnectionMixin.java | 2 + .../aoba/mixin/ClientPlayerEntityMixin.java | 56 ++++++++++--------- src/main/java/net/aoba/mixin/EntityMixin.java | 4 ++ .../net/aoba/mixin/HungerManagerMixin.java | 50 +++++++++++++++++ .../net/aoba/mixin/LivingEntityMixin.java | 16 ++++++ .../net/aoba/mixin/PlayerEntityMixin.java | 16 ++---- .../java/net/aoba/module/ModuleManager.java | 8 ++- .../aoba/module/modules/combat/Nametags.java | 2 +- .../net/aoba/module/modules/combat/Reach.java | 2 +- .../net/aoba/module/modules/misc/AutoEat.java | 21 ++++--- .../aoba/module/modules/misc/FastBreak.java | 2 +- .../net/aoba/module/modules/misc/Timer.java | 2 +- .../net/aoba/module/modules/movement/Fly.java | 2 +- .../aoba/module/modules/movement/Freecam.java | 2 +- .../aoba/module/modules/movement/Jetpack.java | 2 +- .../aoba/module/modules/movement/Step.java | 2 +- .../module/modules/render/Breadcrumbs.java | 2 +- .../aoba/module/modules/render/ChestESP.java | 2 +- .../aoba/module/modules/render/EntityESP.java | 2 +- .../aoba/module/modules/world/AutoFarm.java | 2 +- .../net/aoba/module/modules/world/Nuker.java | 2 +- .../module/modules/world/TileBreaker.java | 2 +- src/main/java/net/aoba/settings/Setting.java | 2 +- .../net/aoba/settings/SettingManager.java | 9 ++- .../net/aoba/settings/types/FloatSetting.java | 24 ++++---- src/main/resources/aoba.mixins.json | 22 +++++--- 55 files changed, 368 insertions(+), 221 deletions(-) create mode 100644 src/main/java/net/aoba/event/events/FoodLevelEvent.java create mode 100644 src/main/java/net/aoba/event/listeners/FoodLevelListener.java create mode 100644 src/main/java/net/aoba/mixin/AbstractClientPlayerEntityMixin.java create mode 100644 src/main/java/net/aoba/mixin/HungerManagerMixin.java create mode 100644 src/main/java/net/aoba/mixin/LivingEntityMixin.java diff --git a/src/main/java/net/aoba/event/events/FoodLevelEvent.java b/src/main/java/net/aoba/event/events/FoodLevelEvent.java new file mode 100644 index 00000000..877b8c23 --- /dev/null +++ b/src/main/java/net/aoba/event/events/FoodLevelEvent.java @@ -0,0 +1,54 @@ +/* +* Aoba Hacked Client +* Copyright (C) 2019-2024 coltonk9043 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +package net.aoba.event.events; + +import java.util.ArrayList; +import java.util.List; + +import net.aoba.event.listeners.AbstractListener; +import net.aoba.event.listeners.FoodLevelListener; +import net.aoba.event.listeners.PlayerHealthListener; +import net.minecraft.entity.damage.DamageSource; + +public class FoodLevelEvent extends AbstractEvent { + private float foodLevel; + + public FoodLevelEvent(float foodLevel) { + this.foodLevel = foodLevel; + } + + public float getFoodLevel() { + return foodLevel; + } + + + @Override + public void Fire(ArrayList listeners) { + for(AbstractListener listener : List.copyOf(listeners)) { + FoodLevelListener foodLevelListener = (FoodLevelListener) listener; + foodLevelListener.OnFoodLevelChanged(this); + } + } + + @SuppressWarnings("unchecked") + @Override + public Class GetListenerClassType() { + return FoodLevelListener.class; + } +} \ No newline at end of file diff --git a/src/main/java/net/aoba/event/listeners/FoodLevelListener.java b/src/main/java/net/aoba/event/listeners/FoodLevelListener.java new file mode 100644 index 00000000..8c586fea --- /dev/null +++ b/src/main/java/net/aoba/event/listeners/FoodLevelListener.java @@ -0,0 +1,25 @@ +/* +* Aoba Hacked Client +* Copyright (C) 2019-2024 coltonk9043 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +package net.aoba.event.listeners; + +import net.aoba.event.events.FoodLevelEvent; + +public interface FoodLevelListener extends AbstractListener { + public abstract void OnFoodLevelChanged(FoodLevelEvent readPacketEvent); +} diff --git a/src/main/java/net/aoba/gui/AbstractGui.java b/src/main/java/net/aoba/gui/AbstractGui.java index 72ae79a5..c4015974 100644 --- a/src/main/java/net/aoba/gui/AbstractGui.java +++ b/src/main/java/net/aoba/gui/AbstractGui.java @@ -164,7 +164,7 @@ public void setAlwaysVisible(boolean state) { public abstract void update(); - public abstract void draw(DrawContext drawContext, float partialTicks, Color color); + public abstract void draw(DrawContext drawContext, float partialTicks); @Override public void OnLeftMouseDown(LeftMouseDownEvent event) { diff --git a/src/main/java/net/aoba/gui/GuiManager.java b/src/main/java/net/aoba/gui/GuiManager.java index 55db8c43..60c66107 100644 --- a/src/main/java/net/aoba/gui/GuiManager.java +++ b/src/main/java/net/aoba/gui/GuiManager.java @@ -71,36 +71,30 @@ public class GuiManager implements LeftMouseDownListener, LeftMouseUpListener, K public Page hudPane = new Page("Hud"); // Global HUD Settings - public ColorSetting color; - public ColorSetting borderColor; - public ColorSetting backgroundColor; + public static ColorSetting foregroundColor; + public static ColorSetting borderColor; + public static ColorSetting backgroundColor; - public FloatSetting effectSpeed = new FloatSetting("color_speed", "Effect Spd", 4, 1, 20, 0.1, null); + public FloatSetting effectSpeed = new FloatSetting("color_speed", "Effect Spd", 4f, 1f, 20f, 0.1f, null); public BooleanSetting rainbow = new BooleanSetting("rainbow_mode", "Rainbow", false, null); public BooleanSetting ah = new BooleanSetting("armorhud_toggle", "ArmorHUD", false, null); - private Color currentColor; - public ModuleSelectorHud moduleSelector; public ArmorHud armorHud; public RadarHud radarHud; public InfoHud infoHud; - - private RainbowColor rainbowColor; public GuiManager() { mc = MinecraftClient.getInstance(); borderColor = new ColorSetting("hud_border_color", "Color of the borders.", new Color(0, 0, 0)); backgroundColor = new ColorSetting("hud_background_color", "Color of the background.", new Color(0, 0, 0, 50)); - color = new ColorSetting("hud_foreground_color", "The color of the HUD", new Color(1.0f, 1.0f, 1.0f)); - currentColor = color.getValue(); - rainbowColor = new RainbowColor(); + foregroundColor = new ColorSetting("hud_foreground_color", "The color of the HUD", new Color(1.0f, 1.0f, 1.0f)); clickGuiNavBar = new NavigationBar(); SettingManager.registerSetting(borderColor, Aoba.getInstance().settingManager.config_category); SettingManager.registerSetting(backgroundColor, Aoba.getInstance().settingManager.config_category); - SettingManager.registerSetting(color, Aoba.getInstance().settingManager.config_category); + SettingManager.registerSetting(foregroundColor, Aoba.getInstance().settingManager.config_category); SettingManager.registerSetting(clickGuiButton, Aoba.getInstance().settingManager.modules_category); Aoba.getInstance().eventManager.AddListener(KeyDownListener.class, this); @@ -190,14 +184,6 @@ public void SetHudActive(AbstractHud hud, boolean state) { * 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.getValue(); - } - public void update() { if(!Aoba.getInstance().isGhosted()){ @@ -225,12 +211,12 @@ public void update() { * Updates the Color. * TODO: Remove this and move to event-based. */ - if(this.rainbow.getValue()) { - rainbowColor.update(this.effectSpeed.getValue().floatValue()); - this.currentColor = rainbowColor.getColor(); - }else { - this.currentColor = color.getValue(); - } + //if(this.rainbow.getValue()) { + // rainbowColor.update(this.effectSpeed.getValue().floatValue()); + // this.currentColor = rainbowColor.getColor(); + //}else { + // this.currentColor = foregroundColor.getValue(); + //} //Aoba.getInstance().eventManager.Fire(new MouseScrollEvent(5.0f, 5.0f)); } @@ -252,14 +238,14 @@ public void draw(DrawContext drawContext, float tickDelta) { */ if (this.clickGuiOpen) { RenderUtils.drawBox(matrixStack, 0, 0, window.getWidth(), window.getHeight(), new Color(26, 26, 26, 100)); - clickGuiNavBar.draw(drawContext, tickDelta, this.currentColor); + clickGuiNavBar.draw(drawContext, tickDelta); } // Render HUDS if(!this.clickGuiOpen || this.clickGuiNavBar.getSelectedPage() == this.hudPane) { for(AbstractGui hud : pinnedHuds.values()) { if(hud.getVisible()) { - hud.draw(drawContext, tickDelta, this.currentColor); + hud.draw(drawContext, tickDelta); } } } diff --git a/src/main/java/net/aoba/gui/NavigationBar.java b/src/main/java/net/aoba/gui/NavigationBar.java index eafaf89c..aa6b22e2 100644 --- a/src/main/java/net/aoba/gui/NavigationBar.java +++ b/src/main/java/net/aoba/gui/NavigationBar.java @@ -71,7 +71,7 @@ public void update() { } } - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { Window window = mc.getWindow(); int centerX = (window.getWidth() / 2); @@ -81,17 +81,17 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { int width = 100 * options.size(); GuiManager hudManager = Aoba.getInstance().hudManager; - RenderUtils.drawRoundedBox(matrixStack, centerX - (width / 2), 25, width, 25, 6, hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, centerX - (width / 2), 25, width, 25, 6, hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, centerX - (width / 2), 25, width, 25, 6, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, centerX - (width / 2), 25, width, 25, 6, GuiManager.borderColor.getValue()); RenderUtils.drawRoundedBox(drawContext.getMatrices(), centerX - (width / 2) + (100 * this.selectedIndex), 25, 100, 25, 5, new Color(150, 150, 150, 100)); for(int i = 0; i < options.size(); i++) { Page pane = options.get(i); if(i == selectedIndex) { - pane.render(drawContext, partialTicks, color); + pane.render(drawContext, partialTicks); } - RenderUtils.drawString(drawContext, pane.title, centerX - (width / 2) + 50 + (100 * i) - mc.textRenderer.getWidth(pane.title), 30, color); + RenderUtils.drawString(drawContext, pane.title, centerX - (width / 2) + 50 + (100 * i) - mc.textRenderer.getWidth(pane.title), 30, GuiManager.foregroundColor.getValue()); } } diff --git a/src/main/java/net/aoba/gui/Page.java b/src/main/java/net/aoba/gui/Page.java index fac6addd..ae83bc1d 100644 --- a/src/main/java/net/aoba/gui/Page.java +++ b/src/main/java/net/aoba/gui/Page.java @@ -58,11 +58,11 @@ public void update() { } } - public void render(DrawContext drawContext, float partialTicks, Color color) { + public void render(DrawContext drawContext, float partialTicks) { if(this.isVisible) { Iterator tabIterator = tabs.iterator(); while(tabIterator.hasNext()) { - tabIterator.next().draw(drawContext, partialTicks, color); + tabIterator.next().draw(drawContext, partialTicks); } } } diff --git a/src/main/java/net/aoba/gui/hud/AbstractHud.java b/src/main/java/net/aoba/gui/hud/AbstractHud.java index fc90755e..2dfc42f8 100644 --- a/src/main/java/net/aoba/gui/hud/AbstractHud.java +++ b/src/main/java/net/aoba/gui/hud/AbstractHud.java @@ -46,7 +46,7 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { } } diff --git a/src/main/java/net/aoba/gui/hud/ArmorHud.java b/src/main/java/net/aoba/gui/hud/ArmorHud.java index 5bf62368..f27391a0 100644 --- a/src/main/java/net/aoba/gui/hud/ArmorHud.java +++ b/src/main/java/net/aoba/gui/hud/ArmorHud.java @@ -22,7 +22,6 @@ package net.aoba.gui.hud; -import net.aoba.gui.Color; import net.aoba.utils.types.Vector2; import net.minecraft.client.gui.DrawContext; import net.minecraft.item.ItemStack; @@ -43,7 +42,7 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { if(this.visible) { DefaultedList armors = mc.player.getInventory().armor; diff --git a/src/main/java/net/aoba/gui/hud/InfoHud.java b/src/main/java/net/aoba/gui/hud/InfoHud.java index 925a1257..f1c13264 100644 --- a/src/main/java/net/aoba/gui/hud/InfoHud.java +++ b/src/main/java/net/aoba/gui/hud/InfoHud.java @@ -17,8 +17,6 @@ */ package net.aoba.gui.hud; -import net.aoba.Aoba; -import net.aoba.gui.Color; import net.aoba.gui.GuiManager; import net.aoba.misc.RenderUtils; import net.aoba.utils.types.Vector2; @@ -73,20 +71,19 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { if(this.visible) { MatrixStack matrixStack = drawContext.getMatrices(); // Draws background depending on components width and height Vector2 pos = position.getValue(); - GuiManager hudManager = Aoba.getInstance().hudManager; - RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height, 6, hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height, 6, hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height, 6, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height, 6, GuiManager.borderColor.getValue()); - RenderUtils.drawString(drawContext, positionText, pos.x + 5, pos.y + 4, color); - RenderUtils.drawString(drawContext, timeText, pos.x + 5, pos.y + 24, color); - RenderUtils.drawString(drawContext, fpsText, pos.x + 5, pos.y + 44, color); + RenderUtils.drawString(drawContext, positionText, pos.x + 5, pos.y + 4, GuiManager.foregroundColor.getValue()); + RenderUtils.drawString(drawContext, timeText, pos.x + 5, pos.y + 24, GuiManager.foregroundColor.getValue()); + RenderUtils.drawString(drawContext, fpsText, pos.x + 5, pos.y + 44, GuiManager.foregroundColor.getValue()); } } } diff --git a/src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java b/src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java index 1afe8e67..eb488e2b 100644 --- a/src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java +++ b/src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java @@ -112,7 +112,7 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { // Gets the client and window. MinecraftClient mc = MinecraftClient.getInstance(); MatrixStack matrixStack = drawContext.getMatrices(); @@ -121,19 +121,19 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { Vector2 pos = position.getValue(); // Draws the top bar including "Aoba x.x" - RenderUtils.drawString(drawContext, "Aoba " + AobaClient.VERSION, 8, 8, color); + RenderUtils.drawString(drawContext, "Aoba " + AobaClient.VERSION, 8, 8, GuiManager.foregroundColor.getValue()); // Draws the table including all of the categories. GuiManager hudManager = Aoba.getInstance().hudManager; - RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height * this.categories.length, 6f, hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height * this.categories.length, 6f, hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height * this.categories.length, 6f, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height * this.categories.length, 6f, GuiManager.borderColor.getValue()); // For every category, draw a cell for it. for (int i = 0; i < this.categories.length; i++) { - RenderUtils.drawString(drawContext, ">>", pos.x + width - 24, pos.y + (height * i) + 8, color); + RenderUtils.drawString(drawContext, ">>", pos.x + width - 24, pos.y + (height * i) + 8, GuiManager.foregroundColor.getValue()); // Draws the name of the category dependent on whether it is selected. if (this.index == i) { - RenderUtils.drawString(drawContext, "> " + this.categories[i].name(), pos.x + 8, pos.y + (height * i) + 8, color); + RenderUtils.drawString(drawContext, "> " + this.categories[i].name(), pos.x + 8, pos.y + (height * i) + 8, GuiManager.foregroundColor.getValue()); } else { RenderUtils.drawString(drawContext, this.categories[i].name(), pos.x + 8, pos.y + (height * i) + 8, 0xFFFFFF); } @@ -142,15 +142,15 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { // If any particular category menu is open. if (isCategoryMenuOpen) { // Draw the table underneath - RenderUtils.drawRoundedBox(matrixStack, pos.x + width, pos.y + (height * this.index), 165, height * modules.size(), 6f, hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, pos.x + width, pos.y + (height * this.index), 165, height * modules.size(), 6f, hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, pos.x + width, pos.y + (height * this.index), 165, height * modules.size(), 6f, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, pos.x + width, pos.y + (height * this.index), 165, height * modules.size(), 6f, GuiManager.borderColor.getValue()); // For every mod, draw a cell for it. for (int i = 0; i < modules.size(); i++) { if (this.indexMods == i) { RenderUtils.drawString(drawContext, "> " + modules.get(i).getName(), pos.x + width + 5, pos.y + (i * height) + (this.index * height) + 8, - modules.get(i).getState() ? 0x00FF00 : color.getColorAsInt()); + modules.get(i).getState() ? 0x00FF00 : GuiManager.foregroundColor.getValue().getColorAsInt()); } else { RenderUtils.drawString(drawContext, modules.get(i).getName(), pos.x + width + 5, pos.y + (i * height) + (this.index * height) + 8, @@ -166,7 +166,7 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { if(mod.getState()) { RenderUtils.drawString(drawContext, mod.getName(), (float) (window.getWidth() - ((mc.textRenderer.getWidth(mod.getName()) + 5) * 2)), 10 + (iteration*20), - color.getColorAsInt()); + GuiManager.foregroundColor.getValue().getColorAsInt()); iteration++; } } diff --git a/src/main/java/net/aoba/gui/hud/RadarHud.java b/src/main/java/net/aoba/gui/hud/RadarHud.java index abc7495b..9212ea50 100644 --- a/src/main/java/net/aoba/gui/hud/RadarHud.java +++ b/src/main/java/net/aoba/gui/hud/RadarHud.java @@ -39,7 +39,7 @@ public RadarHud( int x, int y, int width, int height) { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { if(this.visible) { MatrixStack matrixStack = drawContext.getMatrices(); @@ -47,13 +47,13 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { // Draws background depending on components width and height GuiManager hudManager = Aoba.getInstance().hudManager; - RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height, 6, hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height, 6, hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height, 6, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height, 6, GuiManager.borderColor.getValue()); // Draw the 'Radar' RenderUtils.drawBox(matrixStack, pos.x , pos.y + (height / 2), width - 1, 1, new Color(128,128,128, 255)); RenderUtils.drawBox(matrixStack, pos.x + (width / 2), pos.y, 1, height, new Color(128,128,128, 255)); - RenderUtils.drawBox(matrixStack, pos.x + (width / 2) - 2, pos.y + (height / 2) - 2, 5, 5, Aoba.getInstance().hudManager.getColor()); + RenderUtils.drawBox(matrixStack, pos.x + (width / 2) - 2, pos.y + (height / 2) - 2, 5, 5, GuiManager.foregroundColor.getValue()); float sin_theta = (float) Math.sin(Math.toRadians(-mc.player.getRotationClient().y)); float cos_theta = (float) Math.cos(Math.toRadians(-mc.player.getRotationClient().y)); @@ -101,7 +101,7 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { float radius_y = (float)((sin_theta * (fake_x - center_x)) + (cos_theta * (fake_y - center_y))) + center_y; RenderUtils.drawBox(matrixStack, (int)(Math.min(pos.x + width - 5, Math.max(pos.x, radius_x))), (int)(Math.min(pos.y + 25 + height, Math.max(pos.y, radius_y))), 3, 3, new Color(255, 255, 255, 255)); - RenderUtils.drawStringWithScale(drawContext, entity.getName().getString(), (int)(Math.min(pos.x + width - 5, Math.max(pos.x, radius_x))) - (mc.textRenderer.getWidth(entity.getName()) * 0.5f), (int)(Math.min(pos.y + 25 + height, Math.max(pos.y, radius_y))) - 10, color, 1.0f); + RenderUtils.drawStringWithScale(drawContext, entity.getName().getString(), (int)(Math.min(pos.x + width - 5, Math.max(pos.x, radius_x))) - (mc.textRenderer.getWidth(entity.getName()) * 0.5f), (int)(Math.min(pos.y + 25 + height, Math.max(pos.y, radius_y))) - 10, GuiManager.foregroundColor.getValue(), 1.0f); } } } diff --git a/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java b/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java index b5f18aa6..858e1ff8 100644 --- a/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java +++ b/src/main/java/net/aoba/gui/tabs/ClickGuiTab.java @@ -117,21 +117,22 @@ public void postupdate() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { MatrixStack matrixStack = drawContext.getMatrices(); Vector2 pos = position.getValue(); + if (drawBorder) { // Draws background depending on components width and height - RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height + 30, 6, Aoba.getInstance().hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height + 30, 6, Aoba.getInstance().hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height + 30, 6, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height + 30, 6, GuiManager.borderColor.getValue()); if(icon != null) { - RenderUtils.drawTexturedQuad(drawContext, icon, pos.x + 8, pos.y + 4, 22, 22, color); - RenderUtils.drawString(drawContext, this.title, pos.x + 38, pos.y + 8, Aoba.getInstance().hudManager.getColor()); + RenderUtils.drawTexturedQuad(drawContext, icon, pos.x + 8, pos.y + 4, 22, 22, GuiManager.foregroundColor.getValue()); + RenderUtils.drawString(drawContext, this.title, pos.x + 38, pos.y + 8, GuiManager.foregroundColor.getValue()); }else - RenderUtils.drawString(drawContext, this.title, pos.x + 8, pos.y + 8, Aoba.getInstance().hudManager.getColor()); + RenderUtils.drawString(drawContext, this.title, pos.x + 8, pos.y + 8, GuiManager.foregroundColor.getValue()); RenderUtils.drawLine(matrixStack, pos.x, pos.y + 30, pos.x + width, pos.y + 30, new Color(0, 0, 0, 100)); @@ -146,7 +147,7 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { } } for (Component child : children) { - child.draw(drawContext, partialTicks, color); + child.draw(drawContext, partialTicks); } } diff --git a/src/main/java/net/aoba/gui/tabs/HudsTab.java b/src/main/java/net/aoba/gui/tabs/HudsTab.java index dfb4458c..ad7dfade 100644 --- a/src/main/java/net/aoba/gui/tabs/HudsTab.java +++ b/src/main/java/net/aoba/gui/tabs/HudsTab.java @@ -27,6 +27,7 @@ import net.aoba.event.events.MouseScrollEvent; import net.aoba.event.listeners.MouseScrollListener; import net.aoba.gui.Color; +import net.aoba.gui.GuiManager; import net.aoba.gui.font.FontManager; import net.aoba.gui.hud.AbstractHud; import net.aoba.gui.tabs.components.ColorPickerComponent; @@ -62,7 +63,7 @@ public HudsTab(AbstractHud[] abstractHuds) { test.add(s); } - stackPanel.addChild(new StringComponent("Toggle HUD", stackPanel, Aoba.getInstance().hudManager.color.getValue(), true)); + stackPanel.addChild(new StringComponent("Toggle HUD", stackPanel, GuiManager.foregroundColor.getValue(), true)); for(AbstractHud hud : abstractHuds) { HudComponent hudComponent = new HudComponent(hud.getID(), stackPanel, hud); @@ -70,25 +71,25 @@ public HudsTab(AbstractHud[] abstractHuds) { } // Keybinds Header - stackPanel.addChild(new StringComponent("Keybinds", stackPanel, Aoba.getInstance().hudManager.color.getValue(), true)); + stackPanel.addChild(new StringComponent("Keybinds", stackPanel, GuiManager.foregroundColor.getValue(), true)); KeybindComponent clickGuiKeybindComponent = new KeybindComponent(stackPanel, Aoba.getInstance().hudManager.clickGuiButton); clickGuiKeybindComponent.setHeight(30); stackPanel.addChild(clickGuiKeybindComponent); // Hud Font Header - stackPanel.addChild(new StringComponent("HUD Font", stackPanel, Aoba.getInstance().hudManager.color.getValue(), true)); + stackPanel.addChild(new StringComponent("HUD Font", stackPanel, GuiManager.foregroundColor.getValue(), true)); ListComponent listComponent = new ListComponent(stackPanel, test, Aoba.getInstance().fontManager.fontSetting); stackPanel.addChild(listComponent); - stackPanel.addChild(new StringComponent("HUD Colors", stackPanel, Aoba.getInstance().hudManager.color.getValue(), true)); + stackPanel.addChild(new StringComponent("HUD Colors", stackPanel, GuiManager.foregroundColor.getValue(), true)); - stackPanel.addChild(new ColorPickerComponent(stackPanel, Aoba.getInstance().hudManager.color)); - stackPanel.addChild(new ColorPickerComponent(stackPanel, Aoba.getInstance().hudManager.backgroundColor)); - stackPanel.addChild(new ColorPickerComponent(stackPanel, Aoba.getInstance().hudManager.borderColor)); + stackPanel.addChild(new ColorPickerComponent(stackPanel, GuiManager.foregroundColor)); + stackPanel.addChild(new ColorPickerComponent(stackPanel, GuiManager.backgroundColor)); + stackPanel.addChild(new ColorPickerComponent(stackPanel, GuiManager.borderColor)); this.children.add(stackPanel); this.setWidth(300); @@ -105,7 +106,7 @@ else if(event.GetVertical() < 0) } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { - super.draw(drawContext, partialTicks, color); + public void draw(DrawContext drawContext, float partialTicks) { + super.draw(drawContext, partialTicks); } } diff --git a/src/main/java/net/aoba/gui/tabs/ModuleSettingsTab.java b/src/main/java/net/aoba/gui/tabs/ModuleSettingsTab.java index 1692af06..a6dfb889 100644 --- a/src/main/java/net/aoba/gui/tabs/ModuleSettingsTab.java +++ b/src/main/java/net/aoba/gui/tabs/ModuleSettingsTab.java @@ -124,24 +124,24 @@ public void postupdate() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { MatrixStack matrixStack = drawContext.getMatrices(); Vector2 pos = position.getValue(); // Draws background depending on components width and height GuiManager hudManager = Aoba.getInstance().hudManager; - RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height + 30, 6, hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height + 30, 6, hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height + 30, 6, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height + 30, 6, GuiManager.borderColor.getValue()); - RenderUtils.drawString(drawContext, this.title, pos.x + 8, pos.y + 8, Aoba.getInstance().hudManager.getColor()); + RenderUtils.drawString(drawContext, this.title, pos.x + 8, pos.y + 8, GuiManager.foregroundColor.getValue()); RenderUtils.drawLine(matrixStack, pos.x, pos.y + 30, pos.x + width, pos.y + 30, new Color(0, 0, 0, 100)); RenderUtils.drawLine(matrixStack, pos.x + width - 23, pos.y + 8, pos.x + width - 8, pos.y + 23, new Color(255, 0, 0, 255)); RenderUtils.drawLine(matrixStack, pos.x + width - 23, pos.y + 23, pos.x + width - 8, pos.y + 8, new Color(255, 0, 0, 255)); for (Component child : children) { - child.draw(drawContext, partialTicks, color); + child.draw(drawContext, partialTicks); } } diff --git a/src/main/java/net/aoba/gui/tabs/OptionsTab.java b/src/main/java/net/aoba/gui/tabs/OptionsTab.java index 757eb2d5..76b824c2 100644 --- a/src/main/java/net/aoba/gui/tabs/OptionsTab.java +++ b/src/main/java/net/aoba/gui/tabs/OptionsTab.java @@ -52,16 +52,13 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { MatrixStack matrixStack = drawContext.getMatrices(); Vector2 pos = position.getValue(); - System.out.println("X: " + pos.x + ", Y: " + pos.y); - - GuiManager hudManager = Aoba.getInstance().hudManager; - RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height, 6, hudManager.backgroundColor.getValue()); - RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height, 6, hudManager.borderColor.getValue()); + RenderUtils.drawRoundedBox(matrixStack, pos.x, pos.y, width, height, 6, GuiManager.backgroundColor.getValue()); + RenderUtils.drawRoundedOutline(matrixStack, pos.x, pos.y, width, height, 6, GuiManager.borderColor.getValue()); RenderUtils.drawLine(matrixStack, pos.x + 480, pos.y, pos.x + 480, pos.y + height, new Color(0, 0, 0, 200)); ArrayList modules = Aoba.getInstance().moduleManager.modules; @@ -69,7 +66,7 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { int yHeight = 30; for (int i = currentScroll; i < Math.min(modules.size(), currentScroll + visibleScrollElements); i++) { Module module = modules.get(i); - RenderUtils.drawString(drawContext, module.getName(), pos.x + 10, pos.y + yHeight, color); + RenderUtils.drawString(drawContext, module.getName(), pos.x + 10, pos.y + yHeight, GuiManager.foregroundColor.getValue()); yHeight += 30; } } diff --git a/src/main/java/net/aoba/gui/tabs/components/BlocksComponent.java b/src/main/java/net/aoba/gui/tabs/components/BlocksComponent.java index 1bcd4e94..4a9bf57b 100644 --- a/src/main/java/net/aoba/gui/tabs/components/BlocksComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/BlocksComponent.java @@ -24,6 +24,7 @@ import net.aoba.event.listeners.LeftMouseDownListener; import net.aoba.event.listeners.MouseScrollListener; import net.aoba.gui.Color; +import net.aoba.gui.GuiManager; import net.aoba.gui.IGuiElement; import net.aoba.misc.RenderUtils; import net.aoba.settings.types.BlocksSetting; @@ -71,9 +72,9 @@ public BlocksComponent(IGuiElement parent, BlocksSetting setting) { * @param color The current Color of the UI. */ @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { RenderUtils.drawString(drawContext, text, actualX + 6, actualY + 6, 0xFFFFFF); - RenderUtils.drawString(drawContext, collapsed ? ">>" : "<<", (actualX + actualWidth - 24), actualY + 6, color.getColorAsInt()); + RenderUtils.drawString(drawContext, collapsed ? ">>" : "<<", (actualX + actualWidth - 24), actualY + 6, GuiManager.foregroundColor.getValue().getColorAsInt()); if(!collapsed) { MatrixStack matrixStack = drawContext.getMatrices(); diff --git a/src/main/java/net/aoba/gui/tabs/components/ButtonComponent.java b/src/main/java/net/aoba/gui/tabs/components/ButtonComponent.java index bb23c1a4..8dc068a4 100644 --- a/src/main/java/net/aoba/gui/tabs/components/ButtonComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/ButtonComponent.java @@ -97,7 +97,7 @@ public void setBackgroundColor(Color color) { * @param color The current Color of the UI. */ @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { MatrixStack matrixStack = drawContext.getMatrices(); RenderUtils.drawOutlinedBox(matrixStack, actualX + 2, actualY, actualWidth - 4, actualHeight - 2, borderColor, backgroundColor); RenderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, 0xFFFFFF); diff --git a/src/main/java/net/aoba/gui/tabs/components/CheckboxComponent.java b/src/main/java/net/aoba/gui/tabs/components/CheckboxComponent.java index c20b75b2..5b6414fc 100644 --- a/src/main/java/net/aoba/gui/tabs/components/CheckboxComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/CheckboxComponent.java @@ -22,6 +22,7 @@ import net.aoba.event.events.LeftMouseDownEvent; import net.aoba.event.listeners.LeftMouseDownListener; import net.aoba.gui.Color; +import net.aoba.gui.GuiManager; import net.aoba.gui.IGuiElement; import net.aoba.misc.RenderUtils; import net.aoba.settings.types.BooleanSetting; @@ -53,8 +54,8 @@ public CheckboxComponent(IGuiElement parent, BooleanSetting checkbox) { * @param color The current Color of the UI. */ @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { - super.draw(drawContext, partialTicks, color); + public void draw(DrawContext drawContext, float partialTicks) { + super.draw(drawContext, partialTicks); MatrixStack matrixStack = drawContext.getMatrices(); RenderUtils.drawString(drawContext, this.text, actualX + 6, actualY + 8, 0xFFFFFF); diff --git a/src/main/java/net/aoba/gui/tabs/components/ColorPickerComponent.java b/src/main/java/net/aoba/gui/tabs/components/ColorPickerComponent.java index 52d0ab58..1b303c57 100644 --- a/src/main/java/net/aoba/gui/tabs/components/ColorPickerComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/ColorPickerComponent.java @@ -26,6 +26,7 @@ import net.aoba.event.listeners.LeftMouseUpListener; import net.aoba.event.listeners.MouseMoveListener; import net.aoba.gui.Color; +import net.aoba.gui.GuiManager; import net.aoba.gui.IGuiElement; import net.aoba.misc.RenderUtils; import net.aoba.settings.types.ColorSetting; @@ -147,11 +148,11 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { MatrixStack matrixStack = drawContext.getMatrices(); RenderUtils.drawString(drawContext, this.text, actualX + 6, actualY + 6, 0xFFFFFF); - RenderUtils.drawString(drawContext, collapsed ? ">>" : "<<", (actualX + actualWidth - 24), actualY + 6, color.getColorAsInt()); + RenderUtils.drawString(drawContext, collapsed ? ">>" : "<<", (actualX + actualWidth - 24), actualY + 6, GuiManager.foregroundColor.getValue().getColorAsInt()); if(!collapsed) { Color newColor = new Color(255, 0, 0); diff --git a/src/main/java/net/aoba/gui/tabs/components/Component.java b/src/main/java/net/aoba/gui/tabs/components/Component.java index a6389aa2..89653a3f 100644 --- a/src/main/java/net/aoba/gui/tabs/components/Component.java +++ b/src/main/java/net/aoba/gui/tabs/components/Component.java @@ -409,7 +409,7 @@ public void update() { * @param partialTicks Partial Ticks of the game. * @param color Color of the UI. */ - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { if (this.visible) { if (this.hovered && DEBUG) { RenderUtils.drawOutline(drawContext.getMatrices(), this.actualX, this.actualY, this.actualWidth, @@ -418,7 +418,7 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) { for (Component child : children) { if (child.visible) { - child.draw(drawContext, partialTicks, color); + child.draw(drawContext, partialTicks); } } } diff --git a/src/main/java/net/aoba/gui/tabs/components/HudComponent.java b/src/main/java/net/aoba/gui/tabs/components/HudComponent.java index 877d3db0..9a65eafa 100644 --- a/src/main/java/net/aoba/gui/tabs/components/HudComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/HudComponent.java @@ -45,8 +45,8 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { - super.draw(drawContext, partialTicks, color); + public void draw(DrawContext drawContext, float partialTicks) { + super.draw(drawContext, partialTicks); RenderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, 0xFFFFFF); if(this.hud.activated.getValue()) { diff --git a/src/main/java/net/aoba/gui/tabs/components/KeybindComponent.java b/src/main/java/net/aoba/gui/tabs/components/KeybindComponent.java index 79c271c9..ae41d814 100644 --- a/src/main/java/net/aoba/gui/tabs/components/KeybindComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/KeybindComponent.java @@ -50,8 +50,8 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { - super.draw(drawContext, partialTicks, color); + public void draw(DrawContext drawContext, float partialTicks) { + super.draw(drawContext, partialTicks); RenderUtils.drawString(drawContext, "Keybind", actualX + 8, actualY + 8, 0xFFFFFF); RenderUtils.drawBox(drawContext.getMatrices(), actualX + actualWidth - 100, actualY + 2, 98, actualHeight - 4, new Color(115, 115, 115, 200)); RenderUtils.drawOutline(drawContext.getMatrices(), actualX + actualWidth - 100, actualY + 2, 98, actualHeight - 4); diff --git a/src/main/java/net/aoba/gui/tabs/components/ListComponent.java b/src/main/java/net/aoba/gui/tabs/components/ListComponent.java index 188c63dd..c3708e02 100644 --- a/src/main/java/net/aoba/gui/tabs/components/ListComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/ListComponent.java @@ -58,7 +58,7 @@ public ListComponent(IGuiElement parent, List options, StringSetting lis } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { float stringWidth = Aoba.getInstance().fontManager.GetRenderer().getWidth(listSetting.getValue()); RenderUtils.drawString(drawContext, listSetting.getValue(), actualX + (actualWidth / 2.0f) - stringWidth, actualY + 8, 0xFFFFFF); diff --git a/src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java b/src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java index ca895a72..27d77650 100644 --- a/src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/ModuleComponent.java @@ -23,6 +23,7 @@ import net.aoba.event.listeners.LeftMouseDownListener; import net.aoba.module.Module; import net.aoba.gui.Color; +import net.aoba.gui.GuiManager; import net.aoba.gui.IGuiElement; import net.aoba.gui.tabs.ModuleSettingsTab; import net.aoba.misc.RenderUtils; @@ -55,11 +56,11 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { - super.draw(drawContext, partialTicks, color); - RenderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, module.getState() ? 0x00FF00 : this.hovered ? color.getColorAsInt() : 0xFFFFFF); + public void draw(DrawContext drawContext, float partialTicks) { + super.draw(drawContext, partialTicks); + RenderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, module.getState() ? 0x00FF00 : this.hovered ? GuiManager.foregroundColor.getValue().getColorAsInt() : 0xFFFFFF); if(module.hasSettings()) { - Color hudColor = Aoba.getInstance().hudManager.color.getValue(); + Color hudColor = GuiManager.foregroundColor.getValue(); RenderUtils.drawTexturedQuad(drawContext, gear, (actualX + actualWidth - 20), (actualY + 6), 16, 16, hudColor); } } diff --git a/src/main/java/net/aoba/gui/tabs/components/SliderComponent.java b/src/main/java/net/aoba/gui/tabs/components/SliderComponent.java index a23cb4de..ea116417 100644 --- a/src/main/java/net/aoba/gui/tabs/components/SliderComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/SliderComponent.java @@ -127,18 +127,16 @@ public void update() { } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { MatrixStack matrixStack = drawContext.getMatrices(); - //renderUtils.drawBox(matrixStack, actualX + 4, actualY + 24, actualWidth - 8, actualHeight - 8, 0.5f, 0.5f, 0.5f, 0.3f); - + // Draw the rest of the box. - float xLength = ((actualWidth - 18) * (float) ((slider.getValue() - slider.min_value) / (slider.max_value - slider.min_value))); GuiManager hudManager = Aoba.getInstance().hudManager; - RenderUtils.drawBox(matrixStack, actualX + 10, actualY + 35, xLength, 2, hudManager.color.getValue()); + RenderUtils.drawBox(matrixStack, actualX + 10, actualY + 35, xLength, 2, GuiManager.foregroundColor.getValue()); RenderUtils.drawBox(matrixStack, actualX + 10 + xLength, actualY + 35, (actualWidth - xLength - 18), 2, new Color(255, 255, 255, 255)); - RenderUtils.drawCircle(matrixStack, actualX + 10 + xLength, actualY + 35, 6, hudManager.color.getValue()); + RenderUtils.drawCircle(matrixStack, actualX + 10 + xLength, actualY + 35, 6, GuiManager.foregroundColor.getValue()); if (this.slider == null) return; diff --git a/src/main/java/net/aoba/gui/tabs/components/StringComponent.java b/src/main/java/net/aoba/gui/tabs/components/StringComponent.java index 1c899e36..8e01e0ba 100644 --- a/src/main/java/net/aoba/gui/tabs/components/StringComponent.java +++ b/src/main/java/net/aoba/gui/tabs/components/StringComponent.java @@ -65,7 +65,7 @@ public StringComponent(String text, IGuiElement parent, Color color, boolean bol } @Override - public void draw(DrawContext drawContext, float partialTicks, Color color) { + public void draw(DrawContext drawContext, float partialTicks) { int i = 0; for (String str : text) { if(bold) diff --git a/src/main/java/net/aoba/misc/RenderUtils.java b/src/main/java/net/aoba/misc/RenderUtils.java index 8adb9792..c95eb529 100644 --- a/src/main/java/net/aoba/misc/RenderUtils.java +++ b/src/main/java/net/aoba/misc/RenderUtils.java @@ -41,20 +41,8 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; -import java.io.File; -import java.io.FileInputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; import org.joml.Matrix4f; import org.lwjgl.opengl.GL11; -import org.lwjgl.stb.STBTTFontinfo; -import org.lwjgl.stb.STBTruetype; -import org.lwjgl.system.MemoryUtil; -import org.lwjgl.system.Struct; import net.minecraft.util.math.Vec3d; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; @@ -535,7 +523,6 @@ public static void drawLine3D(MatrixStack matrixStack, Vec3d pos, Vec3d pos2, Co } public static void drawString(DrawContext drawContext, String text, float x, float y, Color color) { - MinecraftClient mc = MinecraftClient.getInstance(); AobaClient aoba = Aoba.getInstance(); MatrixStack matrixStack = drawContext.getMatrices(); matrixStack.push(); @@ -546,7 +533,6 @@ public static void drawString(DrawContext drawContext, String text, float x, flo } public static void drawString(DrawContext drawContext, String text, float x, float y, int color) { - MinecraftClient mc = MinecraftClient.getInstance(); AobaClient aoba = Aoba.getInstance(); MatrixStack matrixStack = drawContext.getMatrices(); matrixStack.push(); @@ -557,7 +543,6 @@ public static void drawString(DrawContext drawContext, String text, float x, flo } public static void drawStringWithScale(DrawContext drawContext, String text, float x, float y, Color color, float scale) { - MinecraftClient mc = MinecraftClient.getInstance(); AobaClient aoba = Aoba.getInstance(); MatrixStack matrixStack = drawContext.getMatrices(); matrixStack.push(); @@ -572,7 +557,6 @@ public static void drawStringWithScale(DrawContext drawContext, String text, flo } public static void drawStringWithScale(DrawContext drawContext, String text, float x, float y, int color, float scale) { - MinecraftClient mc = MinecraftClient.getInstance(); AobaClient aoba = Aoba.getInstance(); MatrixStack matrixStack = drawContext.getMatrices(); matrixStack.push(); diff --git a/src/main/java/net/aoba/mixin/AbstractClientPlayerEntityMixin.java b/src/main/java/net/aoba/mixin/AbstractClientPlayerEntityMixin.java new file mode 100644 index 00000000..ebeda8d3 --- /dev/null +++ b/src/main/java/net/aoba/mixin/AbstractClientPlayerEntityMixin.java @@ -0,0 +1,17 @@ +package net.aoba.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.client.network.AbstractClientPlayerEntity; + +@Mixin(AbstractClientPlayerEntity.class) +public abstract class AbstractClientPlayerEntityMixin extends PlayerEntityMixin { + + @Inject(method = "isSpectator()Z", at = @At("HEAD"), cancellable = true) + public void onIsSpectator(CallbackInfoReturnable cir) { + return; + } +} diff --git a/src/main/java/net/aoba/mixin/ChatScreenMixin.java b/src/main/java/net/aoba/mixin/ChatScreenMixin.java index 3e2a25af..0b28880a 100644 --- a/src/main/java/net/aoba/mixin/ChatScreenMixin.java +++ b/src/main/java/net/aoba/mixin/ChatScreenMixin.java @@ -102,8 +102,8 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, float delta int guiScale = mc.getWindow().calculateScaleFactor(mc.options.getGuiScale().getValue(), mc.forcesUnicodeFont()); matrixStack.scale(1.0f / guiScale, 1.0f / guiScale, 1.0f); - serverChatButton.draw(context, delta, Aoba.getInstance().hudManager.color.getValue()); - globalChatButton.draw(context, delta, Aoba.getInstance().hudManager.color.getValue()); + serverChatButton.draw(context, delta); + globalChatButton.draw(context, delta); matrixStack.pop(); GL11.glEnable(GL11.GL_CULL_FACE); } diff --git a/src/main/java/net/aoba/mixin/ClientConnectionMixin.java b/src/main/java/net/aoba/mixin/ClientConnectionMixin.java index d6d04fcf..6b4111a4 100644 --- a/src/main/java/net/aoba/mixin/ClientConnectionMixin.java +++ b/src/main/java/net/aoba/mixin/ClientConnectionMixin.java @@ -67,4 +67,6 @@ private void onSend(Packet packet, @Nullable PacketCallbacks callback, Callba ci.cancel(); } } + + } diff --git a/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java b/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java index 92c622a8..e3e76c61 100644 --- a/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java @@ -23,29 +23,21 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import com.mojang.authlib.GameProfile; - +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.aoba.Aoba; +import net.aoba.event.events.PlayerHealthEvent; import net.aoba.gui.GuiManager; import net.aoba.misc.FakePlayerEntity; -import net.aoba.module.modules.movement.Fly; import net.aoba.module.modules.movement.Freecam; -import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.world.ClientWorld; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; @Mixin(ClientPlayerEntity.class) -public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity { +public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntityMixin { @Shadow private ClientPlayNetworkHandler networkHandler; - public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) { - super(world, profile); - } - @Inject(at = { @At("HEAD") }, method = "tick()V", cancellable = true) private void onPlayerTick(CallbackInfo ci) { if (Aoba.getInstance().moduleManager.freecam.getState()) { @@ -67,6 +59,9 @@ private void sendMovementPackets(CallbackInfo ci) { } } + + + @Inject (at = {@At("HEAD")}, method="setShowsDeathScreen(Z)V") private void onShowDeathScreen(boolean state, CallbackInfo ci) { GuiManager hudManager = Aoba.getInstance().hudManager; @@ -75,27 +70,34 @@ private void onShowDeathScreen(boolean state, CallbackInfo ci) { hudManager.setClickGuiOpen(false); } } + @Override - - public boolean isSpectator() { - return super.isSpectator() || Aoba.getInstance().moduleManager.freecam.getState(); + public void onIsSpectator(CallbackInfoReturnable cir) { + if(Aoba.getInstance().moduleManager.freecam.getState()) { + cir.setReturnValue(true); + } } - @Override + public void onSetHealth(float health, CallbackInfo ci) { + PlayerHealthEvent event = new PlayerHealthEvent(null, health); + Aoba.getInstance().eventManager.Fire(event); + } - protected float getOffGroundSpeed() { - float speed = super.getOffGroundSpeed(); - if(Aoba.getInstance().moduleManager.fly.getState()) { - Fly fly = (Fly)Aoba.getInstance().moduleManager.fly; - return (float)fly.getSpeed(); - } - if(Aoba.getInstance().moduleManager.freecam.getState()) { - Freecam freecam = (Freecam)Aoba.getInstance().moduleManager.freecam; - return (float)freecam.getSpeed(); - } - return speed; - } +// @Override +// protected float getOffGroundSpeed() { +// float speed = super.getOffGroundSpeed(); +// if(Aoba.getInstance().moduleManager.fly.getState()) { +// Fly fly = (Fly)Aoba.getInstance().moduleManager.fly; +// return (float)fly.getSpeed(); +// } +// +// if(Aoba.getInstance().moduleManager.freecam.getState()) { +// Freecam freecam = (Freecam)Aoba.getInstance().moduleManager.freecam; +// return (float)freecam.getSpeed(); +// } +// return speed; +// } } diff --git a/src/main/java/net/aoba/mixin/EntityMixin.java b/src/main/java/net/aoba/mixin/EntityMixin.java index 0a9b38a5..aa9b6434 100644 --- a/src/main/java/net/aoba/mixin/EntityMixin.java +++ b/src/main/java/net/aoba/mixin/EntityMixin.java @@ -26,6 +26,7 @@ import net.aoba.Aoba; import net.minecraft.entity.Entity; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.registry.tag.TagKey; @@ -33,6 +34,9 @@ @Mixin(Entity.class) public abstract class EntityMixin{ + @Shadow + protected DataTracker dataTracker; + @Shadow public abstract boolean isSubmergedIn(TagKey fluidTag); diff --git a/src/main/java/net/aoba/mixin/HungerManagerMixin.java b/src/main/java/net/aoba/mixin/HungerManagerMixin.java new file mode 100644 index 00000000..aa40b0e1 --- /dev/null +++ b/src/main/java/net/aoba/mixin/HungerManagerMixin.java @@ -0,0 +1,50 @@ +package net.aoba.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.aoba.Aoba; +import net.aoba.event.events.FoodLevelEvent; +import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.player.HungerManager; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.Difficulty; + +@Mixin(HungerManager.class) +public class HungerManagerMixin { + @Shadow + private int foodLevel; + + @Shadow + private float saturationLevel; + + @Shadow + private float exhaustion; + + @Inject(at = { @At("HEAD") }, method = { "update(Lnet/minecraft/entity/player/PlayerEntity;)V" }, cancellable = true) + private void onHungerUpdate(PlayerEntity player, CallbackInfo ci) { + MinecraftClient mc = MinecraftClient.getInstance(); + + if (player == mc.player) { + Difficulty difficulty = player.getWorld().getDifficulty(); + if (this.exhaustion > 4.0f) { + if (this.saturationLevel <= 0.0f && difficulty != Difficulty.PEACEFUL) { + System.out.println("HUNGER EVENT "); + // Fire Event + int newFoodLevel = Math.max(this.foodLevel - 1, 0); + FoodLevelEvent event = new FoodLevelEvent(newFoodLevel); + Aoba.getInstance().eventManager.Fire(event); + } + } + } + } + + @Inject(at = { @At("HEAD") }, method = { "setFoodLevel(I)V" }, cancellable = true) + private void onSetHunger(int foodLevel, CallbackInfo ci) { + FoodLevelEvent event = new FoodLevelEvent(foodLevel); + Aoba.getInstance().eventManager.Fire(event); + } +} diff --git a/src/main/java/net/aoba/mixin/LivingEntityMixin.java b/src/main/java/net/aoba/mixin/LivingEntityMixin.java new file mode 100644 index 00000000..256ca93c --- /dev/null +++ b/src/main/java/net/aoba/mixin/LivingEntityMixin.java @@ -0,0 +1,16 @@ +package net.aoba.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import net.minecraft.entity.LivingEntity; + +@Mixin(LivingEntity.class) +public abstract class LivingEntityMixin extends EntityMixin { + + @Inject (at = {@At("HEAD")}, method="setHealth(F)V") + public void onSetHealth(float health, CallbackInfo ci) { + return; + } +} diff --git a/src/main/java/net/aoba/mixin/PlayerEntityMixin.java b/src/main/java/net/aoba/mixin/PlayerEntityMixin.java index 4865346c..853e2271 100644 --- a/src/main/java/net/aoba/mixin/PlayerEntityMixin.java +++ b/src/main/java/net/aoba/mixin/PlayerEntityMixin.java @@ -34,11 +34,13 @@ import net.minecraft.registry.tag.FluidTags; @Mixin (PlayerEntity.class) -public abstract class PlayerEntityMixin extends EntityMixin{ +public abstract class PlayerEntityMixin extends LivingEntityMixin { @Shadow private PlayerInventory inventory; - + + @Shadow + public abstract boolean isSpectator(); @Inject(method = "getBlockBreakingSpeed", at = @At("HEAD"), cancellable = true) public void onGetBlockBreakingSpeed(BlockState blockState, CallbackInfoReturnable ci) { @@ -57,14 +59,4 @@ public void onGetBlockBreakingSpeed(BlockState blockState, CallbackInfoReturnabl ci.setReturnValue(speed); } } - - @Override - public void onDamage(DamageSource source, float amount, CallbackInfoReturnable ci) { - PlayerHealthEvent event = new PlayerHealthEvent(source, amount); - Aoba.getInstance().eventManager.Fire(event); - if(event.IsCancelled()) { - ci.cancel(); - } - } - } diff --git a/src/main/java/net/aoba/module/ModuleManager.java b/src/main/java/net/aoba/module/ModuleManager.java index 80297104..56cf5291 100644 --- a/src/main/java/net/aoba/module/ModuleManager.java +++ b/src/main/java/net/aoba/module/ModuleManager.java @@ -42,6 +42,8 @@ public class ModuleManager implements KeyDownListener { public ArrayList modules = new ArrayList(); + private MinecraftClient mc = MinecraftClient.getInstance(); + //Modules public Module aimbot = new Aimbot(); public Module anticactus = new AntiCactus(); @@ -52,6 +54,7 @@ public class ModuleManager implements KeyDownListener { public Module autofish = new AutoFish(); public Module autosign = new AutoSign(); public Module autosoup = new AutoSoup(); + public Module autoTotem = new AutoTotem(); public Module autorespawn = new AutoRespawn(); public Module autowalk = new AutoWalk(); public Module breadcrumbs = new Breadcrumbs(); @@ -105,6 +108,7 @@ public ModuleManager() { addModule(autofish); addModule(autosign); addModule(autosoup); + addModule(autoTotem); addModule(autorespawn); addModule(autowalk); addModule(breadcrumbs); @@ -168,7 +172,7 @@ public void render(MatrixStack matrixStack) { matrixStack.push(); - Vec3d camPos = MinecraftClient.getInstance().getBlockEntityRenderDispatcher().camera.getPos(); + Vec3d camPos = mc.getBlockEntityRenderDispatcher().camera.getPos(); matrixStack.translate(-camPos.x, -camPos.y, -camPos.z); RenderEvent renderEvent = new RenderEvent(matrixStack, MinecraftClient.getInstance().getTickDelta()); @@ -201,7 +205,7 @@ public Module getModuleByName(String string) { @Override public void OnKeyDown(KeyDownEvent event) { - if(MinecraftClient.getInstance().currentScreen == null) { + if(mc.currentScreen == null) { for(Module module : modules) { Key binding = module.getBind().getValue(); if(binding.getCode() == event.GetKey()) { diff --git a/src/main/java/net/aoba/module/modules/combat/Nametags.java b/src/main/java/net/aoba/module/modules/combat/Nametags.java index 7c0970bb..5bb0198a 100644 --- a/src/main/java/net/aoba/module/modules/combat/Nametags.java +++ b/src/main/java/net/aoba/module/modules/combat/Nametags.java @@ -41,7 +41,7 @@ public Nametags() { this.setCategory(Category.Combat); this.setDescription("Scales the nametags to be larger."); - scale = new FloatSetting("nametags_scale", "Scale", "Scale of the NameTags", 0, 0, 5, 0.25); + scale = new FloatSetting("nametags_scale", "Scale", "Scale of the NameTags", 0f, 0f, 5f, 0.25f); onlyPlayers = new BooleanSetting("nametags_onlyPlayers", "Only Players", "Whether Nametags are only enlarged for players.", false); alwaysVisible = new BooleanSetting("nametags_alwaysVisible", "Always Visible", "Whether Nametags will always be displayed.", false); this.addSetting(scale); diff --git a/src/main/java/net/aoba/module/modules/combat/Reach.java b/src/main/java/net/aoba/module/modules/combat/Reach.java index cb3f63a7..478bfcdf 100644 --- a/src/main/java/net/aoba/module/modules/combat/Reach.java +++ b/src/main/java/net/aoba/module/modules/combat/Reach.java @@ -62,6 +62,6 @@ public void onToggle() { } public void setReachLength(float reach) { - this.distance.setValue((double)reach); + this.distance.setValue(reach); } } \ No newline at end of file diff --git a/src/main/java/net/aoba/module/modules/misc/AutoEat.java b/src/main/java/net/aoba/module/modules/misc/AutoEat.java index 736a0cbc..9829bb10 100644 --- a/src/main/java/net/aoba/module/modules/misc/AutoEat.java +++ b/src/main/java/net/aoba/module/modules/misc/AutoEat.java @@ -23,16 +23,19 @@ import org.lwjgl.glfw.GLFW; import net.aoba.Aoba; +import net.aoba.event.events.FoodLevelEvent; import net.aoba.event.events.TickEvent; +import net.aoba.event.listeners.FoodLevelListener; import net.aoba.event.listeners.TickListener; import net.aoba.module.Module; +import net.aoba.settings.types.FloatSetting; import net.aoba.settings.types.KeybindSetting; import net.minecraft.client.util.InputUtil; import net.minecraft.item.FoodComponent; import net.minecraft.item.Item; -public class AutoEat extends Module implements TickListener { - private int hunger = 6; +public class AutoEat extends Module implements FoodLevelListener { + private FloatSetting hungerSetting; public AutoEat() { super(new KeybindSetting("key.autoeat", "AntiCactus Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0))); @@ -40,16 +43,20 @@ public AutoEat() { this.setName("AutoEat"); this.setCategory(Category.Misc); this.setDescription("Automatically eats the best food in your inventory."); + + hungerSetting = new FloatSetting("autoeat_hunger", "Hunger", "Determines when AutoEat will trigger.", 6, 1, 20, 1); + + this.addSetting(hungerSetting); } @Override public void onDisable() { - Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this); + Aoba.getInstance().eventManager.RemoveListener(FoodLevelListener.class, this); } @Override public void onEnable() { - Aoba.getInstance().eventManager.AddListener(TickListener.class, this); + Aoba.getInstance().eventManager.AddListener(FoodLevelListener.class, this); } @Override @@ -58,12 +65,12 @@ public void onToggle() { } public void setHunger(int hunger) { - + hungerSetting.setValue((float)hunger); } @Override - public void OnUpdate(TickEvent event) { - if(MC.player.getHungerManager().getFoodLevel() <= hunger) { + public void OnFoodLevelChanged(FoodLevelEvent readPacketEvent) { + if(readPacketEvent.getFoodLevel() <= hungerSetting.getValue()) { int foodSlot= -1; FoodComponent bestFood = null; for(int i = 0; i< 9; i++) { diff --git a/src/main/java/net/aoba/module/modules/misc/FastBreak.java b/src/main/java/net/aoba/module/modules/misc/FastBreak.java index b78b4468..ad031379 100644 --- a/src/main/java/net/aoba/module/modules/misc/FastBreak.java +++ b/src/main/java/net/aoba/module/modules/misc/FastBreak.java @@ -47,7 +47,7 @@ public FastBreak() { this.addSetting(ignoreWater); } - public void setMultiplier(float multiplier) { this.multiplier.setValue((double)multiplier); } + public void setMultiplier(float multiplier) { this.multiplier.setValue(multiplier); } public float getMultiplier() { return this.multiplier.getValue().floatValue(); diff --git a/src/main/java/net/aoba/module/modules/misc/Timer.java b/src/main/java/net/aoba/module/modules/misc/Timer.java index b4ecb192..13f80370 100644 --- a/src/main/java/net/aoba/module/modules/misc/Timer.java +++ b/src/main/java/net/aoba/module/modules/misc/Timer.java @@ -46,7 +46,7 @@ public float getMultiplier() { } public void setMultipler(float multiplier) { - this.multiplier.setValue((double)multiplier); + this.multiplier.setValue(multiplier); } @Override diff --git a/src/main/java/net/aoba/module/modules/movement/Fly.java b/src/main/java/net/aoba/module/modules/movement/Fly.java index 106e89ea..9e93e8f3 100644 --- a/src/main/java/net/aoba/module/modules/movement/Fly.java +++ b/src/main/java/net/aoba/module/modules/movement/Fly.java @@ -49,7 +49,7 @@ public Fly() { } public void setSpeed(float speed) { - this.flySpeed.setValue((double)speed); + this.flySpeed.setValue(speed); } public double getSpeed() { diff --git a/src/main/java/net/aoba/module/modules/movement/Freecam.java b/src/main/java/net/aoba/module/modules/movement/Freecam.java index 941adc98..93a23af9 100644 --- a/src/main/java/net/aoba/module/modules/movement/Freecam.java +++ b/src/main/java/net/aoba/module/modules/movement/Freecam.java @@ -50,7 +50,7 @@ public Freecam() { } public void setSpeed(float speed) { - this.flySpeed.setValue((double)speed); + this.flySpeed.setValue(speed); } public double getSpeed() { diff --git a/src/main/java/net/aoba/module/modules/movement/Jetpack.java b/src/main/java/net/aoba/module/modules/movement/Jetpack.java index bdf0960e..783ef69b 100644 --- a/src/main/java/net/aoba/module/modules/movement/Jetpack.java +++ b/src/main/java/net/aoba/module/modules/movement/Jetpack.java @@ -52,7 +52,7 @@ public Jetpack() { } public void setSpeed(float speed) { - this.jetpackSpeed.setValue((double)speed); + this.jetpackSpeed.setValue(speed); } public double getSpeed() { diff --git a/src/main/java/net/aoba/module/modules/movement/Step.java b/src/main/java/net/aoba/module/modules/movement/Step.java index ed027a55..e94d3787 100644 --- a/src/main/java/net/aoba/module/modules/movement/Step.java +++ b/src/main/java/net/aoba/module/modules/movement/Step.java @@ -61,6 +61,6 @@ public void onToggle() { } public void setStepHeight(float height) { - this.stepHeight.setValue((double)height); + this.stepHeight.setValue(height); } } diff --git a/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java b/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java index 1fab5d2d..038d55e2 100644 --- a/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java +++ b/src/main/java/net/aoba/module/modules/render/Breadcrumbs.java @@ -48,7 +48,7 @@ public class Breadcrumbs extends Module implements RenderListener, TickListener private RainbowColor rainbowColor; public BooleanSetting rainbow = new BooleanSetting("breadcrumbs_rainbow", "Rainbow", "Rainbow", false); - public FloatSetting effectSpeed = new FloatSetting("breadcrumbs_effectspeed", "Effect Spd.", "Effect Spd", 4, 1, 20, 0.1); + public FloatSetting effectSpeed = new FloatSetting("breadcrumbs_effectspeed", "Effect Spd.", "Effect Spd", 4f, 1f, 20f, 0.1f); private float timer = 10; private float currentTick = 0; diff --git a/src/main/java/net/aoba/module/modules/render/ChestESP.java b/src/main/java/net/aoba/module/modules/render/ChestESP.java index 719c25cf..6434b31b 100644 --- a/src/main/java/net/aoba/module/modules/render/ChestESP.java +++ b/src/main/java/net/aoba/module/modules/render/ChestESP.java @@ -51,7 +51,7 @@ public class ChestESP extends Module implements RenderListener, TickListener { private ColorSetting color = new ColorSetting("chestesp_color", "Color", "Color", new Color(0, 1f, 1f)); public BooleanSetting rainbow = new BooleanSetting("chestesp_rainbow", "Rainbow", "Rainbow", false); - public FloatSetting effectSpeed = new FloatSetting("chestesp_effectspeed", "Effect Speed", "Effect Speed", 4, 1, 20, 0.1); + public FloatSetting effectSpeed = new FloatSetting("chestesp_effectspeed", "Effect Speed", "Effect Speed", 4f, 1f, 20f, 0.1f); public ChestESP() { diff --git a/src/main/java/net/aoba/module/modules/render/EntityESP.java b/src/main/java/net/aoba/module/modules/render/EntityESP.java index 143ea344..5c65822c 100644 --- a/src/main/java/net/aoba/module/modules/render/EntityESP.java +++ b/src/main/java/net/aoba/module/modules/render/EntityESP.java @@ -50,7 +50,7 @@ public class EntityESP extends Module implements RenderListener, TickListener { private ColorSetting color_misc = new ColorSetting("entityesp_color_misc", "Misc. Color", "Misc. Color", new Color(0, 1f, 1f)); public BooleanSetting rainbow = new BooleanSetting("entityesp_rainbow", "Rainbow","Rainbow", false); - public FloatSetting effectSpeed = new FloatSetting("entityesp_effectspeed", "Effect Speed", "Effect Speed", 4, 1, 20, 0.1); + public FloatSetting effectSpeed = new FloatSetting("entityesp_effectspeed", "Effect Speed", "Effect Speed", 4f, 1f, 20f, 0.1f); public EntityESP() { super(new KeybindSetting("key.entityesp", "EntityESP Key", InputUtil.fromKeyCode(GLFW.GLFW_KEY_UNKNOWN, 0))); diff --git a/src/main/java/net/aoba/module/modules/world/AutoFarm.java b/src/main/java/net/aoba/module/modules/world/AutoFarm.java index cf81419a..d132fe45 100644 --- a/src/main/java/net/aoba/module/modules/world/AutoFarm.java +++ b/src/main/java/net/aoba/module/modules/world/AutoFarm.java @@ -60,7 +60,7 @@ public AutoFarm() { } public void setRadius(int radius) { - this.radius.setValue((double)radius); + this.radius.setValue((float)radius); } @Override diff --git a/src/main/java/net/aoba/module/modules/world/Nuker.java b/src/main/java/net/aoba/module/modules/world/Nuker.java index 15a3ab56..e4c9ca2d 100644 --- a/src/main/java/net/aoba/module/modules/world/Nuker.java +++ b/src/main/java/net/aoba/module/modules/world/Nuker.java @@ -64,7 +64,7 @@ public Nuker() { } public void setRadius(int radius) { - this.radius.setValue((double)radius); + this.radius.setValue((float)radius); } @Override diff --git a/src/main/java/net/aoba/module/modules/world/TileBreaker.java b/src/main/java/net/aoba/module/modules/world/TileBreaker.java index d22a479c..eec4c692 100644 --- a/src/main/java/net/aoba/module/modules/world/TileBreaker.java +++ b/src/main/java/net/aoba/module/modules/world/TileBreaker.java @@ -66,7 +66,7 @@ public TileBreaker() { } public void setRadius(int radius) { - this.radius.setValue((double)radius); + this.radius.setValue((float)radius); } @Override diff --git a/src/main/java/net/aoba/settings/Setting.java b/src/main/java/net/aoba/settings/Setting.java index a298d23f..cb1ab1d4 100644 --- a/src/main/java/net/aoba/settings/Setting.java +++ b/src/main/java/net/aoba/settings/Setting.java @@ -25,7 +25,7 @@ public abstract class Setting { public enum TYPE { - BOOLEAN, DOUBLE, STRING, INTEGER, STRINGLIST, INDEXEDSTRINGLIST, VECTOR2, KEYBIND, COLOR, BLOCKS + BOOLEAN, FLOAT, STRING, INTEGER, STRINGLIST, INDEXEDSTRINGLIST, VECTOR2, KEYBIND, COLOR, BLOCKS } public final String ID; diff --git a/src/main/java/net/aoba/settings/SettingManager.java b/src/main/java/net/aoba/settings/SettingManager.java index 73b0a8c1..e4675541 100644 --- a/src/main/java/net/aoba/settings/SettingManager.java +++ b/src/main/java/net/aoba/settings/SettingManager.java @@ -76,7 +76,7 @@ public static void saveSettings(String name, List> config_category2) for (Setting setting : config_category2) { try { switch (setting.type) { - case DOUBLE, INTEGER, BOOLEAN, STRING -> { + case FLOAT, INTEGER, BOOLEAN, STRING -> { config.setProperty(setting.ID, String.valueOf(setting.getValue())); } case KEYBIND -> { @@ -133,11 +133,11 @@ public static void loadSettings(String name, List> config_category2) break; switch (setting.type) { - case DOUBLE -> { + case FLOAT -> { float floatValue = Float.parseFloat(value); if (((FloatSetting) setting).min_value <= floatValue && ((FloatSetting) setting).max_value >= floatValue) { - setting.setValue(Double.parseDouble(value)); + setting.setValue(Float.parseFloat(value)); } break; } @@ -188,6 +188,9 @@ public static void loadSettings(String name, List> config_category2) setting.setValue(result); break; } + case INDEXEDSTRINGLIST -> throw new UnsupportedOperationException("Unimplemented case: " + setting.type); + case STRINGLIST -> throw new UnsupportedOperationException("Unimplemented case: " + setting.type); + default -> throw new IllegalArgumentException("Unexpected value: " + setting.type); } } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/net/aoba/settings/types/FloatSetting.java b/src/main/java/net/aoba/settings/types/FloatSetting.java index de6d0f39..e03b6833 100644 --- a/src/main/java/net/aoba/settings/types/FloatSetting.java +++ b/src/main/java/net/aoba/settings/types/FloatSetting.java @@ -22,40 +22,40 @@ import net.aoba.settings.Setting; -public class FloatSetting extends Setting { - public final double min_value; - public final double max_value; - public final double step; +public class FloatSetting extends Setting { + public final float min_value; + public final float max_value; + public final float step; - public FloatSetting(String ID, String description, double default_value, double min_value, double max_value, double step) { + public FloatSetting(String ID, String description, float default_value, float min_value, float max_value, float step) { super(ID, description, default_value); this.min_value = min_value; this.max_value = max_value; this.step = step; - type = TYPE.DOUBLE; + type = TYPE.FLOAT; } - public FloatSetting(String ID, String displayName, String description, double default_value, double min_value, double max_value, double step) { + public FloatSetting(String ID, String displayName, String description, float default_value, float min_value, float max_value, float step) { super(ID, displayName, description, default_value); this.min_value = min_value; this.max_value = max_value; this.step = step; - type = TYPE.DOUBLE; + type = TYPE.FLOAT; } - public FloatSetting(String ID, String description, double default_value, double min_value, double max_value, double step, Consumer onUpdate) { + public FloatSetting(String ID, String description, float default_value, float min_value, float max_value, float step, Consumer onUpdate) { super(ID, description, default_value, onUpdate); this.min_value = min_value; this.max_value = max_value; this.step = step; - type = TYPE.DOUBLE; + type = TYPE.FLOAT; } /** * Setter for the value. Includes rounding to the nearest "step". */ @Override - public void setValue(Double value) { + public void setValue(Float value) { double newValue = Math.max(min_value, Math.min(max_value, value)); int steps = (int) Math.round((newValue) / step); super.setValue(step * steps); @@ -65,7 +65,7 @@ public void setValue(Double value) { * Checks whether or not a value is with this setting's valid range. */ @Override - protected boolean isValueValid(Double value) { + protected boolean isValueValid(Float value) { return value >= min_value && value <= max_value; } } diff --git a/src/main/resources/aoba.mixins.json b/src/main/resources/aoba.mixins.json index ddfb2460..f777748a 100644 --- a/src/main/resources/aoba.mixins.json +++ b/src/main/resources/aoba.mixins.json @@ -11,34 +11,38 @@ ], "client": [ "AbstractBlockStateMixin", + "AbstractClientPlayerEntityMixin", "AbstractSignEditScreenMixin", + "BackgroundRendererMixin", "BlockMixin", "BlockModelRendererMixin", "CactusBlockMixin", - "ChatScreenMixin", "ChatHudMixin", "ChatInputSuggestorMixin", + "ChatScreenMixin", + "ChunkOcclusionDataBuilderMixin", + "ClientConnectionMixin", "ClientPlayerEntityMixin", "ClientPlayerInteractionManagerMixin", - "ClientConnectionMixin", "DeathScreenMixin", "EntityMixin", + "EntityRendererMixin", "FluidBlockMixin", "GameRendererMixin", + "HungerManagerMixin", "IngameHudMixin", "KeyboardMixin", + "LightmapTextureManagerMixin", + "LivingEntityMixin", + "MinecraftClientMixin", "MouseMixin", "MultiplayerScreenMixin", + "PlayerEntityMixin", "RenderTickCounterMixin", - "SimpleOptionMixin", - "WorldRendererMixin", - "MinecraftClientMixin", "ScreenMixin", - "BackgroundRendererMixin", - "LightmapTextureManagerMixin", - "EntityRendererMixin", + "SimpleOptionMixin", "TitleScreenMixin", - "PlayerEntityMixin" + "WorldRendererMixin" ], "injectors": { "defaultRequire": 1