Implement command and keybind systems with UI redesign #2

Merged
Magnus-Krill merged 6 commits from main into main 2026-07-23 21:56:18 +00:00
Magnus-Krill commented 2026-07-21 21:26:10 +00:00 (Migrated from github.com)

I added a Keybind system, A notification on toggle system, a command system (the /ac is still there but it mirrors other clients with a prefix now) and i added a hud editor. Also verified some more modules that they work. still not finished yet tho

I added a Keybind system, A notification on toggle system, a command system (the /ac is still there but it mirrors other clients with a prefix now) and i added a hud editor. Also verified some more modules that they work. still not finished yet tho
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-07-21 21:59:37 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR expands AnarchyClient’s client-side UX by adding a configurable command-prefix system (Meteor-style), module keybind capture in the UI, toggle notifications (popup/chat), and a drag-and-drop HUD editor backed by a persisted HUD layout store.

Changes:

  • Added a HUD editor screen + HudLayout persistence and migrated multiple HUD modules to use it for positioning.
  • Added a client command prefix system with chat interception + vanilla suggestion reuse via mixins.
  • Added module keybind capture UI and toggle-notification settings/theme syncing.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/test/java/net/blockhost/anarchyclient/ui/HudEditorScreenTest.java Adds unit tests for HUD editor snap behavior.
