[PR #3410] [MERGED] Suggest the crosshair entity's UUID for entity arguments (#3223) #4961

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3410
Author: @degepie
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/issue-3223-tp-uuid-suggestion


📝 Commits (2)

  • 99207f1 Suggest the crosshair entity's UUID for entity arguments (#3223)
  • 92b8883 Merge main into the branch

📊 Changes

13 files changed (+127 additions, -7 deletions)

View changed files

📝 crates/horizon-client-core/src/registries.rs (+3 -0)
📝 crates/horizon-client/examples/probe/chat_screen_fixture/registries.rs (+1 -0)
📝 crates/horizon-client/examples/probe/command_parse_fixture.rs (+1 -0)
📝 crates/horizon-client/src/game/chat.rs (+3 -1)
📝 crates/horizon-client/src/game/lan.rs (+2 -0)
📝 crates/horizon-client/src/game/lan_entities.rs (+11 -0)
📝 crates/horizon-client/src/game/pick_entity.rs (+33 -1)
📝 crates/horizon-client/src/lan/entity.rs (+3 -0)
📝 crates/horizon-command/src/args.rs (+8 -3)
📝 crates/horizon-command/src/selector.rs (+2 -1)
📝 crates/horizon-command/src/tests.rs (+55 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChatScreenOracle.java (+1 -1)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCommandParseOracle.java (+4 -0)

📄 Description

🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally.

Fixes #3223.

What

Looking at a mob and typing /tp now suggests that mob's UUID first, like vanilla does. Picking it and running /tp <uuid> x y z moves exactly that mob.

Getting this to work took three small fixes, because a suggested UUID is only useful if the server can resolve it:

  1. Client suggestion. Entity arguments (EntityArgument, but not the players-only kind) now add the UUID of the entity under the crosshair to the player names.
  2. The tracked entity's UUID. The integrated, LAN and dedicated server's entity tracker sent a made-up UUID in AddEntity (entity_uuid(id) = 48565a4e-0000-0000-0000-<id>). The client therefore knew every mob by a UUID the server didn't recognise. The tracker now sends the entity's own UUID, the same one /data get entity … UUID and saves report. It is assigned the first time the entity is tracked.
  3. UUID selectors. For a UUID, EntitySelectorParser.parseNameOrUUID also filled in player_name. select checks player_name first and looks only among players, so any /tp <uuid> …, /data get entity <uuid> and so on answered "No entity was found". Now only the entity UUID is set, as in vanilla.

Vanilla

Read with tools/rea_vanilla.py from the pinned 26.3 jars:

  • net.minecraft.commands.arguments.EntityArgument.listSuggestions: playersOnly ? getOnlinePlayerNames() : Iterables.concat(getOnlinePlayerNames(), getSelectedEntities()). callers SharedSuggestionProvider getSelectedEntities finds this lambda as its only caller, so GameProfileArgument and ScoreHolderArgument are left unchanged.
  • net.minecraft.client.multiplayer.ClientSuggestionProvider.getSelectedEntities: Minecraft.hitResult of type ENTITY → Collections.singleton(entity.getStringUUID()), otherwise empty.
  • net.minecraft.client.gui.components.CommandSuggestions.sortSuggestions: decides the list order.
  • net.minecraft.network.protocol.game.ClientboundAddEntityPacket.<init>(Entity, ServerEntity, int): sends entity.getUUID().
  • net.minecraft.commands.arguments.selector.EntitySelectorParser.parseNameOrUUID: a UUID sets entityUUID and includesEntities and never playerName. EntitySelector.findEntities checks playerName before entityUUID.

How

  • horizon-client-core Registries: new selected_entities.
  • horizon-command args.rs: in ArgType::Entity { players: false }, the selected entities join the player names. selector.rs: parse_name_or_uuid no longer sets player_name for a UUID.
  • game/pick_entity.rs: new crosshair_entity_uuid. It finds the nearest entity hit before any block, the same way pick_entity_hit does (remote objects, mobs, LAN guests, redirectable projectiles, the dragon), and returns its UUID. game/chat.rs refresh_dynamic_registries fills selected_entities with it when the chat opens, next to target_block.
  • game/lan_entities.rs lan_entity_uuids sets each tracked state's UUID to uuid_for(id) after the states are built (both call sites in game/lan.rs). lan/entity.rs gains States::as_mut_slice. random_uuid uses the clock and the process id, not a world RNG, so no vanilla random order changes.
  • Harnesses: VanillaCommandParseOracle and VanillaChatScreenOracle now return a fixed UUID from getSelectedEntities, and it is exported as selected_entities in registries.json. command_parse_fixture and chat_screen_fixture read it, so both harnesses now compare entity-argument suggestions that include a selected entity.

Verified

  • Before (released v0.2.91, scratch home, server-thread single player): summoned a pig, look-at-entity, opened chat and typed /tp . The list showed only @a @e @n @p @r @s Player… ~ ~ ~ ~ ~ ~, with no UUID.
  • Intermediate build (client half only): the list showed 48565a4e-0000-0000-0000-0000000000d5, the tracker's made-up UUID. /tp with it, and with the pig's real UUID from /data get, both answered "No entity was found". That is how fixes 2 and 3 were found.
  • After (this branch, release build, scratch home, server-thread single player): pig summoned and aimed at, /tp typed.
    • The list starts with 82d75be0-fcca-4e6d-8c9a-9a22a74bf191, the pig's UUID as /data get entity @n[type=pig] UUID reports it ([I; -2099815456, -53850515, -1936025054, -1488195183]).
    • Typing /tp 82d7, Tab, then ~ ~2 ~ and Enter gave "Teleported Pig to -21.500000, 67.000000, 7.500000". horizon-ctl entities showed the pig moved from (-21.5, 65, 10.5) to (-21.5, 67, 7.5).
  • Unit tests (horizon-command):
    • entity_arguments_suggest_the_selected_entity: tp and kill get the UUID, sorted first. gamemode creative , op and scoreboard players set do not.
    • a_uuid_selects_by_entity_uuid: checks the selector fields for a UUID and for a name.
  • Harnesses run locally: python3 tools/parity.py command_parse chat_screen server_entities, 3 passed. chat_screen also passed on its own with the oracle change, before the server-side fixes.
  • Not verified: the in-frame path (--in-frame), LAN guests, and entities other than a mob (boats, item frames). The tracker change covers every tracked state, but I only tested a pig. The suggestion list's highlighted row was on @a, not the UUID row, in the screenshots. The mouse was resting over that row, and chat_screen (which compares the list against vanilla with a selected entity) passes, but I didn't confirm the hover in game.

pr_ready (tools/pr_ready.py --quick on b550, against origin/main at abd1755f9, 8 min 51 s)

Check Result
Scope ✅ 13 files, +127 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 405 passed (1 min 5 s)
rustfmt ✅ (12 s)
clippy ✅ (2 min 56 s)
tests: horizon-client, horizon-client-core, horizon-command ✅ 1341 passed (3 min 49 s)
doc tests ✅ 0 passed (48 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 ➖ 347 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 335 more
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/3410 **Author:** [@degepie](https://github.com/degepie) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/issue-3223-tp-uuid-suggestion` --- ### 📝 Commits (2) - [`99207f1`](https://github.com/horizon-rust/horizon/commit/99207f16b1d23d6b9bfc48a03ad1a19f106f21e1) Suggest the crosshair entity's UUID for entity arguments (#3223) - [`92b8883`](https://github.com/horizon-rust/horizon/commit/92b88830392cbb31adaf5c2cd0d1a4267d4eaaf6) Merge main into the branch ### 📊 Changes **13 files changed** (+127 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/registries.rs` (+3 -0) 📝 `crates/horizon-client/examples/probe/chat_screen_fixture/registries.rs` (+1 -0) 📝 `crates/horizon-client/examples/probe/command_parse_fixture.rs` (+1 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+3 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+11 -0) 📝 `crates/horizon-client/src/game/pick_entity.rs` (+33 -1) 📝 `crates/horizon-client/src/lan/entity.rs` (+3 -0) 📝 `crates/horizon-command/src/args.rs` (+8 -3) 📝 `crates/horizon-command/src/selector.rs` (+2 -1) 📝 `crates/horizon-command/src/tests.rs` (+55 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChatScreenOracle.java` (+1 -1) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCommandParseOracle.java` (+4 -0) </details> ### 📄 Description > 🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally. Fixes #3223. ## What Looking at a mob and typing `/tp ` now suggests that mob's UUID first, like vanilla does. Picking it and running `/tp <uuid> x y z` moves exactly that mob. Getting this to work took three small fixes, because a suggested UUID is only useful if the server can resolve it: 1. **Client suggestion.** Entity arguments (`EntityArgument`, but not the players-only kind) now add the UUID of the entity under the crosshair to the player names. 2. **The tracked entity's UUID.** The integrated, LAN and dedicated server's entity tracker sent a made-up UUID in `AddEntity` (`entity_uuid(id)` = `48565a4e-0000-0000-0000-<id>`). The client therefore knew every mob by a UUID the server didn't recognise. The tracker now sends the entity's own UUID, the same one `/data get entity … UUID` and saves report. It is assigned the first time the entity is tracked. 3. **UUID selectors.** For a UUID, `EntitySelectorParser.parseNameOrUUID` also filled in `player_name`. `select` checks `player_name` first and looks only among players, so any `/tp <uuid> …`, `/data get entity <uuid>` and so on answered "No entity was found". Now only the entity UUID is set, as in vanilla. ## Vanilla Read with `tools/rea_vanilla.py` from the pinned 26.3 jars: - `net.minecraft.commands.arguments.EntityArgument.listSuggestions`: `playersOnly ? getOnlinePlayerNames() : Iterables.concat(getOnlinePlayerNames(), getSelectedEntities())`. `callers SharedSuggestionProvider getSelectedEntities` finds this lambda as its only caller, so `GameProfileArgument` and `ScoreHolderArgument` are left unchanged. - `net.minecraft.client.multiplayer.ClientSuggestionProvider.getSelectedEntities`: `Minecraft.hitResult` of type `ENTITY` → `Collections.singleton(entity.getStringUUID())`, otherwise empty. - `net.minecraft.client.gui.components.CommandSuggestions.sortSuggestions`: decides the list order. - `net.minecraft.network.protocol.game.ClientboundAddEntityPacket.<init>(Entity, ServerEntity, int)`: sends `entity.getUUID()`. - `net.minecraft.commands.arguments.selector.EntitySelectorParser.parseNameOrUUID`: a UUID sets `entityUUID` and `includesEntities` and never `playerName`. `EntitySelector.findEntities` checks `playerName` before `entityUUID`. ## How - `horizon-client-core` `Registries`: new `selected_entities`. - `horizon-command` `args.rs`: in `ArgType::Entity { players: false }`, the selected entities join the player names. `selector.rs`: `parse_name_or_uuid` no longer sets `player_name` for a UUID. - `game/pick_entity.rs`: new `crosshair_entity_uuid`. It finds the nearest entity hit before any block, the same way `pick_entity_hit` does (remote objects, mobs, LAN guests, redirectable projectiles, the dragon), and returns its UUID. `game/chat.rs` `refresh_dynamic_registries` fills `selected_entities` with it when the chat opens, next to `target_block`. - `game/lan_entities.rs` `lan_entity_uuids` sets each tracked state's UUID to `uuid_for(id)` after the states are built (both call sites in `game/lan.rs`). `lan/entity.rs` gains `States::as_mut_slice`. `random_uuid` uses the clock and the process id, not a world RNG, so no vanilla random order changes. - Harnesses: `VanillaCommandParseOracle` and `VanillaChatScreenOracle` now return a fixed UUID from `getSelectedEntities`, and it is exported as `selected_entities` in `registries.json`. `command_parse_fixture` and `chat_screen_fixture` read it, so both harnesses now compare entity-argument suggestions that include a selected entity. ## Verified - **Before** (released v0.2.91, scratch home, server-thread single player): summoned a pig, `look-at-entity`, opened chat and typed `/tp `. The list showed only `@a @e @n @p @r @s Player… ~ ~ ~ ~ ~ ~`, with no UUID. - **Intermediate build** (client half only): the list showed `48565a4e-0000-0000-0000-0000000000d5`, the tracker's made-up UUID. `/tp` with it, and with the pig's real UUID from `/data get`, both answered "No entity was found". That is how fixes 2 and 3 were found. - **After** (this branch, release build, scratch home, server-thread single player): pig summoned and aimed at, `/tp ` typed. - The list starts with `82d75be0-fcca-4e6d-8c9a-9a22a74bf191`, the pig's UUID as `/data get entity @n[type=pig] UUID` reports it (`[I; -2099815456, -53850515, -1936025054, -1488195183]`). - Typing `/tp 82d7`, Tab, then ` ~ ~2 ~` and Enter gave "Teleported Pig to -21.500000, 67.000000, 7.500000". `horizon-ctl entities` showed the pig moved from (-21.5, 65, 10.5) to (-21.5, 67, 7.5). - **Unit tests** (`horizon-command`): - `entity_arguments_suggest_the_selected_entity`: `tp ` and `kill ` get the UUID, sorted first. `gamemode creative `, `op ` and `scoreboard players set ` do not. - `a_uuid_selects_by_entity_uuid`: checks the selector fields for a UUID and for a name. - **Harnesses run locally:** `python3 tools/parity.py command_parse chat_screen server_entities`, 3 passed. `chat_screen` also passed on its own with the oracle change, before the server-side fixes. - **Not verified:** the in-frame path (`--in-frame`), LAN guests, and entities other than a mob (boats, item frames). The tracker change covers every tracked state, but I only tested a pig. The suggestion list's highlighted row was on `@a`, not the UUID row, in the screenshots. The mouse was resting over that row, and `chat_screen` (which compares the list against vanilla with a selected entity) passes, but I didn't confirm the hover in game. **pr_ready** (`tools/pr_ready.py --quick` on b550, against origin/main at abd1755f9, 8 min 51 s) | Check | Result | | --- | --- | | Scope | ✅ 13 files, +127 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 405 passed (1 min 5 s) | | rustfmt | ✅ (12 s) | | clippy | ✅ (2 min 56 s) | | tests: horizon-client, horizon-client-core, horizon-command | ✅ 1341 passed (3 min 49 s) | | doc tests | ✅ 0 passed (48 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 | ➖ 347 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 335 more | | 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:09:12 +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#4961
No description provided.