Give Click Slot the three clicks a player actually makes - #80
Closed
Gaetarra wants to merge 1 commit into
Closed
Conversation
Click Slot always sent ClickType.PICKUP, so shift-clicking a stack into the other container or swapping it to the offhand with F had to be built out of Move Item or the raw packet fabricator in UI Utils. Both are more work than the click they stand in for, and neither matches what the server sees from a real player. Click Slot gains three modes, mapping to what the vanilla screen sends for the same input: Left Click is PICKUP and stays the default, Shift Click is QUICK_MOVE, and F is SWAP on button 40, the offhand's button index in AbstractContainerScreen. Two supporting changes, both consequences of a node gaining modes at all: - Click Slot is tagged RENDER_INLINE_PARAMETERS. NodeGraph.rendersInline Parameters gates the parameter strip and the mode selector is drawn inside it, so without the tag the modes would exist but not be selectable. The tag also makes the Slot number editable on the node, which it was not before: the node declared the parameter but rendered no field for it, so the only way to name a slot was to attach an Inventory Slot node to the Selection slot. - The Slot parameter moves from a type parameter to a mode parameter on each of the three modes. NodeCatalog.initializeParameters reads mode parameters instead of type parameters once a node has modes, so a mode without it would silently drop the value. Keeping the id and label identical is what lets presets saved before this restore their slot unchanged; they load with no mode and take the constructor default of CLICK_SLOT_LEFT, which is the click they were already sending. Mode display names get lang entries, since NodeMode.getDisplayName ignores the strings in the enum constructor and builds "pathmind.node.mode.<name>" as a translation key. Verified: Fabric compiles on 26.2 and NeoForge on 26.1.2. Not verified locally: :common:test and the 1.21.x targets, which need a JDK 21 toolchain; CI covers both, and NodeClickSlotTest pins the mode-to-click mapping and the parameter round-trip. The editor behaviour, in particular the mode selector and the now-visible Slot field, has not been clicked through in a dev client. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JNco3sHnsGRnCojqqhMZ53
Author
|
Closing this for now — I opened it before verifying the editor behaviour in a running client, and before matching the PR conventions in CONTRIBUTING.md. Reopening once it is actually tested and written up properly. Sorry for the noise. |
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.
Click Slot always sent
ClickType.PICKUP, so shift-clicking a stack into the other container or swapping it to the offhand with F had to be built out of Move Item or the raw packet fabricator in UI Utils. Both are more work than the click they stand in for, and neither matches what the server sees from a real player.Click Slot gains three modes, mapping to what the vanilla screen sends for the same input:
PICKUP, button 0QUICK_MOVE, button 0SWAP, button 40 — the offhand's button index inAbstractContainerScreenTwo supporting changes, both consequences of a node gaining modes at all:
RENDER_INLINE_PARAMETERS.NodeGraph.rendersInlineParametersgates the parameter strip and the mode selector is drawn inside it, so without the tag the modes would exist but not be selectable. The tag also makes the Slot number editable on the node, which it was not before: the node declared the parameter but rendered no field for it, so the only way to name a slot was to attach an Inventory Slot node to the Selection slot.NodeCatalog.initializeParametersreads mode parameters instead of type parameters once a node has modes, so a mode without it would silently drop the value.Mode display names get lang entries, since
NodeMode.getDisplayNameignores the strings in the enum constructor and buildspathmind.node.mode.<name>as a translation key.Backwards compatibility
Presets saved before this land with no mode and take the constructor default of
CLICK_SLOT_LEFT, which is the click they were already sending. The Slot parameter keeps its id (click_slot_index) and label (Slot), so saved values restore unchanged.NodeClickSlotTestpins that round-trip for every mode.Verification
NodeClickSlotTestpins the mode-to-click mapping (including the null-mode fallback) and the parameter round-trip.:common:testand the 1.21.x targets, which need a JDK 21 toolchain — CI covers both.🤖 Generated with Claude Code
https://claude.ai/code/session_01JNco3sHnsGRnCojqqhMZ53