feat: add interactive HUD editor screen with drag-and-drop positioning#38
Open
dsnsgithub wants to merge 15 commits into
Open
feat: add interactive HUD editor screen with drag-and-drop positioning#38dsnsgithub wants to merge 15 commits into
dsnsgithub wants to merge 15 commits into
Conversation
Press Right Shift (rebindable, Options > Controls > BetterHUD) to open a Lunar Client style editor that shows every enabled HUD element live: drag to place an element anywhere (with edge/center snapping), scroll to resize it, right-click to snap it back to its corner stack, Escape to save. No more typing coordinates or being limited to the four corners. - HudEditorScreen: the editor; saves via Config.serialize() on close. - HudLayout/HudRenderer: placement math and element drawing extracted from BetterHUDGUI so the editor preview and the real HUD share one code path. Also fixes the top-right stack ignoring element scale when computing its x offset. - Custom X/Y settings are doubles now (0-100%), so dragging is smooth; old integer config values still parse. - New 1.21.9 build variant (covers 1.21.9-1.21.11): 1.21.9 replaced the Screen mouse handler signatures with input event records, so the editor cannot be compiled once for 1.21.6-1.21.11. Follows the variant-split process from DEVELOPMENT.md; CI matrices pick it up from supported-versions.json automatically. - Client gametests now open the editor with the keybinding, drag the FPS element with simulated mouse input, and assert the dragged position lands in betterhud.properties. Verified locally end-to-end on 1.21.4, 1.21.6, 1.21.11, and 26.2. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Keeps the 1.21.6 variant's mc_dep cap at <1.21.9 (the new 1.21.9 variant covers 1.21.9-1.21.11) and adopts main's comment cleanup from #36. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
The Orientation / Custom Position / Custom X / Custom Y entries are gone from the settings screen; placement is edited only by dragging (their config keys remain as the persistence format). Mod Menu's configure button now opens the HUD editor directly, which gains a Settings button for the remaining Cloth Config options (toggles, colors, scale) and returns to its parent screen on close. Right-clicking an element docks it back into a corner, and right-clicking a docked element cycles it through the corners, replacing the orientation dropdown. The gametests now also cover right-click docking. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Renames the title to BetterHUD Editor and moves it, with the Settings button, to the center of the screen where HUD elements are least likely to be placed. Drops the ellipsis from the button label. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Opaque gray body with light/dark bevels and a border that turns white on hover, so it no longer resembles the translucent HUD element boxes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Uses vanilla's proportions scaled with the text: 20px-tall box with the label centered at (height - 8) / 2 and ~10px side padding. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Drops its text scale from 1.5x to 1.25x, keeping the classic button proportions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
The HUD editor is reachable via its keybinding and hosts the Settings button itself, so Mod Menu only contributes a configure button in its mod list. The Cloth Config screen builder moves out of the ModMenu entrypoint class into SettingsScreenBuilder so the editor never touches ModMenuApi, which only classloads when Mod Menu is installed. modmenu moves from depends to suggests in fabric.mod.json. Verified with the 26.2 launch test both with Mod Menu loaded and with it removed from the runtime mods. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Removed feature list and updated HUD editor instructions for clarity.
Strip class-level Javadoc, method docs, and inline comments that describe obvious behavior across the HUD editor, layout, renderer, settings, and Mod Menu integration.
Removed comments explaining the HUD editor test process and adjusted the code accordingly.
Position (top-left / top-right / bottom-left / bottom-right / custom) unites the old Orientation dropdown and hidden Custom Position flag. It shows as a dropdown in the settings screen so an element can be reset to a corner, and old configs migrate automatically. In the editor, dragging near a corner now snaps into that corner's dock slot (margin and stacking included, previewed live) in addition to the flush edge and center snaps, replacing the right-click gesture. Elements can no longer overlap: a drag onto another element is rejected and the element stays where it last fit, and scroll-resizing cannot grow an element into a neighbour. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
Takes the Position model over the pre-rework code the comment-cleanup commits touched, keeps the revised README and 3.0.0 version bump, and strips the rework's explanatory comments to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M8Paub79s9he93GZUGemX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
















Summary
This PR introduces a new interactive HUD editor screen that allows users to visually arrange HUD elements instead of manually editing configuration values. The editor is opened with Right Shift (rebindable) or from Mod Menu, and provides real-time drag-and-drop positioning, scaling via scroll wheel, snapping to screen edges, center lines, and corner dock slots, and overlap prevention. The old placement settings (Orientation, the hidden Custom Position flag, and manual X/Y entry) are replaced by a single Position setting per element. Mod Menu is now an optional dependency.
Screenshots
Captured by the client gametest on Minecraft 26.2 (a real production client driven by simulated input).
The editor, opened with Right Shift or from Mod Menu — every enabled element outlined, the title and beveled Settings button in the center of the screen (where HUD elements are least likely to be placed), hints at the bottom:
Dragging the FPS element out of the top-left stack (cyan outline while dragging, element info at the bottom; Ping takes over the vacated slot):
Key Changes
New
HudEditorScreenclass: A full-featured GUI screen implementing Lunar Client-style HUD editing with:Single
Positionsetting replaces Orientation + Custom Position: each element has one Position value —top-left,top-right,bottom-left,bottom-right, orcustom. It shows as a dropdown in the settings screen so an element can be reset to a corner; the raw Custom X/Y coordinates stay editor-managed and hidden. Old configs (bothOrientation/Custom Positionand the camelCase variants) migrate automatically, verified by a launch test with a planted legacy config.Mod Menu is now optional (
depends→suggests): the editor is reachable via its keybinding and hosts the Settings button itself. The Cloth screen builder lives inSettingsScreenBuilder, separate from theModMenuentrypoint class, soModMenuApiis never classloaded unless Mod Menu is installed. Verified by launch-testing with Mod Menu removed from the runtime mods.Extracted
HudLayoutandHudRendererutility classes: all positioning math and element drawing is shared between the in-game HUD and the editor, so the editor preview always matches the real HUD;BetterHUDGUIwas refactored on top of them.Updated
ModSettings/CustomText: placement is expressed by the single position value; Custom X/Y became doubles (0-100%) so dragging is smooth, and old integer config values still parse.Added keybinding: "Edit HUD Layout" (Right Shift) with proper category support across Minecraft versions.
Added localization: language strings for the editor UI (title, hints, scale display, Settings button).
Version-specific support: Added 1.21.9 variant to handle new
MouseButtonEvent/KeyEventinput signatures while maintaining compatibility with earlier versions.Enhanced game tests:
exerciseHudEditor()drives the real editor with simulated input — drags an element to a custom position, then drags it back into a corner to dock it — and asserts the config after each step.Implementation Details
GuiGraphics(pre-1.26) andGuiGraphicsExtractor(1.26+)https://claude.ai/code/session_016M8Paub79s9he93GZUGemX