[PR #391] [MERGED] Creative item tabs click as CreativeModeInventoryScreen does #2528

Closed
opened 2026-11-02 15:56:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/391
Author: @ludovic111
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: fix/creative-item-tab-clicks


📝 Commits (1)

  • b9e9265 Run the creative item tabs' clicks as CreativeModeInventoryScreen does

📊 Changes

3 files changed (+368 additions, -50 deletions)

View changed files

📝 crates/horizon-client/src/creative.rs (+182 -0)
📝 crates/horizon-client/src/game.rs (+76 -49)
📝 crates/horizon-client/src/menu.rs (+110 -1)

📄 Description

The creative item tabs now click like vanilla's CreativeModeInventoryScreen, Shift included (#275: "shift clicking an item in your hotbar in the creative menu should discard when not in the inventory").

What was wrong

The item tabs had their own click rules, run on press: Shift sent the item straight to the inventory, the hotbar row swapped with the carried stack, a carried stack clicked on the tab was always deleted, and there were no drags or double clicks.

What changed

Item tabs now use the same mouseClicked/mouseReleased path as every container screen (inventory_press / inventory_mouse_release, the quick craft drag), over ItemPickerMenu:

  • Display slots (slotClicked's slot.container == CONTAINER branch, now creative::click_display): an empty hand takes the shown stack, or a full one with Shift; the same item grows by one (left), fills (Shift) or shrinks (right); another item is deleted (left) or loses one (right); number keys fill a hotbar slot with a full stack, Q drops copies.
  • Hotbar row: the menu engine's new Kind::ItemPicker. Its quickMoveStack deletes the stack (Shift-click on the hotbar from an item tab), and its display slots take no drags (canDragTo) or PICKUP_ALL (canTakeItemForPickAll). Plain clicks, drags and double clicks there are the generic doClick the menu harness already checks.
  • Number keys and Q now work over the item tabs too (not the search tab, where the text box takes keys first, as in vanilla).

Not here: the creative search box is a plain string with no cursor or selection, so vanilla's "a click on a result selects the query" (searchBox.moveCursorToEnd(false); setHighlightPos(0)) comes with the text-field PR.

How tested

  • creative::tests::display_slot_clicks_follow_slot_clicked, an_empty_display_slot_deletes_or_shrinks_the_carried_stack: every branch of the CONTAINER code.
  • menu::tests::item_picker_quick_move_deletes_a_hotbar_stack, item_picker_drags_and_pickup_all_skip_the_display_slots (they load .local/horizon-client/26.3 like the other resource tests).
  • The menu oracle runs on the server jar and ItemPickerMenu is a client class (its slots statically initialise CreativeModeInventoryScreen), so it isn't in test_menu_click_parity; its three overrides are the tests above (CreativeModeInventoryScreen.java:943-962).
  • In game on the Mac mini (real Shift key events, horizon-ctl click-at, real mouse drags): Shift-click oak log → 64 carried; click hotbar → placed; click oak wood → 1, again → 2, right → 1; left on another item → deleted; Shift-click hotbar → deleted; a right-drag starting on a display slot over 4 hotbar slots → 1 each, display slot skipped.

Self-check:

cargo fmt --all --check                                   ok
cargo clippy --workspace --all-targets -- -D warnings     ok
cargo test -p horizon-client                              ok (689 + 44 + 15 + 2 + 2 + 2 on the integration commit)
tools/parity.py --changed origin/main                     80 passed, 0 failed (56 min), one run over an integration commit of all the inventory PRs (this one included)

Based on main (after #358). Part of #275.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/391 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/creative-item-tab-clicks` --- ### 📝 Commits (1) - [`b9e9265`](https://github.com/horizon-rust/horizon/commit/b9e926588bca6e8c8ca972fa718262e85a0832f9) Run the creative item tabs' clicks as CreativeModeInventoryScreen does ### 📊 Changes **3 files changed** (+368 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/creative.rs` (+182 -0) 📝 `crates/horizon-client/src/game.rs` (+76 -49) 📝 `crates/horizon-client/src/menu.rs` (+110 -1) </details> ### 📄 Description The creative item tabs now click like vanilla's `CreativeModeInventoryScreen`, Shift included (#275: "shift clicking an item in your hotbar in the creative menu should discard when not in the inventory"). ## What was wrong The item tabs had their own click rules, run on press: Shift sent the item straight to the inventory, the hotbar row swapped with the carried stack, a carried stack clicked on the tab was always deleted, and there were no drags or double clicks. ## What changed Item tabs now use the same `mouseClicked`/`mouseReleased` path as every container screen (`inventory_press` / `inventory_mouse_release`, the quick craft drag), over `ItemPickerMenu`: - **Display slots** (`slotClicked`'s `slot.container == CONTAINER` branch, now `creative::click_display`): an empty hand takes the shown stack, or a full one with Shift; the same item grows by one (left), fills (Shift) or shrinks (right); another item is deleted (left) or loses one (right); number keys fill a hotbar slot with a full stack, Q drops copies. - **Hotbar row**: the menu engine's new `Kind::ItemPicker`. Its `quickMoveStack` deletes the stack (Shift-click on the hotbar from an item tab), and its display slots take no drags (`canDragTo`) or PICKUP_ALL (`canTakeItemForPickAll`). Plain clicks, drags and double clicks there are the generic `doClick` the menu harness already checks. - Number keys and Q now work over the item tabs too (not the search tab, where the text box takes keys first, as in vanilla). Not here: the creative search box is a plain string with no cursor or selection, so vanilla's "a click on a result selects the query" (`searchBox.moveCursorToEnd(false); setHighlightPos(0)`) comes with the text-field PR. ## How tested - `creative::tests::display_slot_clicks_follow_slot_clicked`, `an_empty_display_slot_deletes_or_shrinks_the_carried_stack`: every branch of the CONTAINER code. - `menu::tests::item_picker_quick_move_deletes_a_hotbar_stack`, `item_picker_drags_and_pickup_all_skip_the_display_slots` (they load `.local/horizon-client/26.3` like the other resource tests). - The menu oracle runs on the server jar and `ItemPickerMenu` is a client class (its slots statically initialise `CreativeModeInventoryScreen`), so it isn't in `test_menu_click_parity`; its three overrides are the tests above (`CreativeModeInventoryScreen.java:943-962`). - In game on the Mac mini (real Shift key events, `horizon-ctl click-at`, real mouse drags): Shift-click oak log → 64 carried; click hotbar → placed; click oak wood → 1, again → 2, right → 1; left on another item → deleted; Shift-click hotbar → deleted; a right-drag starting on a display slot over 4 hotbar slots → 1 each, display slot skipped. Self-check: ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client ok (689 + 44 + 15 + 2 + 2 + 2 on the integration commit) tools/parity.py --changed origin/main 80 passed, 0 failed (56 min), one run over an integration commit of all the inventory PRs (this one included) ``` Based on main (after #358). Part of #275. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2528
No description provided.