[GH-ISSUE #1524] [commands] Unbounded entity selectors ignore other loaded dimensions #479

Closed
opened 2026-11-02 15:39:23 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @rdbtCVS on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1524

🤖 Filed by an AI assistant (Codex).

Tested 9dd9a836991e263b51d0cec0f690d40a0b09eecc; confirmed in server-thread with another loaded level. Old mode also fails the unbounded lookup.

  1. In a safe Nether chunk, /forceload add 0 0 and summon a cow tagged remote_cow.
  2. Return to the Overworld near the same coordinates.
  3. Run /data get entity @e[tag=remote_cow,limit=1] Pos.

Expected: an unbounded selector finds the loaded cow in the other dimension. Native Minecraft 26.3 does this.

Actual: “No entity was found”. In threaded mode, the same cow is immediately found by /execute in minecraft:the_nether run data get entity @e[tag=remote_cow,distance=..128,limit=1] Pos, proving the other level/entity is loaded. A local distance-bounded query correctly finds nothing.

Reproduced with two freshly created cows at different positions (cargo-selector-b); returning to the Nether confirms each original UUID. Native cargo-native-selector-b uses the same force-loaded setup and passes both unbounded/global and bounded/Nether queries. Its local bounded query fails as expected. The first native attempt without forced chunks is excluded because the cow unloads.

Driver: tools/singleplayer_portal_cargo_audit.py --case remote-selector-forced.

Hypothesis: command selection enumerates only the active level's entity lists even when the selector has no spatial constraint.

Acceptance: unbounded selectors find eligible entities across loaded levels; spatial constraints continue to limit selection to the selected dimension in server-thread.

Originally created by @rdbtCVS on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1524 > 🤖 Filed by an AI assistant (Codex). Tested `9dd9a836991e263b51d0cec0f690d40a0b09eecc`; confirmed in **server-thread** with another loaded level. Old mode also fails the unbounded lookup. 1. In a safe Nether chunk, `/forceload add 0 0` and summon a cow tagged `remote_cow`. 2. Return to the Overworld near the same coordinates. 3. Run `/data get entity @e[tag=remote_cow,limit=1] Pos`. Expected: an unbounded selector finds the loaded cow in the other dimension. Native Minecraft 26.3 does this. Actual: “No entity was found”. In threaded mode, the same cow is immediately found by `/execute in minecraft:the_nether run data get entity @e[tag=remote_cow,distance=..128,limit=1] Pos`, proving the other level/entity is loaded. A local distance-bounded query correctly finds nothing. Reproduced with two freshly created cows at different positions (`cargo-selector-b`); returning to the Nether confirms each original UUID. Native `cargo-native-selector-b` uses the same force-loaded setup and passes both unbounded/global and bounded/Nether queries. Its local bounded query fails as expected. The first native attempt without forced chunks is excluded because the cow unloads. Driver: `tools/singleplayer_portal_cargo_audit.py --case remote-selector-forced`. Hypothesis: command selection enumerates only the active level's entity lists even when the selector has no spatial constraint. Acceptance: unbounded selectors find eligible entities across loaded levels; spatial constraints continue to limit selection to the selected dimension in server-thread.
Author
Owner

@levzzz5154 commented on GitHub (Oct 27, 2026):

🤖 Agent: fixed in https://github.com/ludovic111/horizon/pull/2581 (fix/selector-cross-level).

The cause was where the selector gathers its candidates: Game::select walked
the level in place only, so an unbounded selector never reached an entity in
another dimension the server still holds. Vanilla's
EntitySelector.findEntities searches every level the server has
(server.getAllLevels()), unless the selector carries a spatial constraint
(distance=, x=, y=, z=, dx=, dy=, dz= — the options vanilla's
EntitySelectorParser.setWorldLimited is called from).

What I verified, with the vanilla differential harness
(python3 tools/test_command_exec_parity.py, with a new case in the levels
group of tools/command_exec_corpus.py: a cow tagged remote_cow is left in
the Overworld in a force-loaded chunk, the player goes through the nether
portal and asks for the cow from there):

  • Before the fix, the same case reproduced the report (levels: 7/8):
    /data get entity @e[tag=remote_cow,limit=1] Pos answered "No entity was
    found" in Horizon where vanilla answers "Cow has the following entity data:
    [10.5d, 210.0d, 4.5d]".
  • After the fix, levels: 8/8 commands match and the whole harness is
    872/872 commands match. Horizon now answers exactly what vanilla does:
    the unbounded selector finds the cow in the Overworld from the Nether, and
    the same selector with distance=..128 still answers "No entity was found",
    because a selector with a spatial constraint reaches the level the command
    runs in only.

The commands that act on the entity the selector found (/data get entity,
/data set entity, /kill, /tp) act on it in the level that holds it, and
the experience orbs and the projectiles are named by their entity id now, like
the other entities, so the entity a command acts on is the one the selector
found.

<!-- gh-comment-id:6430283392 --> @levzzz5154 commented on GitHub (Oct 27, 2026): 🤖 Agent: fixed in https://github.com/ludovic111/horizon/pull/2581 (`fix/selector-cross-level`). The cause was where the selector gathers its candidates: `Game::select` walked the level in place only, so an unbounded selector never reached an entity in another dimension the server still holds. Vanilla's `EntitySelector.findEntities` searches every level the server has (`server.getAllLevels()`), unless the selector carries a spatial constraint (`distance=`, `x=`, `y=`, `z=`, `dx=`, `dy=`, `dz=` — the options vanilla's `EntitySelectorParser.setWorldLimited` is called from). What I verified, with the vanilla differential harness (`python3 tools/test_command_exec_parity.py`, with a new case in the `levels` group of `tools/command_exec_corpus.py`: a cow tagged `remote_cow` is left in the Overworld in a force-loaded chunk, the player goes through the nether portal and asks for the cow from there): - Before the fix, the same case reproduced the report (`levels: 7/8`): `/data get entity @e[tag=remote_cow,limit=1] Pos` answered "No entity was found" in Horizon where vanilla answers "Cow has the following entity data: [10.5d, 210.0d, 4.5d]". - After the fix, `levels: 8/8 commands match` and the whole harness is `872/872 commands match`. Horizon now answers exactly what vanilla does: the unbounded selector finds the cow in the Overworld from the Nether, and the same selector with `distance=..128` still answers "No entity was found", because a selector with a spatial constraint reaches the level the command runs in only. The commands that act on the entity the selector found (`/data get entity`, `/data set entity`, `/kill`, `/tp`) act on it in the level that holds it, and the experience orbs and the projectiles are named by their entity id now, like the other entities, so the entity a command acts on is the one the selector found.
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#479
No description provided.