[PR #4920] [MERGED] fix(dragon): a destroyed crystal credits its player, else the nearest #5940

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4920
Author: @reservedbytes
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/dragon-crystal-credit


📝 Commits (1)

  • b4a85e3 fix(dragon): a destroyed crystal credits its player, else the nearest

📊 Changes

1 file changed (+69 additions, -41 deletions)

View changed files

📝 crates/horizon-client/src/game/dragon.rs (+69 -41)

📄 Description

What and why

When an end crystal is destroyed, vanilla hurts the dragon's head with explosion(crystal, player), where player is whoever destroyed it, else the nearest player
Horizon used only the destroyer, so a crystal blown up by something else credited nobody, and the dragon picked who to strafe a tick later

This picks the player once, when the crystal is destroyed: the player behind the damage, else the nearest one to the crystal's block (no range, as vanilla's conditions have no targeter)
That player gets the head hit's credit (lastHurtByPlayer, so the kill, "Free the End" and the stats) and is the one the dragon strafes

Crystals set off by another crystal's blast now carry that blast's player, as EndCrystal.hurtServer passes it on
The first crystal destroyed in a tick wins the strafe, vanilla's holding phase strafes at once and ignores the rest
On Peaceful the destroyer is still strafed (EnderDragon.canAttack has no Peaceful check), only the nearest player fallback finds nobody

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

EnderDragon.onCrystalDestroyed (world/entity/boss/enderdragon/EnderDragon.java:812-825): the source's player, else getNearestPlayer(CRYSTAL_DESTROY_TARGETING, ...), then explosion(crystal, player) on the head when it's the nearest crystal
EnderDragon.canAttack (:871-873): no Peaceful check, unlike LivingEntity.canAttack
EndCrystal.hurtServer (world/entity/boss/enderdragon/EndCrystal.java:97-99): its blast carries source.getEntity(), so chained crystals keep the player
EnderDragonFight passes crystal.blockPosition() (world/level/dimension/end/EnderDragonFight.java:509)
DragonHoldingPatternPhase.onCrystalDestroyed (phases/DragonHoldingPatternPhase.java:133-136) strafes at once, other phases ignore it (AbstractDragonPhaseInstance.java:33), so the first crystal in a tick wins
TargetingConditions.test without a targeter skips the range (world/entity/ai/targeting/TargetingConditions.java:68)

Self-check

Check Result
Scope ✅ 1 files, +69 −41
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 484 passed (55 s)
rustfmt ✅ (8 s)
clippy ✅ (2 min 11 s)
tests: horizon-client ✅ 1267 passed (5 min 2 s)
doc tests ✅ 0 passed (1 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 ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/4920 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/dragon-crystal-credit` --- ### 📝 Commits (1) - [`b4a85e3`](https://github.com/horizon-rust/horizon/commit/b4a85e32e3490eb9ead9475acb2425a1627ee324) fix(dragon): a destroyed crystal credits its player, else the nearest ### 📊 Changes **1 file changed** (+69 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dragon.rs` (+69 -41) </details> ### 📄 Description ## What and why When an end crystal is destroyed, vanilla hurts the dragon's head with `explosion(crystal, player)`, where `player` is whoever destroyed it, else the nearest player Horizon used only the destroyer, so a crystal blown up by something else credited nobody, and the dragon picked who to strafe a tick later This picks the player once, when the crystal is destroyed: the player behind the damage, else the nearest one to the crystal's block (no range, as vanilla's conditions have no targeter) That player gets the head hit's credit (`lastHurtByPlayer`, so the kill, "Free the End" and the stats) and is the one the dragon strafes Crystals set off by another crystal's blast now carry that blast's player, as `EndCrystal.hurtServer` passes it on The first crystal destroyed in a tick wins the strafe, vanilla's holding phase strafes at once and ignores the rest On Peaceful the destroyer is still strafed (`EnderDragon.canAttack` has no Peaceful check), only the nearest player fallback finds nobody ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `EnderDragon.onCrystalDestroyed` (`world/entity/boss/enderdragon/EnderDragon.java:812-825`): the source's player, else `getNearestPlayer(CRYSTAL_DESTROY_TARGETING, ...)`, then `explosion(crystal, player)` on the head when it's the nearest crystal `EnderDragon.canAttack` (`:871-873`): no Peaceful check, unlike `LivingEntity.canAttack` `EndCrystal.hurtServer` (`world/entity/boss/enderdragon/EndCrystal.java:97-99`): its blast carries `source.getEntity()`, so chained crystals keep the player `EnderDragonFight` passes `crystal.blockPosition()` (`world/level/dimension/end/EnderDragonFight.java:509`) `DragonHoldingPatternPhase.onCrystalDestroyed` (`phases/DragonHoldingPatternPhase.java:133-136`) strafes at once, other phases ignore it (`AbstractDragonPhaseInstance.java:33`), so the first crystal in a tick wins `TargetingConditions.test` without a targeter skips the range (`world/entity/ai/targeting/TargetingConditions.java:68`) ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 1 files, +69 −41 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 484 passed (55 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (2 min 11 s) | | tests: horizon-client | ✅ 1267 passed (5 min 2 s) | | doc tests | ✅ 0 passed (1 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:05 +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#5940
No description provided.