Implement command and keybind systems with UI redesign #2
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
6b6t/AnarchyClient!2
Loading…
Reference in a new issue
No description provided.
Delete branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
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:
HudLayoutpersistence and migrated multiple HUD modules to use it for positioning.Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
HudLayout+ editor suppression guard.panelAt) from legacy corner anchoring.HudLayout(removes per-module corner/offset settings).HudLayout+ editor suppression guard.HudLayout+ editor suppression guard./acsubcommands for prefix suggestions/execution./ac prefixcommand and fixes coordinate formatting.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -0,0 +57,4 @@// ClientSuggestionProvider, so sharing them across the erased type is safe.mirror.getRoot().addChild((CommandNode<ClientSuggestionProvider>) (CommandNode<?>) child);}}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();}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;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.
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;}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.
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.
@ -0,0 +57,4 @@// ClientSuggestionProvider, so sharing them across the erased type is safe.mirror.getRoot().addChild((CommandNode<ClientSuggestionProvider>) (CommandNode<?>) child);}}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.