[GH-ISSUE #3427] Coordinate suggestions use the block behind an entity under the crosshair; /summon-style (Vec3/Vec2) arguments never suggest the hit point #971

Closed
opened 2026-11-02 15:43:14 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @degepie on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3427

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

What happens

  1. Entity under the crosshair. With a mob in front of a block and the crosshair on the mob, typing /setblock suggests the coordinates of the block behind the mob (-28, -28 71, -28 71 8). Vanilla suggests ~, ~ ~, ~ ~ ~ here, because the hit result is an entity, not a block.
  2. Vec3 / Vec2 arguments. Aiming at a block and typing /summon minecraft:pig suggests ~, ~ ~, ~ ~ ~. Vanilla suggests the exact hit point with two decimals, e.g. -28.77, -28.77 73.28, -28.77 73.28 8.00.

What vanilla does

ClientSuggestionProvider.getRelevantCoordinates and ClientSuggestionProvider.getAbsoluteCoordinates (26.3 client jar) only use Minecraft.hitResult when it is a block hit (HitResult.Type.BLOCK); for no hit or an entity hit they fall back to the default ~ ~ ~.

  • getRelevantCoordinates: the hit block's position.
  • getAbsoluteCoordinates: the exact hit point, each coordinate printed with two decimals (%.2f, Locale.ROOT).

Minecraft.hitResult is the entity hit when an entity is closer than the block, so its type is ENTITY and both fall back to ~ ~ ~.

Which one each argument uses (listSuggestions): BlockPosArgument and ColumnPosArgument → getRelevantCoordinates(); Vec3Argument and Vec2Argument → getAbsoluteCoordinates().

Where in Horizon

origin/main 142388e1c (142388e1c136e622652ec7505af15d8ad195e041):

  • crates/horizon-client/src/game/chat.rs:420 refresh_dynamic_registries: target_block = self.pick().map(|h| h.pos). Game::pick (game.rs:2123) is a block-only ray clip; it ignores entities.
  • crates/horizon-command/src/args.rs:802-816 suggest_coordinates: uses reg.target_block when relevant, else ~ ~ ~. Callers args.rs:1671-1672, 1791-1792 pass relevant = false for Vec3 and Vec2, so they never get the hit point; there is no field for it in Registries.

How to reproduce (seen in game)

Current-main release build (071580e71; these files are unchanged up to 142388e1c), server-thread single player, creative, scratch home:

  1. /fill -29 71 8 -26 74 8 minecraft:stone, /summon minecraft:pig -27.5 71 6.5 {NoAI:1b}, stand at (-27.5, 71, 4.5) facing south, pitch 21.
  2. horizon-ctl looking-at reports the pig as the target (block behind it: -28 71 8).
  3. Open chat, type /setblock : suggestions -28, -28 71, -28 71 8. Vanilla: ~, ~ ~, ~ ~ ~.
  4. Look at the wall (yaw 20, pitch -10; hit point -28.77, 73.28, 8.0), type /summon minecraft:pig : suggestions ~, ~ ~, ~ ~ ~. Vanilla: -28.77, -28.77 73.28, -28.77 73.28 8.00.

Notes

  • Fix sketch: fill target_block only when the crosshair's nearest hit is a block (the entity-before-block check pick_entity_hit already does), and add the block hit point for Vec3/Vec2, formatted %.2f with Locale.ROOT.
  • Open PR #3410 (#3223) adds selected_entities next to target_block in refresh_dynamic_registries but doesn't change target_block or the coordinate suggestions. Its crosshair_entity_uuid could serve as the "entity before block" check here.
  • The chat_screen harness's VanillaChatScreenOracle delegates getRelevantCoordinates/getAbsoluteCoordinates to a server CommandSourceStack (the ~ ~ ~ defaults), so no harness exercises a block or entity hit here.
Originally created by @degepie on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3427 > 🤖 Filed by degepie's AI agent (Claude Code), not by degepie personally. ## What happens 1. **Entity under the crosshair.** With a mob in front of a block and the crosshair on the mob, typing `/setblock ` suggests the coordinates of the block *behind* the mob (`-28`, `-28 71`, `-28 71 8`). Vanilla suggests `~`, `~ ~`, `~ ~ ~` here, because the hit result is an entity, not a block. 2. **Vec3 / Vec2 arguments.** Aiming at a block and typing `/summon minecraft:pig ` suggests `~`, `~ ~`, `~ ~ ~`. Vanilla suggests the exact hit point with two decimals, e.g. `-28.77`, `-28.77 73.28`, `-28.77 73.28 8.00`. ## What vanilla does `ClientSuggestionProvider.getRelevantCoordinates` and `ClientSuggestionProvider.getAbsoluteCoordinates` (26.3 client jar) only use `Minecraft.hitResult` when it is a **block** hit (`HitResult.Type.BLOCK`); for no hit or an entity hit they fall back to the default `~ ~ ~`. - `getRelevantCoordinates`: the hit block's position. - `getAbsoluteCoordinates`: the exact hit point, each coordinate printed with two decimals (`%.2f`, `Locale.ROOT`). `Minecraft.hitResult` is the entity hit when an entity is closer than the block, so its type is `ENTITY` and both fall back to `~ ~ ~`. Which one each argument uses (`listSuggestions`): `BlockPosArgument` and `ColumnPosArgument` → `getRelevantCoordinates()`; `Vec3Argument` and `Vec2Argument` → `getAbsoluteCoordinates()`. ## Where in Horizon origin/main 142388e1c (`142388e1c136e622652ec7505af15d8ad195e041`): - `crates/horizon-client/src/game/chat.rs:420` `refresh_dynamic_registries`: `target_block = self.pick().map(|h| h.pos)`. `Game::pick` (`game.rs:2123`) is a block-only ray clip; it ignores entities. - `crates/horizon-command/src/args.rs:802-816` `suggest_coordinates`: uses `reg.target_block` when `relevant`, else `~ ~ ~`. Callers `args.rs:1671-1672, 1791-1792` pass `relevant = false` for `Vec3` and `Vec2`, so they never get the hit point; there is no field for it in `Registries`. ## How to reproduce (seen in game) Current-main release build (071580e71; these files are unchanged up to 142388e1c), server-thread single player, creative, scratch home: 1. `/fill -29 71 8 -26 74 8 minecraft:stone`, `/summon minecraft:pig -27.5 71 6.5 {NoAI:1b}`, stand at (-27.5, 71, 4.5) facing south, pitch 21. 2. `horizon-ctl looking-at` reports the pig as the target (block behind it: -28 71 8). 3. Open chat, type `/setblock `: suggestions `-28`, `-28 71`, `-28 71 8`. Vanilla: `~`, `~ ~`, `~ ~ ~`. 4. Look at the wall (yaw 20, pitch -10; hit point -28.77, 73.28, 8.0), type `/summon minecraft:pig `: suggestions `~`, `~ ~`, `~ ~ ~`. Vanilla: `-28.77`, `-28.77 73.28`, `-28.77 73.28 8.00`. ## Notes - Fix sketch: fill `target_block` only when the crosshair's nearest hit is a block (the entity-before-block check `pick_entity_hit` already does), and add the block hit point for `Vec3`/`Vec2`, formatted `%.2f` with `Locale.ROOT`. - Open PR #3410 (#3223) adds `selected_entities` next to `target_block` in `refresh_dynamic_registries` but doesn't change `target_block` or the coordinate suggestions. Its `crosshair_entity_uuid` could serve as the "entity before block" check here. - The `chat_screen` harness's `VanillaChatScreenOracle` delegates `getRelevantCoordinates`/`getAbsoluteCoordinates` to a server `CommandSourceStack` (the `~ ~ ~` defaults), so no harness exercises a block or entity hit here.
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#971
No description provided.