[PR #396] [MERGED] Mouse Tweaks-style inventory controls (extra, off by default) #2533

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

📋 Pull Request Information

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

Base: main ← Head: feat/mouse-tweaks


📝 Commits (2)

  • 3e0793a Select the creative search query when a result is clicked
  • 05a1e10 Mouse Tweaks-style inventory controls, an extra off by default

📊 Changes

10 files changed (+477 additions, -26 deletions)

View changed files

📝 crates/horizon-client/src/bin/horizon-ctl/commands.rs (+4 -0)
📝 crates/horizon-client/src/clipboard.rs (+5 -1)
📝 crates/horizon-client/src/extras.rs (+32 -2)
📝 crates/horizon-client/src/game.rs (+21 -1)
📝 crates/horizon-client/src/game/agent.rs (+92 -14)
📝 crates/horizon-client/src/game/control.rs (+2 -2)
📝 crates/horizon-client/src/game/remote.rs (+23 -4)
📝 crates/horizon-client/src/game/stations.rs (+1 -1)
➕ crates/horizon-client/src/game/tweaks.rs (+274 -0)
📝 docs/extras.md (+23 -1)

📄 Description

Mouse Tweaks-style inventory controls, an extra that is off by default (Extras → Inventory). Part of #332.

What it does (with "Mouse Tweaks controls" on)

In the player inventory and chest-like containers (chests, barrels, ender chests, shulker boxes, hoppers, dispensers), in singleplayer and on servers:

  • Right-drag holding a stack: one item goes into each slot entered, at once.
  • Left-drag holding a stack: the slots of the same item are gathered into the hand (when everything fits). This takes over only while vanilla's drag covers one slot, so a left-drag over empty slots still splits the stack as vanilla does.
  • Shift + left-drag: every slot entered is quick-moved (with a stack in hand, only the slots of its item).
  • Wheel ("Scroll wheel moves items", on when the extra is on): over a slot, with an empty hand, down moves one item to the other side (container ↔ inventory, or hotbar ↔ main inventory: to a stack with room, else the first empty slot, as quick-move picks) and up brings one back.

Every action is made of ordinary slot clicks: the menu engine's locally, or ContainerClick packets for any slot on a server (remote_slot_click, factored out of remote_click). A vanilla server sees normal clicks.

Off = vanilla

With the extra off, each hook (tweak_press, tweak_drag_move, tweak_scroll) returns at once, before touching any state, and the screens run the same code as before. The menu click parity harness and the container screen tests are unchanged and pass.

Tooling

horizon-ctl drag-at [right] X Y X Y... and scroll-at X Y STEPS send the window events of a mouse drag and of wheel steps (the same path as click-at), so drags can be tested without a real mouse.

How tested

In game (offscreen, survival), the same script run with the extra on and then off:

case extra on extra off (vanilla)
right-drag, 10 stone, over 9-11 1/1/1, 7 in hand (placed as the cursor enters) not rerun; vanilla's drag ends the same, placed at release
left-drag, 10 stone in hand, over 0 (empty), 9 (5 stone), 10 (7 stone) 22 in hand, slots empty split: 3/8/10, 1 in hand
Shift + left-drag, empty hand, over 9 (stone), 10 (dirt) both quick-moved only slot 9 moved
wheel down, then up, over 9 (5 stone) 4 + 1 in hotbar, then 5 nothing
left-drag, 9 stone, over empty 9-11 3/3/3 (vanilla split kept) 3/3/3
chest: wheel down over 300 (4 stone), up over hotbar 8 3 + 1, then 2 + 2 nothing

Not tested: the same on a real server (the clicks are ContainerClicks like any other).

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)

One pre-existing flake seen while testing: front::tests::horizon_world_delete_confirms_and_keeps_the_selection_in_place sometimes fails in a parallel run, racing title::tests::delete_refuses_an_open_world_then_removes_it_with_its_lock. It passes alone and in a serial run, and this PR touches neither.

Stacked on #395. Part of #332.

