[PR #4363] [MERGED] Run the Mouse Tweaks wheel and drags in furnaces and crafting tables, and keep the cursor right under fast clicks #5583

Closed
opened 2026-11-03 05:13:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4363
Author: @1038april
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: fix/mouse-tweaks-menus


📝 Commits (4)

  • 217fb7a Run the Mouse Tweaks wheel and drags in furnaces and crafting tables
  • 69ec4cc Keep the cursor and the items right under fast menu clicks
  • 17e5640 Merge remote-tracking branch 'hr/main' into fix/pr-4363
  • f83505a Merge remote-tracking branch 'hr/main' into fix/pr-4363

📊 Changes

9 files changed (+666 additions, -61 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_crafting.rs (+30 -2)
📝 crates/horizon-client/src/game/lan_stations.rs (+1 -0)
📝 crates/horizon-client/src/game/remote.rs (+17 -7)
📝 crates/horizon-client/src/game/tweaks.rs (+157 -45)
📝 crates/horizon-client/src/lan/containers.rs (+53 -0)
📝 crates/horizon-client/src/lan/guest.rs (+8 -0)
📝 crates/horizon-client/src/menu.rs (+167 -0)
📝 docs/extras.md (+14 -5)
📝 tools/lan_e2e.py (+219 -2)

📄 Description

🤖 Opened by 1038april's AI agent (Claude Code, Claude Opus 5.5), not by 1038april personally.

What and why

Fixes #4312.

With Extras → Mouse Tweaks on, the wheel and drags did nothing in furnaces, crafting tables, hoppers and dispensers/droppers on the server-thread path, because tweaks_on() only allowed the inventory and chest-like menus (docs/extras.md already claimed hoppers and dispensers worked). This allows those menus and makes the wheel follow vanilla's slot rules.

Testing it by hand found a second problem: fast scrolling left a stack in the cursor, and in creative mode really added items on this branch before the fixes below. The stuck cursor stack also happens on unmodified main in a chest, so the sync fix matters beyond this extra. Real extra items were not confirmed on main.

Mouse Tweaks (tweaks.rs, menu.rs)

  • New gate tweak_menu: adds furnace, blast furnace, smoker, crafting table, hopper, dispenser/dropper. Anvils, enchanting, merchants, beacons, brewing stands, crafters and the other stations stay off. Sorting keeps its own list.
  • Wheel down takes its target from the engine's quick_move (Menu::quick_move_landing), run on the throwaway menu of a menu_session that keeps nothing. Fuel, inputs and the grid therefore route as a Shift click does.
  • Nothing goes into a result slot. Wheel down over one takes one craft, or a furnace's whole output, when it all fits. Wheel up over one does nothing.
  • Placing is now a one-slot drag (QUICK_CRAFT), not a click. If the first click of a sequence finds its slot already empty on the server (a furnace just burned that coal), a following right click would pick up half of the target stack; a drag with an empty hand does nothing.

Server and client sync (lan/containers.rs, lan/guest.rs, lan_crafting.rs, lan_stations.rs, remote.rs)

  • A click in an open menu now also marks the inventory slots it settled on window 0. Before, the next tick's inventory sync re-sent them, and the stale values landed on clicks the client had predicted since.
  • answer_click compares the click's state id and answers a stale click with the whole menu, as handleContainerClick does.
  • The crafting table no longer resends the whole menu after every click: only for a stale state or a wrong prediction.
  • The client takes state ids only from the open window.
  • In creative, the client no longer sends its predictions as SetCreativeModeSlot edits while a server menu is open. This is what turned a wrong prediction into real items.

For reviewers

  • Overlap with #4171, which adds minecraft:crafting to the same gate and will conflict with this. This PR covers that change, so one of them should give way. Merging the gate alone would expose the stuck-cursor bug in the crafting table.
  • Behaviour change: with the extra on, the wheel now always routes like a Shift click, so scrolling down on armour in the player inventory equips it instead of moving it to the other section. The grid and armour slots of the player inventory also respond to the wheel now.
  • Size: 708 lines of code against the ~500 guideline, and it touches lan/ and remote.rs, so it likely wants needs-proof. It splits naturally into the sync fix and the Mouse Tweaks change if you would rather have two PRs; the commits are already separated that way, except that the one-slot drag is in the sync commit.
  • Not changed or tested: merchant and mount menus still have the inventory re-send path. The wheel doesn't run there, but very fast normal clicks might still hit it. Nothing here was run against a real vanilla server.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Read with tools/rea_vanilla.py:

  • ServerGamePacketListenerImpl.handleContainerClick: fullResyncNeeded = packet.stateId() != containerMenu.getStateId(), then broadcastFullState or broadcastChanges.
  • ServerPlayer.tick: broadcasts containerMenu only.

Followed through the existing port in menu.rs: quickMoveStack and moveItemStackTo of the menus, and AbstractContainerMenu's QUICK_CRAFT handling.

The wheel and drags themselves are Horizon-only (off by default), so no harness compares them with vanilla. The harnesses that guard the clicks underneath are below.

Self-check

**pr_ready** (`tools/pr_ready.py --base upstream/main` on KernelOS-PC, against upstream/main at 0a341cc35, 3 min 24 s)

| Check | Result |
| --- | --- |
| Scope | ⚠️ 9 files, +666 −61; 708 lines of code: over 500, split it if it can ship in parts |
| Cargo.lock | ✅ unchanged |
| Public tree | ✅ |
| Python tests | ✅ 480 passed (46 s) |
| rustfmt | ✅ (7 s) |
| clippy | ✅ (32 s) |
| tests: horizon-client | ❌ 736 passed, 1 failed (1 min 53 s) |
| doc tests | ✅ 0 passed (1 s) |
| content root tests | ➖ content root untouched |
| tokens.css up to date | ➖ theme untouched |
| launcher rustfmt | ➖ launcher untouched |
| launcher clippy | ➖ launcher untouched |
| launcher tests | ➖ launcher untouched |
| Parity | ❌ 362 affected,  (1 s) |
| Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) |

Both ❌ come from running on Windows, and neither means the checks passed:

  • The failing test is title::tests::each_world_preset_writes_its_own_generator. It builds a folder name containing : (minecraft:normal), which Windows rejects. This branch doesn't touch it, but it was not run on unmodified main to compare.
  • tools/parity.py needs fcntl, so the 362 affected harnesses did not run. Please add run-parity.

Run separately on this branch, on Windows:

Check Result
cargo test -p horizon-client --bins --tests ✅ everything except the test above
python tools/test_menu_click_parity.py ✅ 8,000/8,000
python tools/test_container_screen_parity.py ✅ 4,000 cases
lan_e2e --check wheel (new), --check clicks ✅ on this exact code
lan_e2e --check chest crafting containers machines recipes ✅ on the code before the final rebase
Fast-wheel stress in chest, furnace, hopper and crafting table, creative and survival, single player on the server thread ✅ 8/8: nothing left in the cursor, no items made or lost (unmodified main, chest only: a stack left in the cursor in both modes)
1038april, by hand in the game ✅ reported fixed

lan_e2e.py doesn't run on Windows as it stands (it needs vscreen, and a captured pipe never closes once the game inherits it), so it ran through a small local wrapper that isn't part of this PR, with DISPLAY set and HORIZON_E2E_HEADLESS=1.

The new wheel check runs real wheel events and reads the server's view by reopening each menu. The Rust unit tests cover the routing (quick_move_landing_*, takes_one_follows_the_slots_rules) and the gate, but no Rust test covers the server sync change on its own: only the wheel check and the stress do.

🤖 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/4363 **Author:** [@1038april](https://github.com/1038april) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/mouse-tweaks-menus` --- ### 📝 Commits (4) - [`217fb7a`](https://github.com/horizon-rust/horizon/commit/217fb7af0d520e1f875e340706043ce26ccdcb9f) Run the Mouse Tweaks wheel and drags in furnaces and crafting tables - [`69ec4cc`](https://github.com/horizon-rust/horizon/commit/69ec4ccdd650b34f3b015a7e863beabd58ca63c4) Keep the cursor and the items right under fast menu clicks - [`17e5640`](https://github.com/horizon-rust/horizon/commit/17e5640d94f57bc6365be0fa89d19aaa438f1dfd) Merge remote-tracking branch 'hr/main' into fix/pr-4363 - [`f83505a`](https://github.com/horizon-rust/horizon/commit/f83505a4845671c1120c8cbb065fd5f24533b8da) Merge remote-tracking branch 'hr/main' into fix/pr-4363 ### 📊 Changes **9 files changed** (+666 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_crafting.rs` (+30 -2) 📝 `crates/horizon-client/src/game/lan_stations.rs` (+1 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+17 -7) 📝 `crates/horizon-client/src/game/tweaks.rs` (+157 -45) 📝 `crates/horizon-client/src/lan/containers.rs` (+53 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+8 -0) 📝 `crates/horizon-client/src/menu.rs` (+167 -0) 📝 `docs/extras.md` (+14 -5) 📝 `tools/lan_e2e.py` (+219 -2) </details> ### 📄 Description > 🤖 Opened by 1038april's AI agent (Claude Code, Claude Opus 5.5), not by 1038april personally. ## What and why Fixes #4312. With Extras → Mouse Tweaks on, the wheel and drags did nothing in furnaces, crafting tables, hoppers and dispensers/droppers on the server-thread path, because `tweaks_on()` only allowed the inventory and chest-like menus (`docs/extras.md` already claimed hoppers and dispensers worked). This allows those menus and makes the wheel follow vanilla's slot rules. Testing it by hand found a second problem: fast scrolling left a stack in the cursor, and in creative mode really added items on this branch before the fixes below. **The stuck cursor stack also happens on unmodified main in a chest**, so the sync fix matters beyond this extra. Real extra items were not confirmed on main. **Mouse Tweaks (`tweaks.rs`, `menu.rs`)** - New gate `tweak_menu`: adds furnace, blast furnace, smoker, crafting table, hopper, dispenser/dropper. Anvils, enchanting, merchants, beacons, brewing stands, crafters and the other stations stay off. Sorting keeps its own list. - Wheel down takes its target from the engine's `quick_move` (`Menu::quick_move_landing`), run on the throwaway menu of a `menu_session` that keeps nothing. Fuel, inputs and the grid therefore route as a Shift click does. - Nothing goes into a result slot. Wheel down over one takes one craft, or a furnace's whole output, when it all fits. Wheel up over one does nothing. - Placing is now a one-slot drag (`QUICK_CRAFT`), not a click. If the first click of a sequence finds its slot already empty on the server (a furnace just burned that coal), a following right click would pick up half of the target stack; a drag with an empty hand does nothing. **Server and client sync (`lan/containers.rs`, `lan/guest.rs`, `lan_crafting.rs`, `lan_stations.rs`, `remote.rs`)** - A click in an open menu now also marks the inventory slots it settled on window 0. Before, the next tick's inventory sync re-sent them, and the stale values landed on clicks the client had predicted since. - `answer_click` compares the click's state id and answers a stale click with the whole menu, as `handleContainerClick` does. - The crafting table no longer resends the whole menu after every click: only for a stale state or a wrong prediction. - The client takes state ids only from the open window. - In creative, the client no longer sends its predictions as `SetCreativeModeSlot` edits while a server menu is open. This is what turned a wrong prediction into real items. **For reviewers** - **Overlap with #4171**, which adds `minecraft:crafting` to the same gate and will conflict with this. This PR covers that change, so one of them should give way. Merging the gate alone would expose the stuck-cursor bug in the crafting table. - **Behaviour change:** with the extra on, the wheel now always routes like a Shift click, so scrolling down on armour in the player inventory equips it instead of moving it to the other section. The grid and armour slots of the player inventory also respond to the wheel now. - **Size:** 708 lines of code against the ~500 guideline, and it touches `lan/` and `remote.rs`, so it likely wants `needs-proof`. It splits naturally into the sync fix and the Mouse Tweaks change if you would rather have two PRs; the commits are already separated that way, except that the one-slot drag is in the sync commit. - **Not changed or tested:** merchant and mount menus still have the inventory re-send path. The wheel doesn't run there, but very fast normal clicks might still hit it. Nothing here was run against a real vanilla server. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Read with `tools/rea_vanilla.py`: - `ServerGamePacketListenerImpl.handleContainerClick`: `fullResyncNeeded = packet.stateId() != containerMenu.getStateId()`, then `broadcastFullState` or `broadcastChanges`. - `ServerPlayer.tick`: broadcasts `containerMenu` only. Followed through the existing port in `menu.rs`: `quickMoveStack` and `moveItemStackTo` of the menus, and `AbstractContainerMenu`'s `QUICK_CRAFT` handling. The wheel and drags themselves are Horizon-only (off by default), so no harness compares them with vanilla. The harnesses that guard the clicks underneath are below. ## Self-check ``` **pr_ready** (`tools/pr_ready.py --base upstream/main` on KernelOS-PC, against upstream/main at 0a341cc35, 3 min 24 s) | Check | Result | | --- | --- | | Scope | ⚠️ 9 files, +666 −61; 708 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (46 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (32 s) | | tests: horizon-client | ❌ 736 passed, 1 failed (1 min 53 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 362 affected, (1 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ``` **Both ❌ come from running on Windows, and neither means the checks passed:** - The failing test is `title::tests::each_world_preset_writes_its_own_generator`. It builds a folder name containing `:` (`minecraft:normal`), which Windows rejects. This branch doesn't touch it, but it was not run on unmodified main to compare. - `tools/parity.py` needs `fcntl`, so **the 362 affected harnesses did not run**. Please add `run-parity`. Run separately on this branch, on Windows: | Check | Result | | --- | --- | | `cargo test -p horizon-client --bins --tests` | ✅ everything except the test above | | `python tools/test_menu_click_parity.py` | ✅ 8,000/8,000 | | `python tools/test_container_screen_parity.py` | ✅ 4,000 cases | | `lan_e2e --check wheel` (new), `--check clicks` | ✅ on this exact code | | `lan_e2e --check chest crafting containers machines recipes` | ✅ on the code before the final rebase | | Fast-wheel stress in chest, furnace, hopper and crafting table, creative and survival, single player on the server thread | ✅ 8/8: nothing left in the cursor, no items made or lost (unmodified main, chest only: a stack left in the cursor in both modes) | | 1038april, by hand in the game | ✅ reported fixed | `lan_e2e.py` doesn't run on Windows as it stands (it needs `vscreen`, and a captured pipe never closes once the game inherits it), so it ran through a small local wrapper that isn't part of this PR, with `DISPLAY` set and `HORIZON_E2E_HEADLESS=1`. The new `wheel` check runs real wheel events and reads the server's view by reopening each menu. The Rust unit tests cover the routing (`quick_move_landing_*`, `takes_one_follows_the_slots_rules`) and the gate, but no Rust test covers the server sync change on its own: only the `wheel` check and the stress do. 🤖 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-03 05:13:34 +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#5583
No description provided.