diff --git a/src/main/java/net/aoba/AobaClient.java b/src/main/java/net/aoba/AobaClient.java index b9803f0..7507d01 100644 --- a/src/main/java/net/aoba/AobaClient.java +++ b/src/main/java/net/aoba/AobaClient.java @@ -56,7 +56,7 @@ public class AobaClient { public CommandManager commandManager; public AltManager altManager; public ProxyManager proxyManager; - public GuiManager hudManager; + public GuiManager guiManager; public FontManager fontManager; public CombatManager combatManager; public RPCManager rpcManager; @@ -112,8 +112,8 @@ public void loadAssets() { LogUtils.getLogger().info("[Aoba] Initializing Combat Manager"); combatManager = new CombatManager(); LogUtils.getLogger().info("[Aoba] Initializing GUI"); - hudManager = new GuiManager(); - hudManager.Initialize(); + guiManager = new GuiManager(); + guiManager.Initialize(); LogUtils.getLogger().info("[Aoba] Loading Alts"); altManager = new AltManager(); proxyManager = new ProxyManager(); diff --git a/src/main/java/net/aoba/cmd/commands/CmdClickgui.java b/src/main/java/net/aoba/cmd/commands/CmdClickgui.java index 6c5d388..02a7d98 100644 --- a/src/main/java/net/aoba/cmd/commands/CmdClickgui.java +++ b/src/main/java/net/aoba/cmd/commands/CmdClickgui.java @@ -36,10 +36,10 @@ public void runCommand(String[] parameters) throws InvalidSyntaxException { if (parameters.length != 2) throw new InvalidSyntaxException(this); char keybind = Character.toUpperCase(parameters[1].charAt(0)); - Aoba.getInstance().hudManager.clickGuiButton.setValue(InputUtil.fromKeyCode(keybind, 0)); + Aoba.getInstance().guiManager.clickGuiButton.setValue(InputUtil.fromKeyCode(keybind, 0)); break; case "open": - Aoba.getInstance().hudManager.setClickGuiOpen(true); + Aoba.getInstance().guiManager.setClickGuiOpen(true); break; default: throw new InvalidSyntaxException(this); diff --git a/src/main/java/net/aoba/gui/TextAlign.java b/src/main/java/net/aoba/gui/TextAlign.java new file mode 100644 index 0000000..98a6402 --- /dev/null +++ b/src/main/java/net/aoba/gui/TextAlign.java @@ -0,0 +1,7 @@ +package net.aoba.gui; + +public enum TextAlign { + Left, + Center, + Right +} diff --git a/src/main/java/net/aoba/gui/components/BlocksComponent.java b/src/main/java/net/aoba/gui/components/BlocksComponent.java index aed901a..e62e1b7 100644 --- a/src/main/java/net/aoba/gui/components/BlocksComponent.java +++ b/src/main/java/net/aoba/gui/components/BlocksComponent.java @@ -109,7 +109,7 @@ public void draw(DrawContext drawContext, float partialTicks) { @Override public void OnMouseScroll(MouseScrollEvent event) { - if (Aoba.getInstance().hudManager.isClickGuiOpen() && this.hovered) { + if (Aoba.getInstance().guiManager.isClickGuiOpen() && this.hovered) { if (event.GetVertical() > 0 && scroll > 0) { scroll--; } else if (event.GetVertical() < 0 && (scroll + visibleRows) < (Registries.BLOCK.size() / visibleColumns)) { diff --git a/src/main/java/net/aoba/gui/components/ColorPickerComponent.java b/src/main/java/net/aoba/gui/components/ColorPickerComponent.java index 2e3fe43..e7adbe8 100644 --- a/src/main/java/net/aoba/gui/components/ColorPickerComponent.java +++ b/src/main/java/net/aoba/gui/components/ColorPickerComponent.java @@ -126,7 +126,7 @@ public void onMouseMove(MouseMoveEvent event) { double mouseX = event.getX(); double mouseY = event.getY(); - if (Aoba.getInstance().hudManager.isClickGuiOpen() && this.isSliding) { + if (Aoba.getInstance().guiManager.isClickGuiOpen() && this.isSliding) { Color colorToModify = color.getValue(); float vertical = (float) Math.min(Math.max(1.0f - (((mouseY - (actualY + 59)) - 1) / (actualHeight - 63)), 0.0f), 1.0f); diff --git a/src/main/java/net/aoba/gui/components/Component.java b/src/main/java/net/aoba/gui/components/Component.java index 45510d1..67fc794 100644 --- a/src/main/java/net/aoba/gui/components/Component.java +++ b/src/main/java/net/aoba/gui/components/Component.java @@ -309,7 +309,7 @@ public void onMouseMove(MouseMoveEvent mouseMoveEvent) { } boolean wasHovered = hovered; - if (mouseMoveEvent.isCancelled() || !visible || !Aoba.getInstance().hudManager.isClickGuiOpen()) { + if (mouseMoveEvent.isCancelled() || !visible || !Aoba.getInstance().guiManager.isClickGuiOpen()) { this.hovered = false; if(wasHovered){ GuiManager.setTooltip(null); diff --git a/src/main/java/net/aoba/gui/components/HudComponent.java b/src/main/java/net/aoba/gui/components/HudComponent.java index 9c07d10..3d53d3b 100644 --- a/src/main/java/net/aoba/gui/components/HudComponent.java +++ b/src/main/java/net/aoba/gui/components/HudComponent.java @@ -70,7 +70,7 @@ public void onMouseClick(MouseClickEvent event) { if (event.button == MouseButton.LEFT && event.action == MouseAction.DOWN) { if (this.hovered) { boolean visibility = hud.activated.getValue(); - Aoba.getInstance().hudManager.SetHudActive(hud, !visibility); + Aoba.getInstance().guiManager.SetHudActive(hud, !visibility); } } } diff --git a/src/main/java/net/aoba/gui/components/ModuleComponent.java b/src/main/java/net/aoba/gui/components/ModuleComponent.java index aa3e4fc..aee3fa5 100644 --- a/src/main/java/net/aoba/gui/components/ModuleComponent.java +++ b/src/main/java/net/aoba/gui/components/ModuleComponent.java @@ -150,10 +150,10 @@ public void onMouseClick(MouseClickEvent event) { lastSettingsTab.setOnClose(() -> {spinning = false;}); lastSettingsTab.setVisible(true); - Aoba.getInstance().hudManager.AddWindow(lastSettingsTab, "Modules"); + Aoba.getInstance().guiManager.AddWindow(lastSettingsTab, "Modules"); spinning = true; } else { - Aoba.getInstance().hudManager.RemoveWindow(lastSettingsTab, "Modules"); + Aoba.getInstance().guiManager.RemoveWindow(lastSettingsTab, "Modules"); spinning = false; lastSettingsTab = null; } diff --git a/src/main/java/net/aoba/gui/components/ScrollComponent.java b/src/main/java/net/aoba/gui/components/ScrollComponent.java index 27f17ec..e090a60 100644 --- a/src/main/java/net/aoba/gui/components/ScrollComponent.java +++ b/src/main/java/net/aoba/gui/components/ScrollComponent.java @@ -79,7 +79,7 @@ public void RecalculateHeight() { @Override public void OnMouseScroll(MouseScrollEvent event) { - if (Aoba.getInstance().hudManager.isClickGuiOpen() && this.hovered) { + if (Aoba.getInstance().guiManager.isClickGuiOpen() && this.hovered) { int childCount = children.size(); if (event.GetVertical() > 0 && scroll > 0) { scroll--; diff --git a/src/main/java/net/aoba/gui/components/SliderComponent.java b/src/main/java/net/aoba/gui/components/SliderComponent.java index 9a8f220..1ae63ed 100644 --- a/src/main/java/net/aoba/gui/components/SliderComponent.java +++ b/src/main/java/net/aoba/gui/components/SliderComponent.java @@ -107,7 +107,7 @@ public void onMouseClick(MouseClickEvent event) { public void onMouseMove(MouseMoveEvent event) { super.onMouseMove(event); - if (Aoba.getInstance().hudManager.isClickGuiOpen() && this.isSliding) { + if (Aoba.getInstance().guiManager.isClickGuiOpen() && this.isSliding) { double mouseX = event.getX(); float actualX = this.getActualSize().getX(); diff --git a/src/main/java/net/aoba/gui/components/StringComponent.java b/src/main/java/net/aoba/gui/components/StringComponent.java index 23d8a53..14289ea 100644 --- a/src/main/java/net/aoba/gui/components/StringComponent.java +++ b/src/main/java/net/aoba/gui/components/StringComponent.java @@ -23,6 +23,7 @@ import net.aoba.event.listeners.FontChangedListener; import net.aoba.gui.IGuiElement; import net.aoba.gui.Margin; +import net.aoba.gui.TextAlign; import net.aoba.gui.colors.Color; import net.aoba.gui.colors.Colors; import net.aoba.utils.render.Render2D; @@ -33,6 +34,7 @@ import java.util.ArrayList; public class StringComponent extends Component implements FontChangedListener { + private TextAlign textAlign = TextAlign.Left; private String originalText; private ArrayList text = new ArrayList(); private boolean bold; @@ -69,16 +71,32 @@ public StringComponent(String text, IGuiElement parent, Color color, boolean bol public void draw(DrawContext drawContext, float partialTicks) { float actualX = this.getActualSize().getX(); float actualY = this.getActualSize().getY(); + float actualWidth = this.getActualSize().getWidth(); + int i = 5; for (String str : text) { if (bold) str = Formatting.BOLD + str; - Render2D.drawString(drawContext, str, actualX, actualY + i, this.color.getColorAsInt()); + + switch(textAlign) { + case TextAlign.Left: + Render2D.drawString(drawContext, str, actualX, actualY + i, this.color.getColorAsInt()); + break; + case TextAlign.Center: + float xPosCenter = actualX + (actualWidth / 2.0f) - Render2D.getStringWidth(str); + Render2D.drawString(drawContext, str, xPosCenter, actualY + i, this.color.getColorAsInt()); + break; + case TextAlign.Right: + float xPosRight = actualX + actualWidth - (Render2D.getStringWidth(str) * 2); + Render2D.drawString(drawContext, str, xPosRight, actualY + i, this.color.getColorAsInt()); + break; + } + i += 25; } } - + /** * Sets the text of the String Component. * @@ -133,6 +151,14 @@ public void setText(String text) { } } } + + public TextAlign getTextAlign() { + return this.textAlign; + } + + public void setTextAlign(TextAlign textAlign) { + this.textAlign = textAlign; + } /** * Gets the text of the String Component. diff --git a/src/main/java/net/aoba/gui/navigation/HudWindow.java b/src/main/java/net/aoba/gui/navigation/HudWindow.java index 52a5826..e938377 100644 --- a/src/main/java/net/aoba/gui/navigation/HudWindow.java +++ b/src/main/java/net/aoba/gui/navigation/HudWindow.java @@ -25,7 +25,7 @@ public HudWindow(String ID, float x, float y, float width, float height) { } private void onActivatedChanged(Boolean state) { - Aoba.getInstance().hudManager.SetHudActive(this, state.booleanValue()); + Aoba.getInstance().guiManager.SetHudActive(this, state.booleanValue()); } @Override @@ -37,7 +37,10 @@ public boolean getVisible() { // Override to do nothing.. We want it to be visible based off of whether it is activated. @Override public void setVisible(boolean state) { - + if(!state) { + isMouseOver = false; + isMoving = false; + } } @Override @@ -56,7 +59,7 @@ public void draw(DrawContext drawContext, float partialTicks) { GuiManager.roundingRadius.getValue(), dragColor); } } - if(isMouseOver) { + if(Aoba.getInstance().guiManager.isClickGuiOpen() && isMouseOver) { Render2D.drawRoundedBoxOutline(drawContext.getMatrices().peek().getPositionMatrix(), x, y, width, height, GuiManager.roundingRadius.getValue(), hoverColor); } diff --git a/src/main/java/net/aoba/gui/navigation/NavigationBar.java b/src/main/java/net/aoba/gui/navigation/NavigationBar.java index 68fd495..bf647ba 100644 --- a/src/main/java/net/aoba/gui/navigation/NavigationBar.java +++ b/src/main/java/net/aoba/gui/navigation/NavigationBar.java @@ -119,7 +119,7 @@ public void OnMouseClick(MouseClickEvent event) { int centerX = (window.getWidth() / 2); int x = centerX - (width / 2); - if (aoba.hudManager.isClickGuiOpen()) { + if (aoba.guiManager.isClickGuiOpen()) { if (mouseX >= (x) && mouseX <= (x + width)) { if (mouseY >= (25) && mouseY <= (50)) { int mouseXInt = (int) mouseX; diff --git a/src/main/java/net/aoba/gui/navigation/Page.java b/src/main/java/net/aoba/gui/navigation/Page.java index eaba5c1..6ade6eb 100644 --- a/src/main/java/net/aoba/gui/navigation/Page.java +++ b/src/main/java/net/aoba/gui/navigation/Page.java @@ -98,14 +98,14 @@ public void moveToFront(Window window) { @Override public void OnMouseMove(MouseMoveEvent mouseMoveEvent) { - if(Aoba.getInstance().hudManager.isClickGuiOpen()) { + if(Aoba.getInstance().guiManager.isClickGuiOpen()) { tabs.reversed().stream().collect(Collectors.toList()).forEach(s -> s.onMouseMove(mouseMoveEvent)); } } @Override public void OnMouseClick(MouseClickEvent mouseClickEvent) { - if(Aoba.getInstance().hudManager.isClickGuiOpen()) { + if(Aoba.getInstance().guiManager.isClickGuiOpen()) { tabs.reversed().stream().collect(Collectors.toList()).forEach(s -> s.OnMouseClick(mouseClickEvent)); } } diff --git a/src/main/java/net/aoba/gui/navigation/Window.java b/src/main/java/net/aoba/gui/navigation/Window.java index 3b58237..b513279 100644 --- a/src/main/java/net/aoba/gui/navigation/Window.java +++ b/src/main/java/net/aoba/gui/navigation/Window.java @@ -19,6 +19,7 @@ package net.aoba.gui.navigation; import net.aoba.Aoba; +import net.aoba.AobaClient; import net.aoba.event.events.MouseClickEvent; import net.aoba.event.events.MouseMoveEvent; import net.aoba.gui.Direction; @@ -43,7 +44,8 @@ public class Window implements IGuiElement { protected static MinecraftClient MC = MinecraftClient.getInstance(); - + protected static AobaClient AOBA = Aoba.getInstance(); + protected String ID; protected String title; protected Page parent; diff --git a/src/main/java/net/aoba/gui/navigation/huds/ModuleArrayListHud.java b/src/main/java/net/aoba/gui/navigation/huds/ModuleArrayListHud.java index c68831b..17434b4 100644 --- a/src/main/java/net/aoba/gui/navigation/huds/ModuleArrayListHud.java +++ b/src/main/java/net/aoba/gui/navigation/huds/ModuleArrayListHud.java @@ -2,59 +2,112 @@ import net.aoba.Aoba; import net.aoba.AobaClient; +import net.aoba.event.events.MouseClickEvent; import net.aoba.gui.GuiManager; import net.aoba.gui.Rectangle; import net.aoba.gui.navigation.HudWindow; import net.aoba.module.Module; +import net.aoba.settings.SettingManager; +import net.aoba.settings.types.EnumSetting; import net.aoba.utils.render.Render2D; +import net.aoba.utils.types.MouseAction; +import net.aoba.utils.types.MouseButton; import net.minecraft.client.gui.DrawContext; import java.util.Comparator; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Stream; -public class ModuleArrayListHud extends HudWindow { - public ModuleArrayListHud(int x, int y) { - super("ModuleArrayListHud", x, y, 0, 0); - resizeable = false; - } - - @Override - public void draw(DrawContext drawContext, float partialTicks) { - if (getVisible()) { - Rectangle pos = position.getValue(); - - if (pos.isDrawable()) { - AobaClient aoba = Aoba.getInstance(); - final int[] iteration = {0}; +import net.aoba.gui.TextAlign; - int maxWidth = 0; - int totalHeight = 0; - - for (Module mod : aoba.moduleManager.modules) { - if (mod.getState()) { - int textWidth = MC.textRenderer.getWidth(mod.getName()); - maxWidth = Math.max(maxWidth, textWidth); - totalHeight += 20; - } - } +public class ModuleArrayListHud extends HudWindow { + private EnumSetting textAlign = new EnumSetting("ModuleArrayListHudText_TextAlign", "Text Align", "Text Alignment", TextAlign.Left); + + public ModuleArrayListHud(int x, int y) { + super("ModuleArrayListHud", x, y, 0, 0); + resizeable = false; + + SettingManager.registerSetting(textAlign, Aoba.getInstance().settingManager.configContainer); + + // Calculate max possible width. + float newWidth = 0; + for(Module mod : AOBA.moduleManager.modules) { + float nameWidth = Render2D.getStringWidth(mod.getName()); + if(nameWidth > newWidth) + newWidth = nameWidth; + } + + this.setWidth(newWidth); + } + + @Override + public void OnMouseClick(MouseClickEvent event) { + super.OnMouseClick(event); + + if(this.isMouseOver && event.button == MouseButton.RIGHT && event.action == MouseAction.DOWN) { + TextAlign currentValue = textAlign.getValue(); + TextAlign[] enumConstants = currentValue.getDeclaringClass().getEnumConstants(); + int currentIndex = java.util.Arrays.asList(enumConstants).indexOf(currentValue); + int enumCount = enumConstants.length; + currentIndex = (currentIndex + 1) % enumCount; + + textAlign.setValue(enumConstants[currentIndex]); + } + } - this.setWidth(maxWidth * 2 + 10); - this.setHeight(totalHeight + 10); + @Override + public void update() { + super.update(); + int totalHeight = 0; + for (Module mod : AOBA.moduleManager.modules) { + if (mod.getState()) { + totalHeight += 20; + } + } + this.setHeight(totalHeight + 10); + } + + @Override + public void draw(DrawContext drawContext, float partialTicks) { + if (getVisible()) { + Rectangle pos = position.getValue(); - aoba.moduleManager.modules.stream() - .filter(Module::getState) - .sorted(Comparator.comparingInt(mod -> -MC.textRenderer.getWidth(mod.getName()))) - .forEachOrdered(mod -> { - int textWidth = MC.textRenderer.getWidth(mod.getName()); - int centeredX = (int) (pos.getX().intValue() + (pos.getWidth() - textWidth) / 2) - 18; - int yPosition = pos.getY().intValue() + 10 + (iteration[0] * 20); + if (pos.isDrawable()) { + AtomicInteger iteration = new AtomicInteger(0); + Stream moduleStream = AOBA.moduleManager.modules.stream().filter(Module::getState) + .sorted(Comparator.comparing((mod) -> ((Module)mod).getName())); + + switch(textAlign.getValue()) { + case TextAlign.Left: + moduleStream.forEachOrdered(mod -> { + float yPosition = pos.getY().floatValue() + 10 + (iteration.get() * 20); + Render2D.drawString(drawContext, mod.getName(), pos.getX(), yPosition, + GuiManager.foregroundColor.getValue().getColorAsInt()); + iteration.incrementAndGet(); + }); + break; + case TextAlign.Center: + moduleStream.forEachOrdered(mod -> { + float yPosition = pos.getY().floatValue() + 10 + (iteration.get() * 20); + float centerTextWidth = Render2D.getStringWidth(mod.getName()); + Render2D.drawString(drawContext, mod.getName(), pos.getX() + (pos.getWidth() / 2.0f) - centerTextWidth, yPosition, + GuiManager.foregroundColor.getValue().getColorAsInt()); + iteration.incrementAndGet(); + }); + break; + case TextAlign.Right: + moduleStream.forEachOrdered(mod -> { + float yPosition = pos.getY().floatValue() + 10 + (iteration.get() * 20); + float rightTextWidth = Render2D.getStringWidth(mod.getName()) * 2; + Render2D.drawString(drawContext, mod.getName(), pos.getX() + pos.getWidth() - rightTextWidth, yPosition, + GuiManager.foregroundColor.getValue().getColorAsInt()); + iteration.incrementAndGet(); + }); + break; + } + + } + } - Render2D.drawString(drawContext, mod.getName(), - (float) centeredX, - (float) yPosition, GuiManager.foregroundColor.getValue().getColorAsInt()); - iteration[0]++; - }); - } - } - - super.draw(drawContext, partialTicks); - } + super.draw(drawContext, partialTicks); + } } diff --git a/src/main/java/net/aoba/gui/navigation/windows/HudOptionsTab.java b/src/main/java/net/aoba/gui/navigation/windows/HudOptionsTab.java index f7e0b0d..3b706e2 100644 --- a/src/main/java/net/aoba/gui/navigation/windows/HudOptionsTab.java +++ b/src/main/java/net/aoba/gui/navigation/windows/HudOptionsTab.java @@ -47,7 +47,7 @@ public HudOptionsTab() { // Keybinds Header stackPanel.addChild(new StringComponent("Keybinds", stackPanel, GuiManager.foregroundColor.getValue(), true)); - KeybindComponent clickGuiKeybindComponent = new KeybindComponent(stackPanel, Aoba.getInstance().hudManager.clickGuiButton); + KeybindComponent clickGuiKeybindComponent = new KeybindComponent(stackPanel, Aoba.getInstance().guiManager.clickGuiButton); clickGuiKeybindComponent.setSize(new Rectangle(null, null, null, 30f)); stackPanel.addChild(clickGuiKeybindComponent); diff --git a/src/main/java/net/aoba/gui/navigation/windows/HudsTab.java b/src/main/java/net/aoba/gui/navigation/windows/HudsTab.java index 8510c42..0aebcf0 100644 --- a/src/main/java/net/aoba/gui/navigation/windows/HudsTab.java +++ b/src/main/java/net/aoba/gui/navigation/windows/HudsTab.java @@ -57,7 +57,7 @@ public HudsTab(HudWindow[] abstractHuds) { // Keybinds Header stackPanel.addChild(new StringComponent("Keybinds", stackPanel, GuiManager.foregroundColor.getValue(), true)); - KeybindComponent clickGuiKeybindComponent = new KeybindComponent(stackPanel, Aoba.getInstance().hudManager.clickGuiButton); + KeybindComponent clickGuiKeybindComponent = new KeybindComponent(stackPanel, Aoba.getInstance().guiManager.clickGuiButton); clickGuiKeybindComponent.setSize(new Rectangle(null, null, null, 30f)); stackPanel.addChild(clickGuiKeybindComponent); diff --git a/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java b/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java index 7cd9019..1da6b7a 100644 --- a/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/net/aoba/mixin/ClientPlayerEntityMixin.java @@ -45,7 +45,7 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity @Inject(at = {@At("HEAD")}, method = "setShowsDeathScreen(Z)V") private void onShowDeathScreen(boolean state, CallbackInfo ci) { - GuiManager hudManager = Aoba.getInstance().hudManager; + GuiManager hudManager = Aoba.getInstance().guiManager; if (state && hudManager.isClickGuiOpen()) { hudManager.setClickGuiOpen(false); diff --git a/src/main/java/net/aoba/mixin/DeathScreenMixin.java b/src/main/java/net/aoba/mixin/DeathScreenMixin.java index 524e9ba..09915f0 100644 --- a/src/main/java/net/aoba/mixin/DeathScreenMixin.java +++ b/src/main/java/net/aoba/mixin/DeathScreenMixin.java @@ -32,7 +32,7 @@ public class DeathScreenMixin { @Inject(at = {@At("HEAD")}, method = "init()V", cancellable = true) private void onInit(CallbackInfo ci) { - GuiManager hudManager = Aoba.getInstance().hudManager; + GuiManager hudManager = Aoba.getInstance().guiManager; if (hudManager.isClickGuiOpen()) { hudManager.setClickGuiOpen(false); } diff --git a/src/main/java/net/aoba/mixin/IngameHudMixin.java b/src/main/java/net/aoba/mixin/IngameHudMixin.java index 348f98c..9c091c8 100644 --- a/src/main/java/net/aoba/mixin/IngameHudMixin.java +++ b/src/main/java/net/aoba/mixin/IngameHudMixin.java @@ -70,7 +70,7 @@ private void onRenderPortalOverlay(DrawContext context, float nauseaStrength, Ca @Inject(method = "renderCrosshair", at = @At("HEAD"), cancellable = true) private void onRenderCrosshair(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { - if(Aoba.getInstance().hudManager.isClickGuiOpen()) { + if(Aoba.getInstance().guiManager.isClickGuiOpen()) { ci.cancel(); return; } diff --git a/src/main/java/net/aoba/mixin/MinecraftClientMixin.java b/src/main/java/net/aoba/mixin/MinecraftClientMixin.java index 6a0cf32..fe2f9d1 100644 --- a/src/main/java/net/aoba/mixin/MinecraftClientMixin.java +++ b/src/main/java/net/aoba/mixin/MinecraftClientMixin.java @@ -106,8 +106,8 @@ private void onClose(CallbackInfo ci) { private void onOpenPauseMenu(boolean pause, CallbackInfo ci) { AobaClient aoba = Aoba.getInstance(); - if (aoba.hudManager != null) { - Aoba.getInstance().hudManager.setClickGuiOpen(false); + if (aoba.guiManager != null) { + Aoba.getInstance().guiManager.setClickGuiOpen(false); } } diff --git a/src/main/java/net/aoba/mixin/MouseMixin.java b/src/main/java/net/aoba/mixin/MouseMixin.java index 5b59dfb..7807577 100644 --- a/src/main/java/net/aoba/mixin/MouseMixin.java +++ b/src/main/java/net/aoba/mixin/MouseMixin.java @@ -72,7 +72,7 @@ private void onMouseButton(long window, int button, int action, int mods, Callba aoba.eventManager.Fire(event); - if (aoba.hudManager.isClickGuiOpen()) { + if (aoba.guiManager.isClickGuiOpen()) { ci.cancel(); } } @@ -94,8 +94,8 @@ private void onMouseScroll(long window, double horizontal, double vertical, Call @Inject(at = {@At("HEAD")}, method = {"lockCursor()V"}, cancellable = true) private void onLockCursor(CallbackInfo ci) { AobaClient aoba = Aoba.getInstance(); - if(aoba != null && aoba.hudManager != null) { - if (aoba.hudManager.isClickGuiOpen()) + if(aoba != null && aoba.guiManager != null) { + if (aoba.guiManager.isClickGuiOpen()) ci.cancel(); } }