src/main/resources/anarchyclient.mixins.json Registers new chat/suggestions mixins for prefix commands.
src/main/java/net/blockhost/anarchyclient/ui/ModulePanel.java Adds keybind capture row, HUD editor entry point, and notification/command-prefix UI options.
src/main/java/net/blockhost/anarchyclient/ui/HudLayout.java Introduces persisted HUD element position store + bounds tracking for the editor.
src/main/java/net/blockhost/anarchyclient/ui/HudEditorScreen.java Implements the in-world HUD drag editor and snapping logic.
src/main/java/net/blockhost/anarchyclient/ui/GlassTheme.java Syncs theme tokens to toggle-notification rendering.
src/main/java/net/blockhost/anarchyclient/ui/AnarchyClientScreen.java Routes key presses to module keybind capture instead of closing the menu.
src/main/java/net/blockhost/anarchyclient/notification/ToggleNotifications.java Adds popup/chat toggle notifications with themed rendering + persistence hooks.
src/main/java/net/blockhost/anarchyclient/module/ModuleManager.java Emits toggle notifications on module enable/disable.
src/main/java/net/blockhost/anarchyclient/module/impl/RadarHudModule.java Migrates radar HUD positioning to HudLayout + editor suppression guard.
src/main/java/net/blockhost/anarchyclient/module/impl/HudText.java Splits size calculation and absolute-position rendering (panelAt) from legacy corner anchoring.
src/main/java/net/blockhost/anarchyclient/module/impl/HudElementModule.java Migrates base HUD element positioning to HudLayout (removes per-module corner/offset settings).
src/main/java/net/blockhost/anarchyclient/module/impl/CoordinatesHudModule.java Migrates positioning to HudLayout + editor suppression guard.
src/main/java/net/blockhost/anarchyclient/module/impl/ActiveModulesHudModule.java Migrates positioning to HudLayout + editor suppression guard.
src/main/java/net/blockhost/anarchyclient/mixin/CommandSuggestionsMixin.java Reuses vanilla suggestion popup for prefix commands by rewriting input and swapping dispatchers.
src/main/java/net/blockhost/anarchyclient/mixin/ChatScreenMixin.java Intercepts prefix chat lines and runs them via the client dispatcher instead of sending to server.
src/main/java/net/blockhost/anarchyclient/config/ClientConfig.java Persists command prefix + toggle-notification settings in UI config.
src/main/java/net/blockhost/anarchyclient/command/CommandPrefix.java Adds runtime/persisted single-char command prefix state + cycling.
src/main/java/net/blockhost/anarchyclient/command/ClientCommands.java Mirrors /ac subcommands for prefix suggestions/execution.
src/main/java/net/blockhost/anarchyclient/command/AnarchyClientCommands.java Adds /ac prefix command and fixes coordinate formatting.
src/main/java/net/blockhost/anarchyclient/AnarchyClient.java Loads HUD layout and renders toggle notifications in the HUD render hook.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This PR expands AnarchyClient’s client-side UX by adding a configurable command-prefix system (Meteor-style), module keybind capture in the UI, toggle notifications (popup/chat), and a drag-and-drop HUD editor backed by a persisted HUD layout store. **Changes:** - Added a HUD editor screen + `HudLayout` persistence and migrated multiple HUD modules to use it for positioning. - Added a client command prefix system with chat interception + vanilla suggestion reuse via mixins. - Added module keybind capture UI and toggle-notification settings/theme syncing. ### Reviewed changes Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | src/test/java/net/blockhost/anarchyclient/ui/HudEditorScreenTest.java | Adds unit tests for HUD editor snap behavior. | | src/main/resources/anarchyclient.mixins.json | Registers new chat/suggestions mixins for prefix commands. | | src/main/java/net/blockhost/anarchyclient/ui/ModulePanel.java | Adds keybind capture row, HUD editor entry point, and notification/command-prefix UI options. | | src/main/java/net/blockhost/anarchyclient/ui/HudLayout.java | Introduces persisted HUD element position store + bounds tracking for the editor. | | src/main/java/net/blockhost/anarchyclient/ui/HudEditorScreen.java | Implements the in-world HUD drag editor and snapping logic. | | src/main/java/net/blockhost/anarchyclient/ui/GlassTheme.java | Syncs theme tokens to toggle-notification rendering. | | src/main/java/net/blockhost/anarchyclient/ui/AnarchyClientScreen.java | Routes key presses to module keybind capture instead of closing the menu. | | src/main/java/net/blockhost/anarchyclient/notification/ToggleNotifications.java | Adds popup/chat toggle notifications with themed rendering + persistence hooks. | | src/main/java/net/blockhost/anarchyclient/module/ModuleManager.java | Emits toggle notifications on module enable/disable. | | src/main/java/net/blockhost/anarchyclient/module/impl/RadarHudModule.java | Migrates radar HUD positioning to `HudLayout` + editor suppression guard. | | src/main/java/net/blockhost/anarchyclient/module/impl/HudText.java | Splits size calculation and absolute-position rendering (`panelAt`) from legacy corner anchoring. | | src/main/java/net/blockhost/anarchyclient/module/impl/HudElementModule.java | Migrates base HUD element positioning to `HudLayout` (removes per-module corner/offset settings). | | src/main/java/net/blockhost/anarchyclient/module/impl/CoordinatesHudModule.java | Migrates positioning to `HudLayout` + editor suppression guard. | | src/main/java/net/blockhost/anarchyclient/module/impl/ActiveModulesHudModule.java | Migrates positioning to `HudLayout` + editor suppression guard. | | src/main/java/net/blockhost/anarchyclient/mixin/CommandSuggestionsMixin.java | Reuses vanilla suggestion popup for prefix commands by rewriting input and swapping dispatchers. | | src/main/java/net/blockhost/anarchyclient/mixin/ChatScreenMixin.java | Intercepts prefix chat lines and runs them via the client dispatcher instead of sending to server. | | src/main/java/net/blockhost/anarchyclient/config/ClientConfig.java | Persists command prefix + toggle-notification settings in UI config. | | src/main/java/net/blockhost/anarchyclient/command/CommandPrefix.java | Adds runtime/persisted single-char command prefix state + cycling. | | src/main/java/net/blockhost/anarchyclient/command/ClientCommands.java | Mirrors `/ac` subcommands for prefix suggestions/execution. | | src/main/java/net/blockhost/anarchyclient/command/AnarchyClientCommands.java | Adds `/ac prefix` command and fixes coordinate formatting. | | src/main/java/net/blockhost/anarchyclient/AnarchyClient.java | Loads HUD layout and renders toggle notifications in the HUD render hook. | </details> --- 💡 <a href="/6b6t/AnarchyClient/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -0,0 +57,4 @@
// ClientSuggestionProvider, so sharing them across the erased type is safe.
mirror.getRoot().addChild((CommandNode<ClientSuggestionProvider>) (CommandNode<?>) child);
}
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-07-21 21:59:35 +00:00

ClientCommands.dispatcher() reuses Brigadier CommandNode instances from the active /anarchyclient tree and attaches them under a new dispatcher root. Brigadier's addChild() reparents nodes (mutates the child's parent), so this will modify the live Fabric dispatcher and can break /ac execution/suggestions (and any other code relying on the original tree). Build a mirror tree using new node instances (deep copy via builders) or change the prefix suggestion approach so it doesn’t attach existing nodes to a second dispatcher.

ClientCommands.dispatcher() reuses Brigadier CommandNode instances from the active /anarchyclient tree and attaches them under a new dispatcher root. Brigadier's addChild() reparents nodes (mutates the child's parent), so this will modify the live Fabric dispatcher and can break /ac execution/suggestions (and any other code relying on the original tree). Build a mirror tree using new node instances (deep copy via builders) or change the prefix suggestion approach so it doesn’t attach existing nodes to a second dispatcher.
@ -0,0 +38,4 @@
}
ClientCommands.execute(client.getConnection(), normalized.substring(1).trim());
info.cancel();
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-07-21 21:59:37 +00:00

