[PR #7830] container_screen: the pick-item button clicked and released on a container screen #7849

Open
opened 2026-11-03 07:25:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7830
Author: @MSedgeMC
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: test/container-screen-pick-item


📝 Commits (2)

  • d88da91 container_screen: add the pick-item button's click case
  • 4eeb851 container_screen: generate the pick-item cases

📊 Changes

3 files changed (+79 additions, -15 deletions)

View changed files

📝 crates/horizon-client/examples/probe/container_screen_probe.rs (+6 -2)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContainerScreenOracle.java (+17 -5)
📝 tools/test_container_screen_parity.py (+56 -8)

📄 Description

AbstractContainerScreen.mouseClicked starts by asking this.minecraft.options.keyPickItem.matchesMouse(event) && this.minecraft.player.hasInfiniteMaterials(), and from there treats the click as a clone wherever a normal one would pick something up: with an empty carried stack it sends ContainerInput.CLONE for the hovered slot's index (or -999 outside the window) instead of PICKUP, the Shift QUICK_MOVE or the outside THROW, and a stack in hand starts a quick craft drag whose type is 2 instead of 0 or 1. Such a press also sets skipNextRelease, so the release after it clicks nothing. mouseReleased answers CLONE for the carried stack whenever the event is the pick-item button and the press did not collect a drag — with no infinite-materials test there, so a Survival player's middle release sends a CLONE that the server refuses, where its left release sends PICKUP and its Shift release QUICK_MOVE; the pick-item branch comes before the Shift one, and slot id -1 (over neither the window nor a slot) is cloned too. The button a menu click carries is getContainerClickButton: 1 becomes 0, 3 becomes 1, and the middle 2 stays 2.

Horizon answers all of it on main (Clicks::press and Clicks::release in crates/horizon-client/src/container_screen.rs, reached from the game's inventory_pick_press and inventory_pick_release), and nothing in the suite pressed the third button: tools/test_container_screen_parity.py drew its buttons from 1 and 3 only, and passed false for press's cloning and release's pick_item on every case, so no CLONE ever appeared in the comparison.

The case presses and releases the pick-item button on the screen's one menu slot, outside the window (slot id -999) and over neither (-1), with a carried stack and with an empty hand, with and without infinite materials, with and without Shift, and sometimes with another button's click between the press and the release. Every fourth case is one: 1,000 of the 4,000.

Proven:

  • python3 tools/test_container_screen_parity.py: 4,000 rust-container-screen-parity cases match the pinned client (52,582 output lines). 1,000 of the cases are pick-item clicks (512 of them with infinite materials), 7,086 of their 7,993 events on the middle button, and 540 of those a pick-item press on the slot with an empty hand.
  • With the pick-item arms removed from Clicks::press and Clicks::release (the middle button pressed nothing and no release cloned), the same cases fail: Parity mismatch at output line 46: vanilla='release false true click 7 2 CLONE', Rust='release false true click 7 2 PICKUP', 923 differing cases — 923 of the 1,000 pick-item ones, while the other 3,000 cases still match. Two of them, verbatim:
    • case 3, a ShulkerBoxScreen with "creative":true and the middle button on the slot: vanilla press true false click -999 2 CLONE against Horizon's press true false (a pick-item press outside the window clones the stack it is not holding), and release false true click 7 2 CLONE against release false true click 7 2 PICKUP.
    • case 7: vanilla release false true click 7 2 CLONE where Horizon sent click 7 2 QUICK_MOVE (the Shift the pick-item branch overrides), and press true false click -999 2 CLONE twice against no click.
  • The removal went unnoticed before this case: the same edit to container_screen.rs against the old cases and fixtures still reported 4,000 rust-container-screen-parity cases match the pinned client (58,025 output lines).

Not proven: nothing in a real client; the run is headless, and the screens are the real vanilla classes over a stand-in menu with one slot. The drag itself (mouseDragged, quickCraftToSlots and the per-slot QUICK_CRAFT clicks) is still not exercised, so the type-2 drag a pick-item press with a held stack starts is pinned only as "the press clicks nothing, and a release that collected no drag clones the stack". A double click (the release's PICKUP_ALL and its Shift variant over a container) is not exercised either. The CLONE is compared as the click the screen sends, not as the server's answer to it: nothing here covers a server refusing a Survival player's clone, or the stack a Creative clone puts in hand, which is menu_click's.


🔄 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/7830 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `test/container-screen-pick-item` --- ### 📝 Commits (2) - [`d88da91`](https://github.com/horizon-rust/horizon/commit/d88da91fd9d98101aa9bb516e403fd28a24d4278) container_screen: add the pick-item button's click case - [`4eeb851`](https://github.com/horizon-rust/horizon/commit/4eeb851bdd393fdc1fa7c78f557726ac74b510ad) container_screen: generate the pick-item cases ### 📊 Changes **3 files changed** (+79 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/container_screen_probe.rs` (+6 -2) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContainerScreenOracle.java` (+17 -5) 📝 `tools/test_container_screen_parity.py` (+56 -8) </details> ### 📄 Description `AbstractContainerScreen.mouseClicked` starts by asking `this.minecraft.options.keyPickItem.matchesMouse(event) && this.minecraft.player.hasInfiniteMaterials()`, and from there treats the click as a clone wherever a normal one would pick something up: with an empty carried stack it sends `ContainerInput.CLONE` for the hovered slot's index (or `-999` outside the window) instead of `PICKUP`, the Shift `QUICK_MOVE` or the outside `THROW`, and a stack in hand starts a quick craft drag whose type is 2 instead of 0 or 1. Such a press also sets `skipNextRelease`, so the release after it clicks nothing. `mouseReleased` answers `CLONE` for the carried stack whenever the event is the pick-item button and the press did not collect a drag — with no infinite-materials test there, so a Survival player's middle release sends a CLONE that the server refuses, where its left release sends `PICKUP` and its Shift release `QUICK_MOVE`; the pick-item branch comes before the Shift one, and slot id `-1` (over neither the window nor a slot) is cloned too. The button a menu click carries is `getContainerClickButton`: 1 becomes 0, 3 becomes 1, and the middle 2 stays 2. Horizon answers all of it on `main` (`Clicks::press` and `Clicks::release` in `crates/horizon-client/src/container_screen.rs`, reached from the game's `inventory_pick_press` and `inventory_pick_release`), and nothing in the suite pressed the third button: `tools/test_container_screen_parity.py` drew its buttons from 1 and 3 only, and passed `false` for `press`'s `cloning` and `release`'s `pick_item` on every case, so no `CLONE` ever appeared in the comparison. The case presses and releases the pick-item button on the screen's one menu slot, outside the window (slot id -999) and over neither (-1), with a carried stack and with an empty hand, with and without infinite materials, with and without Shift, and sometimes with another button's click between the press and the release. Every fourth case is one: 1,000 of the 4,000. **Proven:** - `python3 tools/test_container_screen_parity.py`: `4,000 rust-container-screen-parity cases match the pinned client (52,582 output lines)`. 1,000 of the cases are pick-item clicks (512 of them with infinite materials), 7,086 of their 7,993 events on the middle button, and 540 of those a pick-item press on the slot with an empty hand. - With the pick-item arms removed from `Clicks::press` and `Clicks::release` (the middle button pressed nothing and no release cloned), the same cases fail: `Parity mismatch at output line 46: vanilla='release false true click 7 2 CLONE', Rust='release false true click 7 2 PICKUP'`, `923 differing cases` — 923 of the 1,000 pick-item ones, while the other 3,000 cases still match. Two of them, verbatim: - `case 3`, a ShulkerBoxScreen with `"creative":true` and the middle button on the slot: vanilla `press true false click -999 2 CLONE` against Horizon's `press true false` (a pick-item press outside the window clones the stack it is not holding), and `release false true click 7 2 CLONE` against `release false true click 7 2 PICKUP`. - `case 7`: vanilla `release false true click 7 2 CLONE` where Horizon sent `click 7 2 QUICK_MOVE` (the Shift the pick-item branch overrides), and `press true false click -999 2 CLONE` twice against no click. - The removal went unnoticed before this case: the same edit to `container_screen.rs` against the old cases and fixtures still reported `4,000 rust-container-screen-parity cases match the pinned client (58,025 output lines)`. **Not proven:** nothing in a real client; the run is headless, and the screens are the real vanilla classes over a stand-in menu with one slot. The drag itself (`mouseDragged`, `quickCraftToSlots` and the per-slot QUICK_CRAFT clicks) is still not exercised, so the type-2 drag a pick-item press with a held stack starts is pinned only as "the press clicks nothing, and a release that collected no drag clones the stack". A double click (the release's `PICKUP_ALL` and its Shift variant over a container) is not exercised either. The `CLONE` is compared as the click the screen sends, not as the server's answer to it: nothing here covers a server refusing a Survival player's clone, or the stack a Creative clone puts in hand, which is `menu_click`'s. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7849
No description provided.