[PR #5477] [MERGED] Commands reach a chest or hopper minecart's slots #6312

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5477
Author: @k3yh
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/minecart-command-slots


📝 Commits (3)

  • 25f3de6 Commands reach a chest or hopper minecart's slots
  • 37328ff Give unpack_cart_loot its doc comment back
  • d5c2efa A command reaches an open cart's live slots

📊 Changes

3 files changed (+54 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/items.rs (+23 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+17 -1)
📝 tools/command_exec_corpus.py (+14 -0)

📄 Description

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

What and why

No issue: I found this while checking #5307, which I couldn't reproduce on main (a chest minecart opens fine within reach).

/item replace, /item modify, /item replace … from entity and execute if items answered "The target does not have slot container.0" for a chest or hopper minecart. Vanilla reaches its slots: AbstractMinecartContainer.getSlot is ContainerEntity.getChestVehicleSlot, which takes any index below getContainerSize (27 for a chest minecart, 5 for a hopper minecart). Maps and data packs fill minecarts this way.

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

Change

  • commands/items.rs: Slot::Cart(id, index). slots_named gives a cart container.N for each slot below its size, and slot_get / slot_set read and write the cart's items.
  • minecarts.rs: cart_slots(id) returns those items and drops the cart's loot table first. Vanilla's getChestVehicleItem / setChestVehicleItem unpack it with no player, so no player_generates_container_loot fires later. CartKind::slots becomes pub(super).
  • tools/command_exec_corpus.py: the items and loot group gets a chest and a hopper minecart with item replace (in range and one past the end), item modify, item replace … from entity, data get … Items and execute if items.

Vanilla reference

  • AbstractMinecartContainer.getSlot(int) → ContainerEntity.getChestVehicleSlot(int): a SlotAccess when 0 <= slot < getContainerSize(), else null (no such slot). Checked in the 26.3 bytecode with javap.

Test

tools/test_command_exec_parity.py --only "items and loot", which runs each command on vanilla's real implementations and on Horizon:

items and loot
main 9658ee1fe + the new cases 66/74 match. Every minecart case is "does not have slot", where vanilla replaces, modifies, copies or finds the items.
this branch 74/74 match

The same results in game, in single player, comparing vanilla 26.3 (a data pack storing each command's result in a score) with this branch:

command vanilla 26.3 main this branch
chest minecart container.0 1 slot replaced no such slot 1 slot replaced
chest minecart container.26 1 no such slot 1
chest minecart container.27 fails fails fails
hopper minecart container.4 / container.5 1 / fails fails / fails 1 / fails
chest minecart container.* with a stick 1 no such slot 1
execute if items on the hopper minecart 5 fails 5

Self-check

pr_ready (tools/pr_ready.py --quick --base 9658ee1fe on DESKTOP-S9O4938, against 9658ee1fe at 9658ee1fe, 7 min 0 s)

Check Result
Scope ✅ 3 files, +46 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 508 run, FAILED (errors=1, skipped=1) (50 s)
rustfmt ✅ (7 s)
clippy ✅ (52 s)
tests: horizon-client ❌ 1533 passed, 13 failed (5 min 7 s)
doc tests ✅ 0 passed (1 s)
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

Neither failure is in this change:

  • The 13 are all tests/lan_bot.rs (assertion failed: minecraft:dialog in the configuration phase). They fail the same way on 9658ee1fe without this change, on this machine.
  • test_port_ledger cannot import tests.test_class_index, as on main on this machine.

🤖 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/5477 **Author:** [@k3yh](https://github.com/k3yh) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/minecart-command-slots` --- ### 📝 Commits (3) - [`25f3de6`](https://github.com/horizon-rust/horizon/commit/25f3de6290d2b692eea9ea8e6189826a49134ab4) Commands reach a chest or hopper minecart's slots - [`37328ff`](https://github.com/horizon-rust/horizon/commit/37328ff5c76ace7d9b65e0d1ee70a4f581f6b476) Give unpack_cart_loot its doc comment back - [`d5c2efa`](https://github.com/horizon-rust/horizon/commit/d5c2efa9a3574e39bb1cb6ca88088d93035890e9) A command reaches an open cart's live slots ### 📊 Changes **3 files changed** (+54 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/items.rs` (+23 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+17 -1) 📝 `tools/command_exec_corpus.py` (+14 -0) </details> ### 📄 Description > 🤖 Opened by k3yh's AI agent (Claude Code, Claude Opus 5.5), not by k3yh personally. ## What and why No issue: I found this while checking #5307, which I couldn't reproduce on main (a chest minecart opens fine within reach). `/item replace`, `/item modify`, `/item replace … from entity` and `execute if items` answered *"The target does not have slot container.0"* for a chest or hopper minecart. Vanilla reaches its slots: `AbstractMinecartContainer.getSlot` is `ContainerEntity.getChestVehicleSlot`, which takes any index below `getContainerSize` (27 for a chest minecart, 5 for a hopper minecart). Maps and data packs fill minecarts this way. ## Kind - [x] 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 ## Change - `commands/items.rs`: `Slot::Cart(id, index)`. `slots_named` gives a cart `container.N` for each slot below its size, and `slot_get` / `slot_set` read and write the cart's items. - `minecarts.rs`: `cart_slots(id)` returns those items and drops the cart's loot table first. Vanilla's `getChestVehicleItem` / `setChestVehicleItem` unpack it with no player, so no `player_generates_container_loot` fires later. `CartKind::slots` becomes `pub(super)`. - `tools/command_exec_corpus.py`: the `items and loot` group gets a chest and a hopper minecart with `item replace` (in range and one past the end), `item modify`, `item replace … from entity`, `data get … Items` and `execute if items`. ## Vanilla reference - `AbstractMinecartContainer.getSlot(int)` → `ContainerEntity.getChestVehicleSlot(int)`: a `SlotAccess` when `0 <= slot < getContainerSize()`, else `null` (no such slot). Checked in the 26.3 bytecode with `javap`. ## Test `tools/test_command_exec_parity.py --only "items and loot"`, which runs each command on vanilla's real implementations and on Horizon: | | items and loot | |---|---| | main 9658ee1fe + the new cases | 66/74 match. Every minecart case is "does not have slot", where vanilla replaces, modifies, copies or finds the items. | | this branch | 74/74 match | The same results in game, in single player, comparing vanilla 26.3 (a data pack storing each command's result in a score) with this branch: | command | vanilla 26.3 | main | this branch | |---|---|---|---| | chest minecart `container.0` | 1 slot replaced | no such slot | 1 slot replaced | | chest minecart `container.26` | 1 | no such slot | 1 | | chest minecart `container.27` | fails | fails | fails | | hopper minecart `container.4` / `container.5` | 1 / fails | fails / fails | 1 / fails | | chest minecart `container.*` with a stick | 1 | no such slot | 1 | | `execute if items` on the hopper minecart | 5 | fails | 5 | ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base 9658ee1fe` on DESKTOP-S9O4938, against 9658ee1fe at 9658ee1fe, 7 min 0 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +46 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 508 run, FAILED (errors=1, skipped=1) (50 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (52 s) | | tests: horizon-client | ❌ 1533 passed, 13 failed (5 min 7 s) | | doc tests | ✅ 0 passed (1 s) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | Neither failure is in this change: - The 13 are all `tests/lan_bot.rs` (`assertion failed: minecraft:dialog` in the configuration phase). They fail the same way on 9658ee1fe without this change, on this machine. - `test_port_ledger` cannot import `tests.test_class_index`, as on main on this machine. 🤖 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 06:18: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#6312
No description provided.