ChatScreenMixin cancels handleChatInput at HEAD for prefix commands, which also skips vanilla side effects like closing the chat screen (and potentially recent-message history handling). This leaves the chat UI open after running a client command. Consider invoking the same close/history logic vanilla would run after handling input, even when the send is cancelled.

ChatScreenMixin cancels handleChatInput at HEAD for prefix commands, which also skips vanilla side effects like closing the chat screen (and potentially recent-message history handling). This leaves the chat UI open after running a client command. Consider invoking the same close/history logic vanilla would run after handling input, even when the send is cancelled.
@ -0,0 +1,242 @@
package net.blockhost.anarchyclient.ui;
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-07-21 21:59:36 +00:00

HudEditorScreen.snap() can return the 6px margin even when the element is wider/taller than the screen (because clamped becomes 0 and is within SNAP of MARGIN). That produces an out-of-bounds coordinate. If the element can’t fit on an axis (screen - size <= 0), snapping should return 0 on that axis.

HudEditorScreen.snap() can return the 6px margin even when the element is wider/taller than the screen (because clamped becomes 0 and is within SNAP of MARGIN). That produces an out-of-bounds coordinate. If the element can’t fit on an axis (screen - size <= 0), snapping should return 0 on that axis.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-07-21 21:59:36 +00:00

In mouseDragged(), if the dragged element is no longer present in HudLayout.elements() (e.g., it stopped rendering), elementById() returns null but the code continues with width/height=0 and still calls HudLayout.move(). That can unexpectedly overwrite the element’s stored position. Bail out when the element lookup fails.

In mouseDragged(), if the dragged element is no longer present in HudLayout.elements() (e.g., it stopped rendering), elementById() returns null but the code continues with width/height=0 and still calls HudLayout.move(). That can unexpectedly overwrite the element’s stored position. Bail out when the element lookup fails.
@ -0,0 +62,4 @@
} else {
x = defaultCorner.endsWith("Right") ? guiWidth - width - MARGIN : MARGIN;
y = defaultCorner.startsWith("Bottom") ? guiHeight - height - MARGIN : MARGIN;
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-07-21 21:59:36 +00:00

HudLayout.origin() clamps x/y only when the element already has a stored position. For the default placement path, x/y can become negative when width/height exceed the current gui size (e.g., long text HUD entries or small resolutions), which then records out-of-bounds positions and makes hit-testing/dragging awkward. Clamp the default-corner result as well.

HudLayout.origin() clamps x/y only when the element already has a stored position. For the default placement path, x/y can become negative when width/height exceed the current gui size (e.g., long text HUD entries or small resolutions), which then records out-of-bounds positions and makes hit-testing/dragging awkward. Clamp the default-corner result as well.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-07-21 21:59:37 +00:00

The Javadoc for handleKeybindCapture() says “Escape (or the menu key) clears the bind”, but the implementation only treats Escape specially. Either implement clearing on the menu key as well, or update the comment so it matches the actual behavior.

The Javadoc for handleKeybindCapture() says “Escape (or the menu key) clears the bind”, but the implementation only treats Escape specially. Either implement clearing on the menu key as well, or update the comment so it matches the actual behavior.
Magnus-Krill (Migrated from github.com) reviewed 2026-07-23 15:24:53 +00:00
@ -0,0 +57,4 @@
// ClientSuggestionProvider, so sharing them across the erased type is safe.
mirror.getRoot().addChild((CommandNode<ClientSuggestionProvider>) (CommandNode<?>) child);
}
}
Magnus-Krill (Migrated from github.com) commented 2026-07-23 15:24:53 +00:00

CommandNode has no parent field in Brigadier 1.3.10 — addChild only writes into the new root's children map, so the live /ac tree is unaffected. The one branch that does mutate a node (child.command = ...) is the name-collision merge, which can't trigger here: the mirror root starts empty and /ac's children already have unique names. Sharing node instances across the two dispatchers is safe; a deep copy would only add a tree rebuild on every world join.

CommandNode has no parent field in Brigadier 1.3.10 — addChild only writes into the new root's children map, so the live /ac tree is unaffected. The one branch that does mutate a node (child.command = ...) is the name-collision merge, which can't trigger here: the mirror root starts empty and /ac's children already have unique names. Sharing node instances across the two dispatchers is safe; a deep copy would only add a tree rebuild on every world join.
Sign in to join this conversation.
No description provided.