[PR #1086] [MERGED] Creative pick block in inventories: full stacks and drags (AbstractContainerScreen cloning) #3035

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

📋 Pull Request Information

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

Base: main ← Head: fix/creative-middle-click


📝 Commits (1)

  • f18f6d5 Creative pick block in inventories: full stacks and drags (AbstractContainerScreen cloning)

📊 Changes

5 files changed (+150 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/bin/horizon-ctl/commands.rs (+3 -3)
📝 crates/horizon-client/src/game.rs (+75 -0)
📝 crates/horizon-client/src/game/ui_control.rs (+15 -4)
📝 docs/agent-control.md (+5 -4)
📝 tools/agent_control_e2e.py (+52 -3)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #1048. Reported by Visivel on Discord: thanks!

What

The middle button (the pick block key, keyPickItem) over the inventory or the creative screen clicked like the left button: it picked up the slot's stack or took one item from an item tab. It now follows vanilla's AbstractContainerScreen mouseClicked / mouseReleased with cloning (pick block plus infinite materials):

  • In creative, with an empty hand: a full stack of the hovered item (CLONE), from an item tab, the hotbar or the survival inventory tab. Components (NBT) are kept, so stacks can be duplicated.
  • In creative, holding a stack: holding the button and moving over slots drags full stacks into each one (quick craft type 2). A press and release on a single slot does what vanilla does there: nothing on an inventory slot, a clone on an item tab's slot.
  • In survival: the middle button does nothing in inventories (only a hotbar or off-hand key bound to it applies, as before).
  • If pick block is rebound to another mouse button, that button does all this; the middle button then does nothing.

The menu engine and the creative display already handled CLONE and quick craft type 2. This PR adds the input routing that reaches them.

How

  • game.rs: an arm for non-left/right buttons on the inventory and creative screens, with inventory_pick_press and inventory_pick_release built on container_screen::Clicks (Button::Middle, cloning, pick_item).
  • Agent control (horizon-ctl click ID middle, MCP middle: true) sends a real middle click through the window events. Creative screen slots are ui widgets now (slot-0…, item tab display slots from slot-900). Docs: docs/agent-control.md.
  • tools/agent_control_e2e.py --scenario pick: in creative, middle-clicks a hotbar slot holding 2 logs (the hand gets 64, the slot keeps 2) and an item tab's first slot (full stack). In survival, it middle-clicks a slot and checks that nothing changes.

Proof

Run on one integration commit holding all five B3 branches, rebased on origin/main 85f65a69, on the Mac mini:

cargo fmt --all --check                                         ok
set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings   exit 0, 0 errors
cargo test -p horizon-client                                    1052 passed, 0 failed
  • python3 tools/agent_control_e2e.py --mode cli --scenario pick: PASS ({"cli/pick": true}). With the new routing disabled, it fails at the first clone.

tools/parity.py --changed origin/main: this branch changes game.rs, so it selects all 325 harnesses. Today's Mac mini (load ~70 from other agents' parity runs) couldn't finish the main baseline within the 2 h job limit; it was still building probes. CI's parity job runs the same --changed selection for this PR on the runner. Known failure on main: mob_ai drowned_* (#290).

Needs Ludovic

Nothing. The drag (quick craft type 2) has no automated test, since agent control can't drag with the middle button. It hands the drag to the menu engine's existing quick craft (Input::QuickCraft with type 2).

🤖 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/1086 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/creative-middle-click` --- ### 📝 Commits (1) - [`f18f6d5`](https://github.com/horizon-rust/horizon/commit/f18f6d58acba56542350fe638e28fc9813fc01d7) Creative pick block in inventories: full stacks and drags (AbstractContainerScreen cloning) ### 📊 Changes **5 files changed** (+150 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/bin/horizon-ctl/commands.rs` (+3 -3) 📝 `crates/horizon-client/src/game.rs` (+75 -0) 📝 `crates/horizon-client/src/game/ui_control.rs` (+15 -4) 📝 `docs/agent-control.md` (+5 -4) 📝 `tools/agent_control_e2e.py` (+52 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1048. Reported by **Visivel** on Discord: thanks! ## What The middle button (the pick block key, `keyPickItem`) over the inventory or the creative screen clicked like the left button: it picked up the slot's stack or took one item from an item tab. It now follows vanilla's `AbstractContainerScreen` `mouseClicked` / `mouseReleased` with `cloning` (pick block plus infinite materials): - In creative, with an empty hand: a full stack of the hovered item (`CLONE`), from an item tab, the hotbar or the survival inventory tab. Components (NBT) are kept, so stacks can be duplicated. - In creative, holding a stack: holding the button and moving over slots drags full stacks into each one (quick craft type 2). A press and release on a single slot does what vanilla does there: nothing on an inventory slot, a clone on an item tab's slot. - In survival: the middle button does nothing in inventories (only a hotbar or off-hand key bound to it applies, as before). - If pick block is rebound to another mouse button, that button does all this; the middle button then does nothing. The menu engine and the creative display already handled `CLONE` and quick craft type 2. This PR adds the input routing that reaches them. ## How - `game.rs`: an arm for non-left/right buttons on the inventory and creative screens, with `inventory_pick_press` and `inventory_pick_release` built on `container_screen::Clicks` (`Button::Middle`, `cloning`, `pick_item`). - Agent control (`horizon-ctl click ID middle`, MCP `middle: true`) sends a real middle click through the window events. Creative screen slots are `ui` widgets now (`slot-0`…, item tab display slots from `slot-900`). Docs: `docs/agent-control.md`. - `tools/agent_control_e2e.py --scenario pick`: in creative, middle-clicks a hotbar slot holding 2 logs (the hand gets 64, the slot keeps 2) and an item tab's first slot (full stack). In survival, it middle-clicks a slot and checks that nothing changes. ## Proof Run on one integration commit holding all five B3 branches, rebased on origin/main `85f65a69`, on the Mac mini: ``` cargo fmt --all --check ok set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings exit 0, 0 errors cargo test -p horizon-client 1052 passed, 0 failed ``` - `python3 tools/agent_control_e2e.py --mode cli --scenario pick`: **PASS** (`{"cli/pick": true}`). With the new routing disabled, it fails at the first clone. `tools/parity.py --changed origin/main`: this branch changes `game.rs`, so it selects all 325 harnesses. Today's Mac mini (load ~70 from other agents' parity runs) couldn't finish the main baseline within the 2 h job limit; it was still building probes. CI's parity job runs the same `--changed` selection for this PR on the runner. Known failure on main: mob_ai drowned_* (#290). ## Needs Ludovic Nothing. The drag (quick craft type 2) has no automated test, since agent control can't drag with the middle button. It hands the drag to the menu engine's existing quick craft (`Input::QuickCraft` with type 2). 🤖 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 16:00: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#3035
No description provided.