[PR #2561] [MERGED] The container screen's press state does not survive the screen #4425

Closed
opened 2026-11-03 04:17:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2561
Author: @levzzz5154
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/container-press-state-lifetime


📝 Commits (3)

  • 67b6e75 The container screen's press state does not survive the screen
  • 66bec37 Merge remote-tracking branch 'upstream/main' into fix/container-press-state-lifetime
  • 802368f Merge remote-tracking branch 'upstream/main' into fix/container-press-state-lifetime

📊 Changes

3 files changed (+83 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/container_screen.rs (+43 -0)
📝 crates/horizon-client/src/game.rs (+13 -8)
📝 crates/horizon-client/src/menu.rs (+27 -0)

📄 Description

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

What and why

AbstractContainerScreen keeps isQuickCrafting and the quick craft drag it belongs to on the screen, so every screen starts with its own state. Horizon keeps both on Game (inv_clicks, inv_drag, last_inv_click) instead, and until now they were only dropped when the pointer was grabbed again (#2052). A press whose release never arrived — the pointer left the window, or the screen was replaced before the release — therefore kept the quick craft drag running on the next screen: Clicks::press answers None for every later press, so the Shift quick move stopped working and the inventory stopped answering ("After using Shift + Right-Click to move items in chests, it stops working and prevents interaction with inventory items", #1737).

The press state now goes with the pointer: Game::capture drops it whichever way the pointer changes hands (a screen opens, a screen closes, the window loses focus), and Clicks::cancel_drag names the drop. Two tests cover it: the screen's click rules (Clicks) show that a lost release no longer wedges the quick move, and the menu's click rules show that a chest's Shift+Right-Click quick move (a double chest's 54 slots) moves the stack and leaves the menu's state clean, so the next quick move still works.

Fixes #1737

Vanilla reference

  • net.minecraft.client.gui.screens.inventory.AbstractContainerScreen — mouseClicked/mouseReleased keep isQuickCrafting, quickCraftingButton and quickCraftSlots as fields of the screen; a new screen is a new object, so those fields start unset. mouseClicked sets skipNextRelease = false and only starts a quick craft when !this.isQuickCrafting.
  • net.minecraft.client.gui.screens.inventory.AbstractContainerScreen.mouseClicked — quickKey (slotId != -999 && event.hasShiftDown()) picks ContainerInput.QUICK_MOVE, which is the Shift+Right-Click the report is about.
  • net.minecraft.client.gui.screens.inventory.AbstractContainerScreen.mouseReleased — the drag ends the click, and quickCraftToSlots runs the quick craft.
  • net.minecraft.world.inventory.AbstractContainerMenu.quickMoveStack / moveItemStackTo — what the quick move does inside a chest menu (Horizon: horizon_client::menu::Menu::quick_move / move_to).

Self-check

  • cargo test -p horizon-client --lib -- container_screen::tests menu::tests::a_chest_quick_move
    → 7 passed; 0 failed (a_lost_release_does_not_wedge_the_quick_move, a_chest_quick_move_keeps_the_next_one_working, and the five pre-existing click tests).
  • cargo fmt -p horizon-client → clean (the tree was already rustfmt-clean).
  • python3 tools/check_public_tree.py → "Public tree check passed." (run by the commit hook).

🤖 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/2561 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/container-press-state-lifetime` --- ### 📝 Commits (3) - [`67b6e75`](https://github.com/horizon-rust/horizon/commit/67b6e75c0b4361c9aa2fb04ea020410cf0fe5167) The container screen's press state does not survive the screen - [`66bec37`](https://github.com/horizon-rust/horizon/commit/66bec37b55fb14359210adc76e050eb2f1b2ae7f) Merge remote-tracking branch 'upstream/main' into fix/container-press-state-lifetime - [`802368f`](https://github.com/horizon-rust/horizon/commit/802368fb9575f68ed74887915a2927bce406daee) Merge remote-tracking branch 'upstream/main' into fix/container-press-state-lifetime ### 📊 Changes **3 files changed** (+83 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/container_screen.rs` (+43 -0) 📝 `crates/horizon-client/src/game.rs` (+13 -8) 📝 `crates/horizon-client/src/menu.rs` (+27 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why `AbstractContainerScreen` keeps `isQuickCrafting` and the quick craft drag it belongs to **on the screen**, so every screen starts with its own state. Horizon keeps both on `Game` (`inv_clicks`, `inv_drag`, `last_inv_click`) instead, and until now they were only dropped when the pointer was grabbed again (#2052). A press whose release never arrived — the pointer left the window, or the screen was replaced before the release — therefore kept the quick craft drag running on the next screen: `Clicks::press` answers `None` for every later press, so the Shift quick move stopped working and the inventory stopped answering ("After using Shift + Right-Click to move items in chests, it stops working and prevents interaction with inventory items", #1737). The press state now goes with the pointer: `Game::capture` drops it whichever way the pointer changes hands (a screen opens, a screen closes, the window loses focus), and `Clicks::cancel_drag` names the drop. Two tests cover it: the screen's click rules (`Clicks`) show that a lost release no longer wedges the quick move, and the menu's click rules show that a chest's Shift+Right-Click quick move (a double chest's 54 slots) moves the stack and leaves the menu's state clean, so the next quick move still works. Fixes #1737 ## Vanilla reference - `net.minecraft.client.gui.screens.inventory.AbstractContainerScreen` — `mouseClicked`/`mouseReleased` keep `isQuickCrafting`, `quickCraftingButton` and `quickCraftSlots` as **fields of the screen**; a new screen is a new object, so those fields start unset. `mouseClicked` sets `skipNextRelease = false` and only starts a quick craft when `!this.isQuickCrafting`. - `net.minecraft.client.gui.screens.inventory.AbstractContainerScreen.mouseClicked` — `quickKey` (`slotId != -999 && event.hasShiftDown()`) picks `ContainerInput.QUICK_MOVE`, which is the Shift+Right-Click the report is about. - `net.minecraft.client.gui.screens.inventory.AbstractContainerScreen.mouseReleased` — the drag ends the click, and `quickCraftToSlots` runs the quick craft. - `net.minecraft.world.inventory.AbstractContainerMenu.quickMoveStack` / `moveItemStackTo` — what the quick move does inside a chest menu (Horizon: `horizon_client::menu::Menu::quick_move` / `move_to`). ## Self-check - `cargo test -p horizon-client --lib -- container_screen::tests menu::tests::a_chest_quick_move` → `7 passed; 0 failed` (`a_lost_release_does_not_wedge_the_quick_move`, `a_chest_quick_move_keeps_the_next_one_working`, and the five pre-existing click tests). - `cargo fmt -p horizon-client` → clean (the tree was already rustfmt-clean). - `python3 tools/check_public_tree.py` → "Public tree check passed." (run by the commit hook). 🤖 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 04:17:04 +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#4425
No description provided.