[PR #2559] [CLOSED] commands: selectors find the End crystals and the Ender Dragon #4426

Closed
opened 2026-11-03 04:17:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2559
Author: @levzzz5154
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: fix/selector-end-crystals


📝 Commits (3)

  • 8909e05 commands: selectors find the End crystals and the Ender Dragon
  • 04672c9 Merge remote-tracking branch 'upstream/main' into fix/selector-end-crystals
  • e9f3dbb Merge remote-tracking branch 'upstream/main' into fix/selector-end-crystals

📊 Changes

6 files changed (+115 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game/commands.rs (+49 -0)
📝 crates/horizon-client/src/game/commands/data.rs (+10 -0)
📝 crates/horizon-client/src/game/dragon.rs (+22 -2)
📝 crates/horizon-client/src/game/persist.rs (+18 -2)
📝 crates/horizon-client/src/game/scoreboard.rs (+5 -1)
📝 tools/command_exec_corpus.py (+11 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself.

What and why

Game::select gathered its candidates from the ordinary entity collections
only (mobs, dropped, orbs, projectiles, armor stands, item frames,
paintings, boats, carts, the entities Horizon does not simulate). The End
crystals and the Ender Dragon live in their own lists (Game::crystals,
Game::dragon), so @e[type=end_crystal] and @e[type=ender_dragon]
matched nothing: /data get entity and /kill both answered "No entity was
found" and the crystal stayed where it was. Neither had an entity id a
command could name either, so they could not be addressed once found.

The crystals and the dragon now take an id from the entity counter when they
are created (as EndCrystal's and EnderDragon's constructors do), the
selector offers them as candidates with their registry type, and /data get entity reads them and /kill removes them. /summon minecraft:end_crystal
creates one, as vanilla does (EntityTypes.END_CRYSTAL is summonable).

Fixes #1531

Note: this change is also carried by #2581 ("commands: an unbounded selector reaches the other loaded levels"), because both pull requests reshape Game::select in game/commands.rs. Either pull request can be merged first; #2581 contains both.

Vanilla reference

  • net.minecraft.commands.arguments.selector.EntitySelector.findEntities —
    walks the level's entities and matches type= against the entity's
    EntityType; EndCrystal and EnderDragon are entities of the level
    like any other, so a type selector must see them.
  • net.minecraft.commands.arguments.selector.options.EntitySelectorOptions
    ("type") — parser.addPredicate(e -> Objects.equals(type, e.getType()) != inverted)
    and parser.limitToType(type): the match is on the registry type.
  • net.minecraft.world.entity.boss.enderdragon.EndCrystal — its constructor
    takes an id from the entity counter (this.time = this.random.nextInt(100000),
    the id from Entity), and EndCrystal.kill(ServerLevel) removes it
    without a blast (unlike EndCrystal.hurtServer, which explodes).
  • net.minecraft.world.entity.boss.enderdragon.EnderDragon — its constructor
    takes its id and its parts' ids from the entity counter.
  • net.minecraft.world.entity.Entity.kill(ServerLevel) — this.remove(Entity.RemovalReason.KILLED):
    /kill removes the entity, it does not hurt it (the dragon flies its death
    flight when its health runs out, not when it is killed).
  • net.minecraft.server.commands.KillCommand — entity.kill(source.getLevel())
    for every target.

Self-check

python3 tools/test_command_exec_parity.py (the vanilla differential
harness, extended with the End crystal and Ender Dragon cases in the
entities group of tools/command_exec_corpus.py):

entities: 55/55 commands match
total: 879/879 commands match

The new cases, identical in vanilla and in Horizon:

/summon minecraft:end_crystal 4.5 210 8.5   -> Summoned new End Crystal
/execute if entity @e[type=minecraft:end_crystal] -> Test passed. Count: 1
/data get entity @e[type=minecraft:end_crystal,limit=1] Pos -> End Crystal has the following entity data: [4.5d, 210.0d, 8.5d]
/kill @e[type=minecraft:end_crystal]       -> Killed End Crystal
/execute if entity @e[type=minecraft:end_crystal] -> Test failed
/summon minecraft:ender_dragon 4.5 210 8.5 -> Summoned new Ender Dragon
/execute if entity @e[type=minecraft:ender_dragon] -> Test passed. Count: 1
/data get entity @e[type=minecraft:ender_dragon,limit=1] Pos -> Ender Dragon has the following entity data: [4.5d, 210.0d, 8.5d]
/kill @e[type=minecraft:ender_dragon]     -> Killed Ender Dragon

Before the fix, the same harness reported the issue's symptom on those
cases (entities: 46/55 commands match):

/data get entity @e[type=minecraft:end_crystal,limit=1] Pos
  vanilla  End Crystal has the following entity data: [4.5d, 210.0d, 8.5d]
  rust     No entity was found
/kill @e[type=minecraft:ender_dragon]
  vanilla  Killed Ender Dragon
  rust     No entity was found

cargo fmt -p horizon-client (clean) and
cargo build -p horizon-client --bin horizon-client (clean).

🤖 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/2559 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/selector-end-crystals` --- ### 📝 Commits (3) - [`8909e05`](https://github.com/horizon-rust/horizon/commit/8909e0510c4700295514c83c5f61cbd5695d9db7) commands: selectors find the End crystals and the Ender Dragon - [`04672c9`](https://github.com/horizon-rust/horizon/commit/04672c9613918ba128625d4d72163b36ca62ff6e) Merge remote-tracking branch 'upstream/main' into fix/selector-end-crystals - [`e9f3dbb`](https://github.com/horizon-rust/horizon/commit/e9f3dbb2a46c268c5906ae88c73e64017df51d0f) Merge remote-tracking branch 'upstream/main' into fix/selector-end-crystals ### 📊 Changes **6 files changed** (+115 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands.rs` (+49 -0) 📝 `crates/horizon-client/src/game/commands/data.rs` (+10 -0) 📝 `crates/horizon-client/src/game/dragon.rs` (+22 -2) 📝 `crates/horizon-client/src/game/persist.rs` (+18 -2) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+5 -1) 📝 `tools/command_exec_corpus.py` (+11 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why `Game::select` gathered its candidates from the ordinary entity collections only (`mobs`, `dropped`, `orbs`, projectiles, armor stands, item frames, paintings, boats, carts, the entities Horizon does not simulate). The End crystals and the Ender Dragon live in their own lists (`Game::crystals`, `Game::dragon`), so `@e[type=end_crystal]` and `@e[type=ender_dragon]` matched nothing: `/data get entity` and `/kill` both answered "No entity was found" and the crystal stayed where it was. Neither had an entity id a command could name either, so they could not be addressed once found. The crystals and the dragon now take an id from the entity counter when they are created (as `EndCrystal`'s and `EnderDragon`'s constructors do), the selector offers them as candidates with their registry type, and `/data get entity` reads them and `/kill` removes them. `/summon minecraft:end_crystal` creates one, as vanilla does (`EntityTypes.END_CRYSTAL` is summonable). Fixes #1531 Note: this change is also carried by #2581 ("commands: an unbounded selector reaches the other loaded levels"), because both pull requests reshape `Game::select` in `game/commands.rs`. Either pull request can be merged first; #2581 contains both. ## Vanilla reference - `net.minecraft.commands.arguments.selector.EntitySelector.findEntities` — walks the level's entities and matches `type=` against the entity's `EntityType`; `EndCrystal` and `EnderDragon` are entities of the level like any other, so a type selector must see them. - `net.minecraft.commands.arguments.selector.options.EntitySelectorOptions` (`"type"`) — `parser.addPredicate(e -> Objects.equals(type, e.getType()) != inverted)` and `parser.limitToType(type)`: the match is on the registry type. - `net.minecraft.world.entity.boss.enderdragon.EndCrystal` — its constructor takes an id from the entity counter (`this.time = this.random.nextInt(100000)`, the id from `Entity`), and `EndCrystal.kill(ServerLevel)` removes it without a blast (unlike `EndCrystal.hurtServer`, which explodes). - `net.minecraft.world.entity.boss.enderdragon.EnderDragon` — its constructor takes its id and its parts' ids from the entity counter. - `net.minecraft.world.entity.Entity.kill(ServerLevel)` — `this.remove(Entity.RemovalReason.KILLED)`: `/kill` removes the entity, it does not hurt it (the dragon flies its death flight when its health runs out, not when it is killed). - `net.minecraft.server.commands.KillCommand` — `entity.kill(source.getLevel())` for every target. ## Self-check `python3 tools/test_command_exec_parity.py` (the vanilla differential harness, extended with the End crystal and Ender Dragon cases in the `entities` group of `tools/command_exec_corpus.py`): ``` entities: 55/55 commands match total: 879/879 commands match ``` The new cases, identical in vanilla and in Horizon: ``` /summon minecraft:end_crystal 4.5 210 8.5 -> Summoned new End Crystal /execute if entity @e[type=minecraft:end_crystal] -> Test passed. Count: 1 /data get entity @e[type=minecraft:end_crystal,limit=1] Pos -> End Crystal has the following entity data: [4.5d, 210.0d, 8.5d] /kill @e[type=minecraft:end_crystal] -> Killed End Crystal /execute if entity @e[type=minecraft:end_crystal] -> Test failed /summon minecraft:ender_dragon 4.5 210 8.5 -> Summoned new Ender Dragon /execute if entity @e[type=minecraft:ender_dragon] -> Test passed. Count: 1 /data get entity @e[type=minecraft:ender_dragon,limit=1] Pos -> Ender Dragon has the following entity data: [4.5d, 210.0d, 8.5d] /kill @e[type=minecraft:ender_dragon] -> Killed Ender Dragon ``` Before the fix, the same harness reported the issue's symptom on those cases (`entities: 46/55 commands match`): ``` /data get entity @e[type=minecraft:end_crystal,limit=1] Pos vanilla End Crystal has the following entity data: [4.5d, 210.0d, 8.5d] rust No entity was found /kill @e[type=minecraft:ender_dragon] vanilla Killed Ender Dragon rust No entity was found ``` `cargo fmt -p horizon-client` (clean) and `cargo build -p horizon-client --bin horizon-client` (clean). 🤖 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 04:17:04 +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#4426
No description provided.