[PR #1974] [MERGED] Vehicle storage menus edit the vehicle's own items #3903

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1974
Author: @kacpherek
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/1500-vehicle-storage


📝 Commits (1)

  • 21019af Vehicle storage menus edit the vehicle's own items

📊 Changes

3 files changed (+30 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+4 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+24 -11)

📄 Description

Fixes #1500.

What and why

Taking an item out of a chest minecart, hopper minecart or chest boat duplicated it (it was back in the
vehicle on the next open), and putting one in made it disappear.

The vehicle's menu edits a stand-in container (a placeholder key under CART_KEY_Y) that
close_cart_container is meant to copy back to the vehicle on close. But close_container took
self.container first and called close_cart_container only at its end, which then found no open
container and copied nothing; the next open made a fresh stand-in from the vehicle's old items.

Now close_container passes the key it took to close_cart_container, which copies the stand-in back
to the cart or boat (and removes it). For a server's players (server thread, LAN guests), a click in such a
menu also copies the stand-in back at once (store_cart_items), since in vanilla the menu works on the
vehicle's own container.

Vanilla reference

  • ContainerEntity / AbstractMinecartContainer / ChestBoat: the vehicle is the Container its
    ChestMenu / HopperMenu reads and writes, so every slot change is the vehicle's at once.

Checked in game with horizon-ctl (--in-frame), in survival, with the issue's cart
(/summon chest_minecart ~ ~ ~ {Items:[{Slot:0b,id:"minecraft:diamond",count:1}]}) and real menu
shift-clicks, reading the cart with /data get entity:

Step chest minecart hopper minecart
shift-click the diamond out, close cart Items: [], player has 1 reopened menu empty, player has 1
reopen empty, player keeps 1 empty
shift-click it back in, close cart holds 1, player has 0 cart holds 1
reopen 1 in the cart 1 in the cart

(The hopper minecart row reads the menu rather than /data: the hopper cart had also picked up a diamond
dropped by the chest minecart the script killed before it.)

On the server thread I could not open a vehicle's menu from the window with horizon-ctl (the right
click on the cart reached neither the cart nor a menu), so the server-side copy-back is checked by reading
only; that opening problem looks separate from this issue.

No harness covers vehicle storage; the harnesses next to the change still pass:

  • test_container_screen_parity.py: 4,000 cases match the pinned client (58,025 output lines)
  • test_menu_click_parity.py: 8000/8000 cases match
  • test_lan_parity.py: 462 lan-parity cases match the pinned client (531 output lines)

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-H371RFE, against upstream/main at 6df37324f, 1 min 25 s)

Check Result
Scope Ôťů 3 files, +30 Ôłĺ12
Cargo.lock Ôťů unchanged
Public tree Ôťů
Python tests Ô׾ no Python change
rustfmt Ôťů (7 s)
clippy Ôťů (22 s)
tests: horizon-client ÔŁî failed (53 s)
doc tests Ôťů 0 passed (1 s)
tokens.css up to date Ô׾ theme untouched
launcher rustfmt Ô׾ launcher untouched
launcher clippy Ô׾ launcher untouched
launcher tests Ô׾ launcher untouched
Parity Ô׾ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/1974 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1500-vehicle-storage` --- ### 📝 Commits (1) - [`21019af`](https://github.com/horizon-rust/horizon/commit/21019afc2bdfe37454fbe05a609de7ccffc8c5b4) Vehicle storage menus edit the vehicle's own items ### 📊 Changes **3 files changed** (+30 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+4 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+24 -11) </details> ### 📄 Description Fixes #1500. ## What and why Taking an item out of a chest minecart, hopper minecart or chest boat duplicated it (it was back in the vehicle on the next open), and putting one in made it disappear. The vehicle's menu edits a stand-in container (a placeholder key under `CART_KEY_Y`) that `close_cart_container` is meant to copy back to the vehicle on close. But `close_container` took `self.container` first and called `close_cart_container` only at its end, which then found no open container and copied nothing; the next open made a fresh stand-in from the vehicle's old items. Now `close_container` passes the key it took to `close_cart_container`, which copies the stand-in back to the cart or boat (and removes it). For a server's players (server thread, LAN guests), a click in such a menu also copies the stand-in back at once (`store_cart_items`), since in vanilla the menu works on the vehicle's own container. ## Vanilla reference - `ContainerEntity` / `AbstractMinecartContainer` / `ChestBoat`: the vehicle is the `Container` its `ChestMenu` / `HopperMenu` reads and writes, so every slot change is the vehicle's at once. Checked in game with `horizon-ctl` (`--in-frame`), in survival, with the issue's cart (`/summon chest_minecart ~ ~ ~ {Items:[{Slot:0b,id:"minecraft:diamond",count:1}]}`) and real menu shift-clicks, reading the cart with `/data get entity`: | Step | chest minecart | hopper minecart | | --- | --- | --- | | shift-click the diamond out, close | cart `Items: []`, player has 1 | reopened menu empty, player has 1 | | reopen | empty, player keeps 1 | empty | | shift-click it back in, close | cart holds 1, player has 0 | cart holds 1 | | reopen | 1 in the cart | 1 in the cart | (The hopper minecart row reads the menu rather than `/data`: the hopper cart had also picked up a diamond dropped by the chest minecart the script killed before it.) On the server thread I could not open a vehicle's menu from the window with `horizon-ctl` (the right click on the cart reached neither the cart nor a menu), so the server-side copy-back is checked by reading only; that opening problem looks separate from this issue. No harness covers vehicle storage; the harnesses next to the change still pass: - `test_container_screen_parity.py`: 4,000 cases match the pinned client (58,025 output lines) - `test_menu_click_parity.py`: 8000/8000 cases match - `test_lan_parity.py`: 462 lan-parity cases match the pinned client (531 output lines) ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-H371RFE, against upstream/main at 6df37324f, 1 min 25 s) | Check | Result | | --- | --- | | Scope | Ôťů 3 files, +30 Ôłĺ12 | | Cargo.lock | Ôťů unchanged | | Public tree | Ôťů | | Python tests | Ô׾ no Python change | | rustfmt | Ôťů (7 s) | | clippy | Ôťů (22 s) | | tests: horizon-client | ÔŁî failed (53 s) | | doc tests | Ôťů 0 passed (1 s) | | tokens.css up to date | Ô׾ theme untouched | | launcher rustfmt | Ô׾ launcher untouched | | launcher clippy | Ô׾ launcher untouched | | launcher tests | Ô׾ launcher untouched | | Parity | Ô׾ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:08 +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#3903
No description provided.