[PR #3652] [MERGED] The mouse wheel selects a bundle's item in the creative inventory #5126

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3652
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3211


📝 Commits (1)

  • 8b8ab7f The mouse wheel selects a bundle's item in the creative inventory

📊 Changes

2 files changed (+38 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -2)
📝 crates/horizon-client/src/game/bundles.rs (+31 -1)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

Fixes #3211

The mouse wheel over a bundle didn't select an item in the creative inventory. The wheel scrolled the creative item grid instead, whether the bundle was in the hotbar row of an item tab or in the inventory tab.

Root cause. The wheel dispatch in Game::window_event (WindowEvent::MouseWheel) called bundle_scroll only for Screen::Inventory. Screen::Creative went straight to creative_screen.wheel. tick_bundle_hover (vanilla's onStopHovering, which clears the selection when the cursor leaves the bundle) also only ran on Screen::Inventory. In vanilla, CreativeModeInventoryScreen.mouseScrolled calls AbstractContainerScreen.mouseScrolled first. That offers the wheel to the hovered slot's ItemSlotMouseActions (BundleMouseActions), and the screen only scrolls its items when none of them took it.

Fix. bundles::takes_bundle_wheel names the screens that are AbstractContainerScreens: the inventory and container menus, and creative. The wheel dispatch offers the wheel to bundle_scroll on all of them before the creative grid, the tweaks or the station scrolling, and tick_bundle_hover uses the same check. The bundle slot rules (bundle_slot) are unchanged, so the creative screen's own display slots (900+) never take the wheel.

About survival: on current main, the survival inventory selects items with the wheel for me (the selected item is highlighted in the tooltip and drawn on the bundle's icon). So the part that's still broken is creative, which the reporter says fails every time. If survival still fails on a nightly with this fix, a note on the mouse or touchpad and the OS would help: it might be a scroll delta this path doesn't see.

Vanilla reference

  • AbstractContainerScreen.mouseScrolled: hoveredSlot with an item → each ItemSlotMouseAction.matches / onMouseScrolled
  • CreativeModeInventoryScreen.mouseScrolled: super.mouseScrolled first, then canScroll / subtractInputFromScroll / scrollTo
  • AbstractContainerScreen.onStopHovering → BundleMouseActions.onStopHovering (unselect)

Tests

New test game::bundles::tests::container_screens_offer_the_wheel_to_bundles. The wheel dispatch runs in window_event, and the binary has no test fixture for a Game, so the in-game run below covers the event path itself.

Before, with only takes_bundle_wheel reverted to main's Screen::Inventory:

test game::bundles::tests::container_screens_offer_the_wheel_to_bundles ... FAILED
thread 'game::bundles::tests::container_screens_offer_the_wheel_to_bundles' panicked at crates\horizon-client\src\game\bundles.rs:123:9:
assertion failed: takes_bundle_wheel(Screen::Creative)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 145 filtered out

After:

test game::bundles::tests::container_screens_offer_the_wheel_to_bundles ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 145 filtered out

In game

I gave a bundle holding 4 stone, 3 dirt and 2 oak logs to hotbar slot 1, then turned the wheel over that slot (horizon-ctl scroll-at, which sends real CursorMoved and MouseWheel window events) and took screenshots:

  • main, creative screen (Building Blocks tab): after two notches no item is highlighted in the tooltip, and the bundle's icon stays the plain bundle.
  • this branch, creative screen: the first notch selects stone, the second dirt. The tooltip highlights the item and the bundle's icon shows it, and the item grid stays where it was. Turning the wheel over the grid instead still scrolls it two rows, and leaving the bundle clears its selection, as onStopHovering does.
  • this branch, survival inventory: two notches select dirt, the same as on main.

Self-check

cargo fmt --all -- --check                                                            # clean
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings           # clean
cargo test --profile fast -p horizon-client --features mods --bin horizon-client game::bundles   # 1 passed
cargo build --profile fast -p horizon-client --features mods --bins                   # ok

(tools/pr_ready.py doesn't run on Windows, so I ran its steps by hand.)

🤖 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/3652 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3211` --- ### 📝 Commits (1) - [`8b8ab7f`](https://github.com/horizon-rust/horizon/commit/8b8ab7fd5d6fd3b6f81273d327512da7272efa7b) The mouse wheel selects a bundle's item in the creative inventory ### 📊 Changes **2 files changed** (+38 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -2) 📝 `crates/horizon-client/src/game/bundles.rs` (+31 -1) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3211 The mouse wheel over a bundle didn't select an item in the creative inventory. The wheel scrolled the creative item grid instead, whether the bundle was in the hotbar row of an item tab or in the inventory tab. **Root cause.** The wheel dispatch in `Game::window_event` (`WindowEvent::MouseWheel`) called `bundle_scroll` only for `Screen::Inventory`. `Screen::Creative` went straight to `creative_screen.wheel`. `tick_bundle_hover` (vanilla's `onStopHovering`, which clears the selection when the cursor leaves the bundle) also only ran on `Screen::Inventory`. In vanilla, `CreativeModeInventoryScreen.mouseScrolled` calls `AbstractContainerScreen.mouseScrolled` first. That offers the wheel to the hovered slot's `ItemSlotMouseAction`s (`BundleMouseActions`), and the screen only scrolls its items when none of them took it. **Fix.** `bundles::takes_bundle_wheel` names the screens that are `AbstractContainerScreen`s: the inventory and container menus, and creative. The wheel dispatch offers the wheel to `bundle_scroll` on all of them before the creative grid, the tweaks or the station scrolling, and `tick_bundle_hover` uses the same check. The bundle slot rules (`bundle_slot`) are unchanged, so the creative screen's own display slots (900+) never take the wheel. About survival: on current main, the survival inventory selects items with the wheel for me (the selected item is highlighted in the tooltip and drawn on the bundle's icon). So the part that's still broken is creative, which the reporter says fails every time. If survival still fails on a nightly with this fix, a note on the mouse or touchpad and the OS would help: it might be a scroll delta this path doesn't see. ## Vanilla reference - `AbstractContainerScreen.mouseScrolled`: `hoveredSlot` with an item → each `ItemSlotMouseAction.matches` / `onMouseScrolled` - `CreativeModeInventoryScreen.mouseScrolled`: `super.mouseScrolled` first, then `canScroll` / `subtractInputFromScroll` / `scrollTo` - `AbstractContainerScreen.onStopHovering` → `BundleMouseActions.onStopHovering` (unselect) ## Tests New test `game::bundles::tests::container_screens_offer_the_wheel_to_bundles`. The wheel dispatch runs in `window_event`, and the binary has no test fixture for a `Game`, so the in-game run below covers the event path itself. Before, with only `takes_bundle_wheel` reverted to main's `Screen::Inventory`: ``` test game::bundles::tests::container_screens_offer_the_wheel_to_bundles ... FAILED thread 'game::bundles::tests::container_screens_offer_the_wheel_to_bundles' panicked at crates\horizon-client\src\game\bundles.rs:123:9: assertion failed: takes_bundle_wheel(Screen::Creative) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 145 filtered out ``` After: ``` test game::bundles::tests::container_screens_offer_the_wheel_to_bundles ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 145 filtered out ``` ## In game I gave a bundle holding 4 stone, 3 dirt and 2 oak logs to hotbar slot 1, then turned the wheel over that slot (`horizon-ctl scroll-at`, which sends real `CursorMoved` and `MouseWheel` window events) and took screenshots: - **main, creative screen (Building Blocks tab):** after two notches no item is highlighted in the tooltip, and the bundle's icon stays the plain bundle. - **this branch, creative screen:** the first notch selects stone, the second dirt. The tooltip highlights the item and the bundle's icon shows it, and the item grid stays where it was. Turning the wheel over the grid instead still scrolls it two rows, and leaving the bundle clears its selection, as `onStopHovering` does. - **this branch, survival inventory:** two notches select dirt, the same as on main. ## Self-check ``` cargo fmt --all -- --check # clean cargo clippy -p horizon-client --features mods --all-targets -- -D warnings # clean cargo test --profile fast -p horizon-client --features mods --bin horizon-client game::bundles # 1 passed cargo build --profile fast -p horizon-client --features mods --bins # ok ``` (`tools/pr_ready.py` doesn't run on Windows, so I ran its steps by hand.) 🤖 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:10:25 +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#5126
No description provided.