[PR #3450] [MERGED] End the dragon fight when /kill removes the dragon #4988

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

📋 Pull Request Information

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

Base: main ← Head: fix-3319


📝 Commits (1)

  • 48342a7 End the dragon fight when /kill removes the dragon

📊 Changes

2 files changed (+32 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/dragon.rs (+8 -1)
📝 tools/command_exec_corpus.py (+24 -0)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

Fixes #3319

/kill @e[type=minecraft:ender_dragon] replied "Killed Ender Dragon", but a new dragon with full health took its place on the next fight tick. No exit portal or egg appeared.

Game::kill_dragon (game/dragon.rs) only dropped the entity (self.dragon = None). The fight was never told, so fight.killed stayed false and tick_fight created a new dragon right away. Vanilla's EnderDragon.kill also tells the fight that its dragon was killed. kill_dragon now calls the existing dragon_killed() (Horizon's EnderDragonFight.setDragonKilled: the exit portal, a gateway, the first dragon's egg, killed and previously_killed, saved). It does this only in the End, since only the End's level has a fight (ServerLevel.getDragonFight). A dragon summoned elsewhere is still just removed.

As in vanilla, /kill gives no experience: the experience is dropped in tickDeath, and a killed dragon never runs it.

Vanilla reference

  • EnderDragon.kill(ServerLevel): remove(RemovalReason.KILLED), gameEvent(GameEvent.ENTITY_DIE), then, when dragonFight != null, dragonFight.updateDragon(this) and dragonFight.setDragonKilled(this).
  • EnderDragonFight.setDragonKilled: hides the boss bar, spawnExitPortal(true), spawnNewGateway(), places the egg at the podium's MOTION_BLOCKING height when no dragon was killed before, then sets previouslyKilled, dragonKilled and setDirty().
  • EnderDragonFight.isArenaLoaded: the 17 by 17 chunks around the origin must be block ticking before the fight acts (used for the harness pacing below).

Read with javap -c on the 26.3 client jar.

Harness: tools/command_exec_corpus.py gets an ender dragon group for test_command_exec_parity.py. It sends the player to the End over the exit portal, lets the fight spawn its dragon, runs /kill, waits 40 ticks, then checks whether a dragon exists and counts the end_portal and dragon_egg blocks around the podium. I ran both sides of the harness by hand on Windows (the vanilla oracle VanillaCommandExecOracle against the 26.3 server jar, and horizon-client with HORIZON_COMMAND_SCRIPT) for the setup and ender dragon groups.

Before (main's dragon.rs, the same corpus): 3 of 5 commands differ.

ok       /execute if entity @e[type=minecraft:ender_dragon]        Test passed. Count: 1
ok       /kill @e[type=minecraft:ender_dragon]                     Killed Ender Dragon
MISMATCH /execute if entity @e[type=minecraft:ender_dragon]
   rust    Test passed. Count: 1
   vanilla Test failed
MISMATCH /execute in minecraft:the_end run fill -3 0 -3 3 120 3 minecraft:air replace minecraft:end_portal
   rust    No blocks were filled
   vanilla Successfully filled 20 block(s)
MISMATCH /execute in minecraft:the_end run fill -3 0 -3 3 120 3 minecraft:air replace minecraft:dragon_egg
   rust    No blocks were filled
   vanilla Successfully filled 1 block(s)
mismatches: 3/5

After: all match. The entities group was run too, because it already summons and kills a dragon in the Overworld.

ok  /execute if entity @e[type=minecraft:ender_dragon]   Test failed
ok  /execute in minecraft:the_end run fill ... replace minecraft:end_portal   Successfully filled 20 block(s)
ok  /execute in minecraft:the_end run fill ... replace minecraft:dragon_egg   Successfully filled 1 block(s)
records: vanilla 63 rust 63
mismatches: 0/63

Self-check

Run on Windows 11 (tools/pr_ready.py and tools/parity.py stop on Windows at signal.SIGHUP, so the steps were run by hand):

cargo fmt --all -- --check                                                      ok
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings     ok
cargo test -p horizon-client --bin horizon-client                               138 passed, 3 ignored
python -m unittest discover -s tests                                            408 run, 2 failed, 1 error (the same 3 on main on this machine: test_port_publish x2, test_roadmap)
python tools/check_public_tree.py                                               passed
command_exec harness, groups setup + entities + ender dragon (by hand)          63/63 match

Screenshots

New Creative world, /execute in minecraft:the_end run tp @s 0 90 0, wait for the dragon, /kill @e[type=minecraft:ender_dragon], scripted with horizon-ctl.

Before (main, 142388e1c): 15 seconds after the kill, the boss bar is full again and execute if entity @e[type=minecraft:ender_dragon] passes. No portal, no egg.

before: a new dragon after /kill

After: the first screenshot is the fight before /kill (boss bar). After the kill, execute if entity @e[type=minecraft:ender_dragon] fails at 3 s and again at 18 s, and the exit portal is open with the egg on top. Counted afterwards: 20 end_portal blocks and 1 dragon_egg, as in vanilla.

after: exit portal and egg

🤖 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/3450 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3319` --- ### 📝 Commits (1) - [`48342a7`](https://github.com/horizon-rust/horizon/commit/48342a7ef33366195facbac7b592c14bdea0d45c) End the dragon fight when /kill removes the dragon ### 📊 Changes **2 files changed** (+32 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dragon.rs` (+8 -1) 📝 `tools/command_exec_corpus.py` (+24 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3319 `/kill @e[type=minecraft:ender_dragon]` replied "Killed Ender Dragon", but a new dragon with full health took its place on the next fight tick. No exit portal or egg appeared. `Game::kill_dragon` (`game/dragon.rs`) only dropped the entity (`self.dragon = None`). The fight was never told, so `fight.killed` stayed false and `tick_fight` created a new dragon right away. Vanilla's `EnderDragon.kill` also tells the fight that its dragon was killed. `kill_dragon` now calls the existing `dragon_killed()` (Horizon's `EnderDragonFight.setDragonKilled`: the exit portal, a gateway, the first dragon's egg, `killed` and `previously_killed`, saved). It does this only in the End, since only the End's level has a fight (`ServerLevel.getDragonFight`). A dragon summoned elsewhere is still just removed. As in vanilla, `/kill` gives no experience: the experience is dropped in `tickDeath`, and a killed dragon never runs it. ## Vanilla reference - `EnderDragon.kill(ServerLevel)`: `remove(RemovalReason.KILLED)`, `gameEvent(GameEvent.ENTITY_DIE)`, then, when `dragonFight != null`, `dragonFight.updateDragon(this)` and `dragonFight.setDragonKilled(this)`. - `EnderDragonFight.setDragonKilled`: hides the boss bar, `spawnExitPortal(true)`, `spawnNewGateway()`, places the egg at the podium's `MOTION_BLOCKING` height when no dragon was killed before, then sets `previouslyKilled`, `dragonKilled` and `setDirty()`. - `EnderDragonFight.isArenaLoaded`: the 17 by 17 chunks around the origin must be block ticking before the fight acts (used for the harness pacing below). Read with `javap -c` on the 26.3 client jar. **Harness:** `tools/command_exec_corpus.py` gets an `ender dragon` group for `test_command_exec_parity.py`. It sends the player to the End over the exit portal, lets the fight spawn its dragon, runs `/kill`, waits 40 ticks, then checks whether a dragon exists and counts the `end_portal` and `dragon_egg` blocks around the podium. I ran both sides of the harness by hand on Windows (the vanilla oracle `VanillaCommandExecOracle` against the 26.3 server jar, and `horizon-client` with `HORIZON_COMMAND_SCRIPT`) for the `setup` and `ender dragon` groups. Before (main's `dragon.rs`, the same corpus): 3 of 5 commands differ. ``` ok /execute if entity @e[type=minecraft:ender_dragon] Test passed. Count: 1 ok /kill @e[type=minecraft:ender_dragon] Killed Ender Dragon MISMATCH /execute if entity @e[type=minecraft:ender_dragon] rust Test passed. Count: 1 vanilla Test failed MISMATCH /execute in minecraft:the_end run fill -3 0 -3 3 120 3 minecraft:air replace minecraft:end_portal rust No blocks were filled vanilla Successfully filled 20 block(s) MISMATCH /execute in minecraft:the_end run fill -3 0 -3 3 120 3 minecraft:air replace minecraft:dragon_egg rust No blocks were filled vanilla Successfully filled 1 block(s) mismatches: 3/5 ``` After: all match. The `entities` group was run too, because it already summons and kills a dragon in the Overworld. ``` ok /execute if entity @e[type=minecraft:ender_dragon] Test failed ok /execute in minecraft:the_end run fill ... replace minecraft:end_portal Successfully filled 20 block(s) ok /execute in minecraft:the_end run fill ... replace minecraft:dragon_egg Successfully filled 1 block(s) records: vanilla 63 rust 63 mismatches: 0/63 ``` ## Self-check Run on Windows 11 (`tools/pr_ready.py` and `tools/parity.py` stop on Windows at `signal.SIGHUP`, so the steps were run by hand): ``` cargo fmt --all -- --check ok cargo clippy -p horizon-client --features mods --all-targets -- -D warnings ok cargo test -p horizon-client --bin horizon-client 138 passed, 3 ignored python -m unittest discover -s tests 408 run, 2 failed, 1 error (the same 3 on main on this machine: test_port_publish x2, test_roadmap) python tools/check_public_tree.py passed command_exec harness, groups setup + entities + ender dragon (by hand) 63/63 match ``` ## Screenshots New Creative world, `/execute in minecraft:the_end run tp @s 0 90 0`, wait for the dragon, `/kill @e[type=minecraft:ender_dragon]`, scripted with `horizon-ctl`. Before (main, 142388e1c): 15 seconds after the kill, the boss bar is full again and `execute if entity @e[type=minecraft:ender_dragon]` passes. No portal, no egg. ![before: a new dragon after /kill](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/dragon-3319-before.png) After: the first screenshot is the fight before `/kill` (boss bar). After the kill, `execute if entity @e[type=minecraft:ender_dragon]` fails at 3 s and again at 18 s, and the exit portal is open with the egg on top. Counted afterwards: 20 `end_portal` blocks and 1 `dragon_egg`, as in vanilla. ![after: exit portal and egg](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/dragon-3319-after.png) 🤖 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:24 +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#4988
No description provided.