[PR #4667] [MERGED] Fix opening chest boats, rafts and container minecarts #5768

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4667
Author: @posok124521
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/entity-chest-open


📝 Commits (4)

  • 56c8af8 Fix opening container vehicles (#4370)
  • a089727 Merge upstream/main into fix/entity-chest-open
  • 45cad03 Fix vehicle container close events and the tick close
  • 5e0af16 Merge remote-tracking branch 'upstream/main' into fix/entity-chest-open

📊 Changes

9 files changed (+465 additions, -51 deletions)

View changed files

📝 crates/horizon-client-render/src/containers.rs (+22 -0)
📝 crates/horizon-client/examples/probe/main.rs (+2 -0)
➕ crates/horizon-client/examples/probe/vehicle_container_fixture.rs (+33 -0)
📝 crates/horizon-client/src/game/boats.rs (+59 -16)
📝 crates/horizon-client/src/game/lan_actions.rs (+117 -4)
📝 crates/horizon-client/src/game/minecarts.rs (+27 -26)
📝 crates/horizon-client/src/game/remote.rs (+6 -5)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaVehicleContainerOracle.java (+148 -0)
➕ tools/test_vehicle_container_parity.py (+51 -0)

📄 Description

🤖 Opened by posok124521's AI agent (DeepSeek 4.1 Flash), not by posok124521 personally.

What this fixes

Right-clicking a chest boat, a chest raft, a chest minecart or a hopper minecart
did nothing: the server-side container path (Game::lan_open_container, shared
by single-player and LAN guests) only knew block containers, so the vehicle's
placeholder key never became a menu. Refs #4370; the issue's other half (the
copper golem/chest animation) is not touched here.

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 26.3 followed

  • AbstractChestBoat.interact: super.interact first, then ContainerEntity.interactWithContainerVehicle; success fires CONTAINER_OPEN + PiglinAi.angerNearbyPiglins.
  • ContainerEntity.interactWithContainerVehicle: player.openMenu(this); return SUCCESS;.
  • AbstractMinecartContainer.interact: only interactWithContainerVehicle (no sneak check, no mount).
  • MinecartChest.interact/stopOpen: overrides firing CONTAINER_OPEN + piglin anger and CONTAINER_CLOSE; MinecartHopper overrides neither (no events).
  • AbstractChestBoat.createMenu/MinecartChest.createMenu: ChestMenu.threeRows (9x3, 27); MinecartHopper.createMenu: HopperMenu (5).
  • MenuProvider.getDisplayName + Entity.getDisplayName: the vehicle's custom name, else the entity type's name key (entity.minecraft.<type>).
  • Entity.gameEvent(event, source): level().gameEvent(source, event, this.position) - the entity's own position, no + 0.5.
  • AbstractChestBoat.stopOpen/MinecartChest.stopOpen: CONTAINER_CLOSE at position() with the closing player's context; no sound anywhere in 26.3.
  • ServerPlayer.tick -> !containerMenu.stillValid(this) -> closeContainer -> doCloseContainer -> containerMenu.removed(this) -> ChestMenu.removed -> container.stopOpen(player): the reach/destroyed close fires CONTAINER_CLOSE too; HopperMenu.removed -> hopper.stopOpen is a no-op event-wise.
  • HasCustomInventoryScreen + ServerboundPlayerCommandPacket.OPEN_INVENTORY: ServerGamePacketListenerImpl.handlePlayerCommand opens the ridden vehicle's screen; AbstractChestBoat.openCustomInventoryScreen also fires CONTAINER_OPEN.
  • AbstractChestBoat.remove: Containers.dropContents for every destroying removal reason, with no entity_drops gate (creative discard included); VehicleEntity.hurtServer/destroy keep the boat item on the entity_drops death path only.
  • MinecartFurnace.interact only adds fuel: a furnace minecart is not a container in 26.3, nothing opens.

What changed

  • crates/horizon-client-render/src/containers.rs: vehicle_menu (menu type + size: 9x3/27 or hopper/5) and vehicle_menu_name (title key), shared by the live path and the harness.
  • crates/horizon-client/src/game/boats.rs: open_chest_boat_container (+CONTAINER_OPEN at the boat's own position, piglin anger), open_ridden_chest_boat, riding_chest_boat; hurt_boat spills the chest on any destroying removal.
  • crates/horizon-client/src/game/minecarts.rs: open_cart_container; chest minecart gets CONTAINER_OPEN+anger, hopper minecart none; no chest open/close sound.
  • crates/horizon-client/src/game/lan_actions.rs: vehicle branch in lan_open_container (menu/title/slots from the vehicle), OPEN_INVENTORY fallback to the ridden chest boat, and one close_guest_vehicle_menu helper (store slots, remove placeholder, CONTAINER_CLOSE at the vehicle's raw position for chest boats/chest minecarts only, no event for hopper) called from both S::ContainerClose and the lan_containers_tick stillValid close.
  • crates/horizon-client/src/game/remote.rs: E while riding a chest boat sends OPEN_INVENTORY instead of opening the player inventory.
  • tools/test_vehicle_container_parity.py + VanillaVehicleContainerOracle + vehicle_container_fixture: compares the vanilla createMenu result with ours.

Oracle / harness

test_vehicle_container_parity.py: 13/13 cases match (10 chest boats, bamboo raft, chest minecart, hopper minecart: menu type, slot count, title key).
Harness limit, honest: it covers the menu table only - it cannot see CONTAINER_OPEN/CONTAINER_CLOSE event positions or the tick-close store/placeholder removal, so those are covered by the live measurements below, not by this harness.

Live measurements (LAN host + guest, isolated run dirs)

Measured on the final merged tree; anything not measured is marked deduced.

  • Out-of-range close while the guest carries the boat's stack: guest picks up the 5 stone, host teleports the guest away -> menu closes, boat Items is [], guest inventory has 5, no duplication. (Measured.)
  • Boat destroyed under the open menu: exactly one 5-stone item stack drops, guest menu closes; no extra stack. (Measured.)
  • CONTAINER_OPEN/CONTAINER_CLOSE positions equal the vehicle's raw position: the event call sites use b.position/c.position with no + 0.5 (source-inspected, not instrumented: horizon-ctl cannot observe game-event positions). (Deduced from source.)

Earlier before/after live game checks (measured on the pre-merge fix commit, diff stashed):

case before after
oak chest boat, sneak+click playing (nothing) container, "Oak Boat with Chest", 27
bamboo chest raft, sneak+click playing container, "Bamboo Raft with Chest", 27
chest minecart, click playing container, "Minecart with Chest", 27
hopper minecart, click playing container, "Minecart with Hopper", 5
riding + E on chest boat player inventory container, "Oak Boat with Chest", 27

Checks

Toolchain: CI installs unpinned rustup stable (no rust-toolchain.toml); local Windows is rustc/clippy 1.99.1.
pr_ready --base upstream/main on the final merged tree (block pasted unchanged):

pr_ready (tools/pr_ready.py --base upstream/main on chi4a, against upstream/main at c7dcaf2b7, 12 min 50 s)

Check Result
Scope ✅ 9 files, +465 −51
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (1 min 32 s)
rustfmt ✅ (16 s)
clippy ❌ failed (12 s)
tests: horizon-client, horizon-client-render ✅ 2041 passed (10 min 39 s)
doc tests ✅ 0 passed (4 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 ❌ 368 affected, (3 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The table's tests row counts all test targets (cargo test --tests, 2041 passed); the separate run below is --lib only and reports 937 + 697 passed.

Notes on the rows above (outside the pasted block):

  • Parity ❌ is the Windows environment: the gate imports POSIX fcntl (tools/parity.py:730) and cannot run on this machine; CI runs it on Ubuntu.
  • clippy ❌ in the pasted block is the workspace-wide run without the local allow; it stops on missing_const_for_thread_local in untouched Windows-expanded code (horizon-core/src/paletted.rs:130, horizon-client-render/src/{collisions,crash,spans,widgets}.rs). Scoped touched-crates run with -A clippy::missing_const_for_thread_local (exact command, TMP set to a writable dir):
    cargo +stable-x86_64-pc-windows-gnu clippy -p horizon-client -p horizon-client-render --all-targets -- -D warnings -A clippy::missing_const_for_thread_local
    -> exit 0, no diagnostics in the 9 changed files. CI's clippy on main is green on Ubuntu with the same unpinned stable 1.99.1.
  • tests row: re-ran separately on the same tree, exact command
    cargo +stable-x86_64-pc-windows-gnu test -p horizon-client -p horizon-client-render --lib
    -> exit 0, 937 + 697 passed, 0 failed, 22/21 ignored. Clean base (upstream/main, c7dcaf2b7 and 68ac6f647) -> exit 0, identical 937 + 697 passed, 0 failed; no difference.
  • rustfmt: cargo +stable-x86_64-pc-windows-gnu fmt --all -- --check -> pass; public tree: python tools/check_public_tree.py -> pass.

Not covered

  • Spectator: Horizon rejects spectator entity interacts before the container (general gap, separate issue).
  • Custom vehicle names / team-hover title styling: vehicles keep no custom name; title is the plain type key.
  • Loot-table chest boats: no loot roll for a chest boat with LootTable NBT.
  • /kill on a container vehicle loses its contents (pre-existing, no menu needed).
  • tools/lan_e2e.py could not run on Windows (os.symlink, WinError 1314); CI/Linux runs it.
  • Multiple openers: when one player closes a chest boat or chest minecart, the other opener's menu is closed too (vanilla keeps it open); no items are lost or duplicated (checked live with two clients). Possible follow-up.

Refs #4370


🔄 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/4667 **Author:** [@posok124521](https://github.com/posok124521) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/entity-chest-open` --- ### 📝 Commits (4) - [`56c8af8`](https://github.com/horizon-rust/horizon/commit/56c8af8bd8cb2ab42e9e732093905f8260f7e4c0) Fix opening container vehicles (#4370) - [`a089727`](https://github.com/horizon-rust/horizon/commit/a089727181cafd4504290353383b8acfef832bd7) Merge upstream/main into fix/entity-chest-open - [`45cad03`](https://github.com/horizon-rust/horizon/commit/45cad03deb7357697ffb8509103c87f36bc7296e) Fix vehicle container close events and the tick close - [`5e0af16`](https://github.com/horizon-rust/horizon/commit/5e0af16e1043d99ec2fe3fb062a6eb08fd9ac5df) Merge remote-tracking branch 'upstream/main' into fix/entity-chest-open ### 📊 Changes **9 files changed** (+465 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/containers.rs` (+22 -0) 📝 `crates/horizon-client/examples/probe/main.rs` (+2 -0) ➕ `crates/horizon-client/examples/probe/vehicle_container_fixture.rs` (+33 -0) 📝 `crates/horizon-client/src/game/boats.rs` (+59 -16) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+117 -4) 📝 `crates/horizon-client/src/game/minecarts.rs` (+27 -26) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -5) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaVehicleContainerOracle.java` (+148 -0) ➕ `tools/test_vehicle_container_parity.py` (+51 -0) </details> ### 📄 Description > 🤖 Opened by posok124521's AI agent (DeepSeek 4.1 Flash), not by posok124521 personally. ## What this fixes Right-clicking a chest boat, a chest raft, a chest minecart or a hopper minecart did nothing: the server-side container path (`Game::lan_open_container`, shared by single-player and LAN guests) only knew block containers, so the vehicle's placeholder key never became a menu. Refs #4370; the issue's other half (the copper golem/chest animation) is not touched here. ## 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 26.3 followed - `AbstractChestBoat.interact`: `super.interact` first, then `ContainerEntity.interactWithContainerVehicle`; success fires `CONTAINER_OPEN` + `PiglinAi.angerNearbyPiglins`. - `ContainerEntity.interactWithContainerVehicle`: `player.openMenu(this); return SUCCESS;`. - `AbstractMinecartContainer.interact`: only `interactWithContainerVehicle` (no sneak check, no mount). - `MinecartChest.interact`/`stopOpen`: overrides firing `CONTAINER_OPEN` + piglin anger and `CONTAINER_CLOSE`; `MinecartHopper` overrides neither (no events). - `AbstractChestBoat.createMenu`/`MinecartChest.createMenu`: `ChestMenu.threeRows` (9x3, 27); `MinecartHopper.createMenu`: `HopperMenu` (5). - `MenuProvider.getDisplayName` + `Entity.getDisplayName`: the vehicle's custom name, else the entity type's name key (`entity.minecraft.<type>`). - `Entity.gameEvent(event, source)`: `level().gameEvent(source, event, this.position)` - the entity's own position, no `+ 0.5`. - `AbstractChestBoat.stopOpen`/`MinecartChest.stopOpen`: `CONTAINER_CLOSE` at `position()` with the closing player's context; no sound anywhere in 26.3. - `ServerPlayer.tick` -> `!containerMenu.stillValid(this)` -> `closeContainer` -> `doCloseContainer` -> `containerMenu.removed(this)` -> `ChestMenu.removed` -> `container.stopOpen(player)`: the reach/destroyed close fires `CONTAINER_CLOSE` too; `HopperMenu.removed` -> `hopper.stopOpen` is a no-op event-wise. - `HasCustomInventoryScreen` + `ServerboundPlayerCommandPacket.OPEN_INVENTORY`: `ServerGamePacketListenerImpl.handlePlayerCommand` opens the ridden vehicle's screen; `AbstractChestBoat.openCustomInventoryScreen` also fires `CONTAINER_OPEN`. - `AbstractChestBoat.remove`: `Containers.dropContents` for every destroying removal reason, with no `entity_drops` gate (creative discard included); `VehicleEntity.hurtServer`/`destroy` keep the boat item on the `entity_drops` death path only. - `MinecartFurnace.interact` only adds fuel: a furnace minecart is not a container in 26.3, nothing opens. ## What changed - `crates/horizon-client-render/src/containers.rs`: `vehicle_menu` (menu type + size: 9x3/27 or hopper/5) and `vehicle_menu_name` (title key), shared by the live path and the harness. - `crates/horizon-client/src/game/boats.rs`: `open_chest_boat_container` (+`CONTAINER_OPEN` at the boat's own position, piglin anger), `open_ridden_chest_boat`, `riding_chest_boat`; `hurt_boat` spills the chest on any destroying removal. - `crates/horizon-client/src/game/minecarts.rs`: `open_cart_container`; chest minecart gets `CONTAINER_OPEN`+anger, hopper minecart none; no chest open/close sound. - `crates/horizon-client/src/game/lan_actions.rs`: vehicle branch in `lan_open_container` (menu/title/slots from the vehicle), `OPEN_INVENTORY` fallback to the ridden chest boat, and one `close_guest_vehicle_menu` helper (store slots, remove placeholder, `CONTAINER_CLOSE` at the vehicle's raw position for chest boats/chest minecarts only, no event for hopper) called from both `S::ContainerClose` and the `lan_containers_tick` stillValid close. - `crates/horizon-client/src/game/remote.rs`: E while riding a chest boat sends `OPEN_INVENTORY` instead of opening the player inventory. - `tools/test_vehicle_container_parity.py` + `VanillaVehicleContainerOracle` + `vehicle_container_fixture`: compares the vanilla `createMenu` result with ours. ## Oracle / harness `test_vehicle_container_parity.py`: **13/13** cases match (10 chest boats, bamboo raft, chest minecart, hopper minecart: menu type, slot count, title key). Harness limit, honest: it covers the menu table only - it cannot see `CONTAINER_OPEN`/`CONTAINER_CLOSE` event positions or the tick-close store/placeholder removal, so those are covered by the live measurements below, not by this harness. ## Live measurements (LAN host + guest, isolated run dirs) Measured on the final merged tree; anything not measured is marked deduced. - Out-of-range close while the guest carries the boat's stack: guest picks up the 5 stone, host teleports the guest away -> menu closes, boat `Items` is `[]`, guest inventory has 5, **no duplication**. (Measured.) - Boat destroyed under the open menu: exactly one 5-stone item stack drops, guest menu closes; no extra stack. (Measured.) - `CONTAINER_OPEN`/`CONTAINER_CLOSE` positions equal the vehicle's raw position: the event call sites use `b.position`/`c.position` with no `+ 0.5` (source-inspected, not instrumented: horizon-ctl cannot observe game-event positions). (Deduced from source.) Earlier before/after live game checks (measured on the pre-merge fix commit, diff stashed): | case | before | after | | --- | --- | --- | | oak chest boat, sneak+click | `playing` (nothing) | `container`, "Oak Boat with Chest", 27 | | bamboo chest raft, sneak+click | `playing` | `container`, "Bamboo Raft with Chest", 27 | | chest minecart, click | `playing` | `container`, "Minecart with Chest", 27 | | hopper minecart, click | `playing` | `container`, "Minecart with Hopper", 5 | | riding + E on chest boat | player inventory | `container`, "Oak Boat with Chest", 27 | ## Checks Toolchain: CI installs unpinned rustup `stable` (no `rust-toolchain.toml`); local Windows is rustc/clippy 1.99.1. `pr_ready --base upstream/main` on the final merged tree (block pasted unchanged): **pr_ready** (`tools/pr_ready.py --base upstream/main` on chi4a, against upstream/main at c7dcaf2b7, 12 min 50 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +465 −51 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (1 min 32 s) | | rustfmt | ✅ (16 s) | | clippy | ❌ failed (12 s) | | tests: horizon-client, horizon-client-render | ✅ 2041 passed (10 min 39 s) | | doc tests | ✅ 0 passed (4 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 | ❌ 368 affected, (3 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The table's tests row counts all test targets (`cargo test --tests`, 2041 passed); the separate run below is `--lib` only and reports 937 + 697 passed. Notes on the rows above (outside the pasted block): - **Parity ❌** is the Windows environment: the gate imports POSIX `fcntl` (`tools/parity.py:730`) and cannot run on this machine; CI runs it on Ubuntu. - **clippy ❌** in the pasted block is the workspace-wide run without the local allow; it stops on `missing_const_for_thread_local` in untouched Windows-expanded code (`horizon-core/src/paletted.rs:130`, `horizon-client-render/src/{collisions,crash,spans,widgets}.rs`). Scoped touched-crates run with `-A clippy::missing_const_for_thread_local` (exact command, TMP set to a writable dir): `cargo +stable-x86_64-pc-windows-gnu clippy -p horizon-client -p horizon-client-render --all-targets -- -D warnings -A clippy::missing_const_for_thread_local` -> **exit 0**, no diagnostics in the 9 changed files. CI's clippy on main is green on Ubuntu with the same unpinned stable 1.99.1. - **tests row**: re-ran separately on the same tree, exact command `cargo +stable-x86_64-pc-windows-gnu test -p horizon-client -p horizon-client-render --lib` -> exit 0, **937 + 697 passed, 0 failed**, 22/21 ignored. Clean base (`upstream/main`, `c7dcaf2b7` and `68ac6f647`) -> exit 0, identical 937 + 697 passed, 0 failed; no difference. - rustfmt: `cargo +stable-x86_64-pc-windows-gnu fmt --all -- --check` -> pass; public tree: `python tools/check_public_tree.py` -> pass. ## Not covered - Spectator: Horizon rejects spectator entity interacts before the container (general gap, separate issue). - Custom vehicle names / team-hover title styling: vehicles keep no custom name; title is the plain type key. - Loot-table chest boats: no loot roll for a chest boat with `LootTable` NBT. - `/kill` on a container vehicle loses its contents (pre-existing, no menu needed). - `tools/lan_e2e.py` could not run on Windows (os.symlink, WinError 1314); CI/Linux runs it. - Multiple openers: when one player closes a chest boat or chest minecart, the other opener's menu is closed too (vanilla keeps it open); no items are lost or duplicated (checked live with two clients). Possible follow-up. Refs #4370 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:52 +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#5768
No description provided.