🤖 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/396 **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:** `feat/mouse-tweaks` --- ### 📝 Commits (2) - [`3e0793a`](https://github.com/horizon-rust/horizon/commit/3e0793af21984978f6bd7998da666949e3899ad5) Select the creative search query when a result is clicked - [`05a1e10`](https://github.com/horizon-rust/horizon/commit/05a1e10bbe1ed86488b43add6e4ccf3b809673f2) Mouse Tweaks-style inventory controls, an extra off by default ### 📊 Changes **10 files changed** (+477 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/bin/horizon-ctl/commands.rs` (+4 -0) 📝 `crates/horizon-client/src/clipboard.rs` (+5 -1) 📝 `crates/horizon-client/src/extras.rs` (+32 -2) 📝 `crates/horizon-client/src/game.rs` (+21 -1) 📝 `crates/horizon-client/src/game/agent.rs` (+92 -14) 📝 `crates/horizon-client/src/game/control.rs` (+2 -2) 📝 `crates/horizon-client/src/game/remote.rs` (+23 -4) 📝 `crates/horizon-client/src/game/stations.rs` (+1 -1) ➕ `crates/horizon-client/src/game/tweaks.rs` (+274 -0) 📝 `docs/extras.md` (+23 -1) </details> ### 📄 Description Mouse Tweaks-style inventory controls, an extra that is **off by default** (Extras → Inventory). Part of #332. ## What it does (with "Mouse Tweaks controls" on) In the player inventory and chest-like containers (chests, barrels, ender chests, shulker boxes, hoppers, dispensers), in singleplayer and on servers: - **Right-drag holding a stack**: one item goes into each slot entered, at once. - **Left-drag holding a stack**: the slots of the same item are gathered into the hand (when everything fits). This takes over only while vanilla's drag covers one slot, so a left-drag over empty slots still splits the stack as vanilla does. - **Shift + left-drag**: every slot entered is quick-moved (with a stack in hand, only the slots of its item). - **Wheel** ("Scroll wheel moves items", on when the extra is on): over a slot, with an empty hand, down moves one item to the other side (container ↔ inventory, or hotbar ↔ main inventory: to a stack with room, else the first empty slot, as quick-move picks) and up brings one back. Every action is made of ordinary slot clicks: the menu engine's locally, or `ContainerClick` packets for any slot on a server (`remote_slot_click`, factored out of `remote_click`). A vanilla server sees normal clicks. ## Off = vanilla With the extra off, each hook (`tweak_press`, `tweak_drag_move`, `tweak_scroll`) returns at once, before touching any state, and the screens run the same code as before. The menu click parity harness and the container screen tests are unchanged and pass. ## Tooling `horizon-ctl drag-at [right] X Y X Y...` and `scroll-at X Y STEPS` send the window events of a mouse drag and of wheel steps (the same path as `click-at`), so drags can be tested without a real mouse. ## How tested In game (offscreen, survival), the same script run with the extra on and then off: | case | extra on | extra off (vanilla) | |---|---|---| | right-drag, 10 stone, over 9-11 | 1/1/1, 7 in hand (placed as the cursor enters) | not rerun; vanilla's drag ends the same, placed at release | | left-drag, 10 stone in hand, over 0 (empty), 9 (5 stone), 10 (7 stone) | 22 in hand, slots empty | split: 3/8/10, 1 in hand | | Shift + left-drag, empty hand, over 9 (stone), 10 (dirt) | both quick-moved | only slot 9 moved | | wheel down, then up, over 9 (5 stone) | 4 + 1 in hotbar, then 5 | nothing | | left-drag, 9 stone, over empty 9-11 | 3/3/3 (vanilla split kept) | 3/3/3 | | chest: wheel down over 300 (4 stone), up over hotbar 8 | 3 + 1, then 2 + 2 | nothing | Not tested: the same on a real server (the clicks are `ContainerClick`s like any other). 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) ``` One pre-existing flake seen while testing: `front::tests::horizon_world_delete_confirms_and_keeps_the_selection_in_place` sometimes fails in a parallel run, racing `title::tests::delete_refuses_an_open_world_then_removes_it_with_its_lock`. It passes alone and in a serial run, and this PR touches neither. Stacked on #395. Part of #332. 🤖 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:58 +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#2533
No description provided.