Skip to content

feat(client): add key bindings UI and settings serialization - #680

Merged
Purdze merged 10 commits into
PommeMC:masterfrom
ChronosWS:feat/key-bindings-action-mapping
Oct 12, 2026
Merged

Purdze merged 10 commits into
PommeMC:masterfrom
ChronosWS:feat/key-bindings-action-mapping

Conversation

@ChronosWS

@ChronosWS ChronosWS commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / code cleanup
  • Performance improvement
  • Chore / tooling
  • Documentation

Summary

Add a settings-backed Key Binds screen under Controls, with keyboard, mouse, and gamepad input catalogs, persistent bindings, and limited input capture.

  • Define stable action/input IDs, distinct translation IDs, named metadata, and translated display labels with English fallbacks.
  • Group bindings by category and sort by explicit category/action UI order, then localized action name. Display the first input for each action in a scrollable list.
  • Selecting a binding shows yellow chevrons and underlined text. The next eligible keyboard, mouse, or gamepad press replaces the entire input vector; Escape clears it without leaving the screen.
  • Save changes immediately to options.json. Missing actions retain defaults, saved arrays replace defaults, and empty arrays explicitly unbind an action. Defaults mirror the existing Pomme mappings.
  • Keep capture isolated from normal menu activation and global shortcuts; suppress captured keyboard repeats until release and end capture on screen changes or focus loss.
  • Ignore unmapped gamepad buttons during capture so duplicate digital trigger signals do not override mapped analog-trigger button presses.
  • Share styled button rendering and focus/click handling with ordinary buttons, retaining menu click sounds.
  • Organize input code into directory-style modules and document the Vulkan SDK environment setup for client builds.

Example settings:

"key_bindings": {
  "key.jump": ["key.keyboard.space", "key.gamepad.south"],
  "key.sneak": []
}

Scope: This PR implements the UI, catalogs, settings serialization, and capture only. Gameplay still uses the existing hardcoded mappings; edited bindings do not yet change gameplay controls. Runtime action resolution is a separate follow-up.

Deferred: Multi-binding editing (only the first is displayed; assignment replaces all), reset controls, conflict feedback, scrollbar thumb dragging, full Vanilla action reconciliation, and controller touchpad handling. Settings ownership remains on MainMenu pending a broader configuration refactor.

Reference

Checked against these classes in reference/26.3/decompiled:

  • net.minecraft.client.gui.screens.options.controls.ControlsScreen — navigation to Key Binds.
  • net.minecraft.client.gui.screens.options.controls.KeyBindsScreen — selected-binding capture and Escape-to-unbind.
  • net.minecraft.client.gui.screens.options.controls.KeyBindsList — category headings and selected-binding styling.
  • net.minecraft.client.KeyMapping, including Category — category/action ordering and localized-name tie breaking.
  • net.minecraft.client.Options — action IDs and default key declarations.
  • com.mojang.blaze3d.platform.InputConstants — physical-input naming.

Pomme retains its existing action/default differences and uses JSON arrays rather than Vanilla single-input options serialization. Full reconciliation is deferred.

Testing

  • just client-pre-pr — passed, including formatting, strict release Clippy for client/protocol/singleplayer, and tests: 783 client, 49 protocol, and 2 singleplayer tests (including the real-server test).
  • just launcher-pre-pr — passed.
  • Client tests with no default features — 783 passed.
  • git diff --check — passed.
  • Manually verified binding capture, persistence across restart, and mapped DualSense trigger capture.

Regression tests cover capture repeat suppression, mouse capture isolation, discarding cancelled capture input, replacing the entire binding vector without activating another widget, and Escape-to-unbind without screen navigation.

Cross-platform validation is covered by CI.

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request refactor labels Oct 11, 2026
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 11, 2026
@github-actions github-actions Bot removed the bug Something isn't working label Oct 11, 2026
@ChronosWS
ChronosWS marked this pull request as ready for review October 11, 2026 16:32
@Purdze
Purdze merged commit 4f2be46 into PommeMC:master Oct 12, 2026
10 checks passed
@Purdze Purdze mentioned this pull request Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants