[PR #5243] [MERGED] Commands: a UUID target finds any entity, not only mobs #6160

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5243
Author: @apeirs
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/uuid-target-any-entity


📝 Commits (3)

  • 3a10d0c Commands: a UUID target finds any entity, not only mobs
  • 917b185 Commands: a reused UUID still resolves, and on owner stays living
  • 433ba6e Merge main into #5243 (main builds again after #5251)

📊 Changes

3 files changed (+53 additions, -27 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/execute.rs (+23 -11)
📝 crates/horizon-client/src/game/scoreboard.rs (+1 -16)
📝 tools/command_exec_corpus.py (+29 -0)

📄 Description

🤖 Opened by apeirs's AI agent (Cursor, Grok 4.7), not by apeirs personally.

What and why

Fixes #4966.

A UUID given as a command target selects any entity in vanilla 26.3. Horizon resolved the UUID in persist.uuids and then kept it only when that id was a mob, so /tp, /kill and /data get entity answered "No entity was found" for a display, a marker, an armor stand, an item, a boat or a minecart.

  • target_with_uuid returns level_entity for an id the level still holds (ServerLevel.getEntity). The map is keyed by id, so a kill and a later summon of the same UUID can both be in it; the lookup skips an id the level no longer holds.
  • The scoreboard's target_of_holder had the same mobs-and-items copy and now calls target_with_uuid.
  • execute ... on owner uses that lookup. OwnableEntity.getOwner goes through EntityReference.getLivingEntity, so this arm keeps a player, a mob, an armor stand or the dragon, and not a marker or a display.

Kind

  • bug: a crash or a breakage
  • parity: Horizon now does what vanilla 26.3 does
  • 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

  • ServerLevel.getEntity(UUID), the lookup EntitySelector.findEntities uses for a UUID target.
  • OwnableEntity.getOwner → EntityReference.getLivingEntity for execute on owner.

Harness: python3 tools/test_command_exec_parity.py --only execute. The execute group covers an armor stand and an item display by UUID (execute if, data get, tp, kill), a marker (execute as), a UUID nobody has, a kill then a re-summon of the same UUID, a wolf whose owner is the armor stand, and a wolf whose owner is a marker.

The first commit on this branch was checked against that harness before these review notes: 934/934 commands matched (issue comment). The new cases have not been run against the oracle from this machine.

Other projects' code

none

Self-check

Not pr_ready. playhorizon is not on the tailnet from here, this machine has no JDK and no prepared .local/minecraft, so the command harness and pr_ready did not run.

Check Result
rustfmt (execute.rs) passed
cargo check -p horizon-client --bin horizon-client passed (IdeaPad, cross-compile)
cargo clippy -p horizon-client --bin horizon-client -- -D warnings passed (42 s)
test_command_exec_parity.py not run

🔄 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/5243 **Author:** [@apeirs](https://github.com/apeirs) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/uuid-target-any-entity` --- ### 📝 Commits (3) - [`3a10d0c`](https://github.com/horizon-rust/horizon/commit/3a10d0c3dd7f2a8c99f5a335b67ec1e7a27fd5e4) Commands: a UUID target finds any entity, not only mobs - [`917b185`](https://github.com/horizon-rust/horizon/commit/917b185ba1bc642d0d4268fd4e3a2df9cb138565) Commands: a reused UUID still resolves, and on owner stays living - [`433ba6e`](https://github.com/horizon-rust/horizon/commit/433ba6ecc398afd71d59b3f346c31927ce5a858d) Merge main into #5243 (main builds again after #5251) ### 📊 Changes **3 files changed** (+53 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/execute.rs` (+23 -11) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+1 -16) 📝 `tools/command_exec_corpus.py` (+29 -0) </details> ### 📄 Description > 🤖 Opened by apeirs's AI agent (Cursor, Grok 4.7), not by apeirs personally. ## What and why Fixes #4966. A UUID given as a command target selects any entity in vanilla 26.3. Horizon resolved the UUID in `persist.uuids` and then kept it only when that id was a mob, so `/tp`, `/kill` and `/data get entity` answered "No entity was found" for a display, a marker, an armor stand, an item, a boat or a minecart. - `target_with_uuid` returns `level_entity` for an id the level still holds (`ServerLevel.getEntity`). The map is keyed by id, so a kill and a later summon of the same UUID can both be in it; the lookup skips an id the level no longer holds. - The scoreboard's `target_of_holder` had the same mobs-and-items copy and now calls `target_with_uuid`. - `execute ... on owner` uses that lookup. `OwnableEntity.getOwner` goes through `EntityReference.getLivingEntity`, so this arm keeps a player, a mob, an armor stand or the dragon, and not a marker or a display. ## Kind - [x] bug: a crash or a breakage - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] 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 - `ServerLevel.getEntity(UUID)`, the lookup `EntitySelector.findEntities` uses for a UUID target. - `OwnableEntity.getOwner` → `EntityReference.getLivingEntity` for `execute on owner`. Harness: `python3 tools/test_command_exec_parity.py --only execute`. The `execute` group covers an armor stand and an item display by UUID (`execute if`, `data get`, `tp`, `kill`), a marker (`execute as`), a UUID nobody has, a kill then a re-summon of the same UUID, a wolf whose owner is the armor stand, and a wolf whose owner is a marker. The first commit on this branch was checked against that harness before these review notes: 934/934 commands matched (issue comment). The new cases have not been run against the oracle from this machine. ## Other projects' code none ## Self-check Not `pr_ready`. playhorizon is not on the tailnet from here, this machine has no JDK and no prepared `.local/minecraft`, so the command harness and `pr_ready` did not run. | Check | Result | | --- | --- | | rustfmt (`execute.rs`) | passed | | `cargo check -p horizon-client --bin horizon-client` | passed (IdeaPad, cross-compile) | | `cargo clippy -p horizon-client --bin horizon-client -- -D warnings` | passed (42 s) | | `test_command_exec_parity.py` | not run | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:15: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#6160
No description provided.