Skip to content

Give Click Slot the three clicks a player actually makes - #80

Closed
Gaetarra wants to merge 1 commit into
soymods:mainfrom
Gaetarra:feature/click-slot-modes
Closed

Give Click Slot the three clicks a player actually makes#80
Gaetarra wants to merge 1 commit into
soymods:mainfrom
Gaetarra:feature/click-slot-modes

Conversation

@Gaetarra

Copy link
Copy Markdown

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:

Mode Click sent
Left Click (default) PICKUP, button 0
Shift Click QUICK_MOVE, button 0
F SWAP, 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.rendersInlineParameters 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.

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.

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. NodeClickSlotTest pins that round-trip for every mode.

Verification

  • Fabric compiles on 26.2, NeoForge on 26.1.2.
  • NodeClickSlotTest pins the mode-to-click mapping (including the null-mode fallback) and the parameter round-trip.
  • Not run locally: :common:test and the 1.21.x targets, which need a JDK 21 toolchain — CI covers both.
  • The editor behaviour, in particular the mode selector and the now-visible Slot field, has not been clicked through in a dev client.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JNco3sHnsGRnCojqqhMZ53

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
@Gaetarra

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant