[PR #4819] [MERGED] /item reaches a connected player's slots #5870

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

📋 Pull Request Information

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

Base: main ← Head: fix-item-command-guest-slots


📝 Commits (1)

  • d65cd8a /item reaches a connected player's slots

📊 Changes

1 file changed (+19 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/items.rs (+19 -1)

📄 Description

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

What and why

Fixes #4818.

/item couldn't reach a connected player. On a dedicated server, item replace entity Alex armor.head with minecraft:iron_helmet from the console answered "The target does not have slot armor.head", and so did every other player slot. execute as Alex run item replace entity @s ... and an operator's command on another player didn't work either.

slots_named only has slots for Target::Player, the player in place; a Target::Guest fell through to Owner::Entity(_) => {}, so it had none. It now asks for_player for that player's slots and wraps each in a new Slot::Guest(conn, slot), and slot_get and slot_set run with that player's state in place, as other commands do for a player who isn't in place. slot_get takes &mut self for this.

Because they share these functions, this should also reach /loot and the other commands that address a player's slots by name; I only ran /item.

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 reference

ItemCommands, through Entity.getSlot and SlotAccess, where a player's slots are the same for every player. CI's parity job picks the harnesses that cover commands/items.rs. I didn't run parity here (no vanilla data on this machine).

Tested in the game

No automated test: this path needs a connected player. Clean main reproduced the error for all seven slots tried. With the fix, on a dedicated server (--dedicated --nogui, Windows) with two real clients, Alex and Steve, under horizon-ctl --offscreen, all 23 checks passed, read from each player's own client:

Command Result
armor.head, armor.chest, weapon.offhand, hotbar.0, inventory.0, enderchest.0 from the console "Replaced 1 slot"; Alex's client shows the armour and items (the ender chest's contents only by the answer), and Steve has none of it
item replace entity Steve hotbar.1 from entity Alex hotbar.0 Steve has the copy, and Alex keeps his
item replace entity @a hotbar.8 with ... both clients show it
item replace entity Alex armor.head with minecraft:air the helmet comes off
execute as Steve run item replace entity @s ... it works
An operator's command on himself, and on the other player both work
An unknown slot still refused

Not tested: a player in another dimension, item modify and /loot on a player, and vanilla's own output beside this.

Self-check

tools/pr_ready.py --quick --base origin/main on Windows. horizon-client doesn't currently build on Windows on main, because #4732 added unsafe to save.rs under #![forbid(unsafe_code)], so I ran this and the game with that one line relaxed locally. It isn't in this pull request, and the table counts it.

pr_ready (tools/pr_ready.py --quick on DESKTOP-H7P5E7K, against origin/main at 3bfec3857, 3 min 52 s)

Check Result
Scope ✅ 2 files, +20 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (1 min 9 s)
rustfmt ✅ (7 s)
clippy ✅ (45 s)
tests: horizon-client ✅ 1227 passed (1 min 44 s)
doc tests ✅ 0 passed (1 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 ➖ 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)

🤖 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/4819 **Author:** [@Qwerner88880](https://github.com/Qwerner88880) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix-item-command-guest-slots` --- ### 📝 Commits (1) - [`d65cd8a`](https://github.com/horizon-rust/horizon/commit/d65cd8af19eb77f16eaf5e9eb4f51628694f85cd) /item reaches a connected player's slots ### 📊 Changes **1 file changed** (+19 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/items.rs` (+19 -1) </details> ### 📄 Description > 🤖 Opened by Qwerner88880's AI agent (Claude Code, Claude Opus 5.5), not by Qwerner88880 personally. ## What and why Fixes #4818. `/item` couldn't reach a connected player. On a dedicated server, `item replace entity Alex armor.head with minecraft:iron_helmet` from the console answered "The target does not have slot armor.head", and so did every other player slot. `execute as Alex run item replace entity @s ...` and an operator's command on another player didn't work either. `slots_named` only has slots for `Target::Player`, the player in place; a `Target::Guest` fell through to `Owner::Entity(_) => {}`, so it had none. It now asks `for_player` for that player's slots and wraps each in a new `Slot::Guest(conn, slot)`, and `slot_get` and `slot_set` run with that player's state in place, as other commands do for a player who isn't in place. `slot_get` takes `&mut self` for this. Because they share these functions, this should also reach `/loot` and the other commands that address a player's slots by name; I only ran `/item`. ## 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 reference `ItemCommands`, through `Entity.getSlot` and `SlotAccess`, where a player's slots are the same for every player. CI's parity job picks the harnesses that cover `commands/items.rs`. I didn't run parity here (no vanilla data on this machine). ## Tested in the game No automated test: this path needs a connected player. Clean main reproduced the error for all seven slots tried. With the fix, on a dedicated server (`--dedicated --nogui`, Windows) with two real clients, Alex and Steve, under `horizon-ctl --offscreen`, all 23 checks passed, read from each player's own client: | Command | Result | | --- | --- | | `armor.head`, `armor.chest`, `weapon.offhand`, `hotbar.0`, `inventory.0`, `enderchest.0` from the console | "Replaced 1 slot"; Alex's client shows the armour and items (the ender chest's contents only by the answer), and Steve has none of it | | `item replace entity Steve hotbar.1 from entity Alex hotbar.0` | Steve has the copy, and Alex keeps his | | `item replace entity @a hotbar.8 with ...` | both clients show it | | `item replace entity Alex armor.head with minecraft:air` | the helmet comes off | | `execute as Steve run item replace entity @s ...` | it works | | An operator's command on himself, and on the other player | both work | | An unknown slot | still refused | **Not tested:** a player in another dimension, `item modify` and `/loot` on a player, and vanilla's own output beside this. ## Self-check `tools/pr_ready.py --quick --base origin/main` on Windows. `horizon-client` doesn't currently build on Windows on main, because #4732 added `unsafe` to `save.rs` under `#![forbid(unsafe_code)]`, so I ran this and the game with that one line relaxed locally. It isn't in this pull request, and the table counts it. **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-H7P5E7K, against origin/main at 3bfec3857, 3 min 52 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +20 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (1 min 9 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (45 s) | | tests: horizon-client | ✅ 1227 passed (1 min 44 s) | | doc tests | ✅ 0 passed (1 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 | ➖ 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) | 🤖 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 05:15:34 +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#5870
No description provided.