[PR #393] [MERGED] Drag highlight and counts as AbstractContainerScreen draws them #2530

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

📋 Pull Request Information

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

Base: main ← Head: fix/quick-craft-highlight


📝 Commits (2)

  • a061c40 Move every matching stack on a Shift double click
  • 5efb5ea Draw the quick craft drag as AbstractContainerScreen does

📊 Changes

9 files changed (+344 additions, -55 deletions)

View changed files

📝 crates/horizon-client/examples/menu_fixture.rs (+11 -2)
📝 crates/horizon-client/src/game.rs (+161 -25)
📝 crates/horizon-client/src/game/beacon.rs (+2 -2)
📝 crates/horizon-client/src/game/recipe_book.rs (+1 -1)
📝 crates/horizon-client/src/game/stations.rs (+4 -5)
📝 crates/horizon-client/src/game/trading.rs (+5 -5)
📝 crates/horizon-client/src/menu.rs (+131 -10)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMenuOracle.java (+16 -0)
📝 tools/test_menu_click_parity.py (+13 -5)

📄 Description

A quick craft drag now shows its slots as vanilla does (#275: "No right click drag highlight when dragging items").

Vanilla

  • extractSlot: each dragged slot shows the stack it would get (getQuickCraftPlaceCount + what it holds, capped by the slot, the count then drawn yellow) over a 0x80FFFFFF fill. A drag over a single slot hides that slot's item.
  • extractCarriedItem / recalculateQuickCraftRemaining: the cursor shows what stays in hand (nothing when that is 0).
  • shouldAddSlotToQuickCraft: a slot joins the drag only if it is empty or holds the same item, accepts the item (mayPlace), canDragTo, and (for a right drag) the hand still has an item per slot.

What changed

  • Menu engine: quick_craft_accepts and quick_craft_preview (read-only).
  • Drags add slots by shouldAddSlotToQuickCraft, so the preview counts the slots the menu will fill. Before, any slot joined, and the engine dropped the bad ones only on release.
  • draw_slot_item / draw_carried draw the slots and the carried stack of the inventory, crafting table, chests, hopper, dispenser, shulker box, furnaces, crafter, loom, trading and creative screens. The station screens (and brewing stand) have no drag distribution yet (they aren't on the menu engine), so they show none.

How tested

  • menu::tests::a_quick_craft_drag_previews_each_slot_and_the_rest_in_hand: accepts (empty, same item, other item, result slot, armor slot, right-drag limit) and preview counts, cap and remainder for left and right drags.
  • In game on the Mac mini: 64 stone carried, a real left mouse drag held over five slots (one holding 20): screenshot mid-drag shows 12, 12, 12, 12 and 32, the cursor 4, the dragged slots' background 207 against 156 for untouched ones; after release the slots hold exactly that.

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)

Stacked on #392. 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/393 **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/quick-craft-highlight` --- ### 📝 Commits (2) - [`a061c40`](https://github.com/horizon-rust/horizon/commit/a061c40fde9ceb5b24c6bad8734f6da09ebbe87f) Move every matching stack on a Shift double click - [`5efb5ea`](https://github.com/horizon-rust/horizon/commit/5efb5ea335d64f8806e165c20aab2112bc0d7770) Draw the quick craft drag as AbstractContainerScreen does ### 📊 Changes **9 files changed** (+344 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/menu_fixture.rs` (+11 -2) 📝 `crates/horizon-client/src/game.rs` (+161 -25) 📝 `crates/horizon-client/src/game/beacon.rs` (+2 -2) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+1 -1) 📝 `crates/horizon-client/src/game/stations.rs` (+4 -5) 📝 `crates/horizon-client/src/game/trading.rs` (+5 -5) 📝 `crates/horizon-client/src/menu.rs` (+131 -10) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMenuOracle.java` (+16 -0) 📝 `tools/test_menu_click_parity.py` (+13 -5) </details> ### 📄 Description A quick craft drag now shows its slots as vanilla does (#275: "No right click drag highlight when dragging items"). ## Vanilla - `extractSlot`: each dragged slot shows the stack it would get (`getQuickCraftPlaceCount` + what it holds, capped by the slot, the count then drawn yellow) over a `0x80FFFFFF` fill. A drag over a single slot hides that slot's item. - `extractCarriedItem` / `recalculateQuickCraftRemaining`: the cursor shows what stays in hand (nothing when that is 0). - `shouldAddSlotToQuickCraft`: a slot joins the drag only if it is empty or holds the same item, accepts the item (`mayPlace`), `canDragTo`, and (for a right drag) the hand still has an item per slot. ## What changed - Menu engine: `quick_craft_accepts` and `quick_craft_preview` (read-only). - Drags add slots by `shouldAddSlotToQuickCraft`, so the preview counts the slots the menu will fill. Before, any slot joined, and the engine dropped the bad ones only on release. - `draw_slot_item` / `draw_carried` draw the slots and the carried stack of the inventory, crafting table, chests, hopper, dispenser, shulker box, furnaces, crafter, loom, trading and creative screens. The station screens (and brewing stand) have no drag distribution yet (they aren't on the menu engine), so they show none. ## How tested - `menu::tests::a_quick_craft_drag_previews_each_slot_and_the_rest_in_hand`: accepts (empty, same item, other item, result slot, armor slot, right-drag limit) and preview counts, cap and remainder for left and right drags. - In game on the Mac mini: 64 stone carried, a real left mouse drag held over five slots (one holding 20): screenshot mid-drag shows 12, 12, 12, 12 and 32, the cursor 4, the dragged slots' background 207 against 156 for untouched ones; after release the slots hold exactly that. 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) ``` Stacked on #392. 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:57 +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#2530
No description provided.