[PR #4931] [MERGED] fix(combat): a creeper's blast is a player_explosion #5950

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

📋 Pull Request Information

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

Base: main ← Head: fix/creeper-blast-credit


📝 Commits (1)

  • d020b5f fix(combat): a creeper's blast is a player_explosion

📊 Changes

3 files changed (+40 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/game/combat.rs (+1 -7)
📝 crates/horizon-client/src/game/creatures.rs (+38 -7)
📝 crates/horizon-client/src/game/lan.rs (+1 -2)

📄 Description

What and why

A mob hurt or killed by a creeper's blast recorded minecraft:explosion, vanilla records minecraft:player_explosion
Vanilla picks player_explosion whenever the blast has both a direct and a causing entity, and an exploding creeper is both, so the type isn't about players at all
The pet death message (#4264) already passed "has a causing entity" to creatures::damage_type, but the advancement view, the death loot and the LAN damage event still passed "the attacker is the player"
This adds creatures::source_damage_type, which takes the recorded damage source and passes whether it has a causing entity, and all four use it
The flag is only read for explosions, so every other damage type stays as it was
The same goes for the other blasts Horizon already gives a mob cause: a sulfur cube, the wither's spawn blast, wither skulls and ghast fireballs, which are player_explosion in vanilla as well
For players this shows in loot and advancement predicates that test the damage type of a blast that hurt a mob, and in predicates that test #minecraft:can_break_armor_stand, the only damage type tag that has player_explosion and not explosion
LAN guests now get player_explosion in the damage event for such a mob, like a vanilla server sends
No vanilla loot table or advancement tests an explosion type, so they don't change, and death messages don't either
/damage <mob> … minecraft:explosion by <mob> now records player_explosion where vanilla keeps the explicit explosion, since the recorded damage doesn't carry the explicit type
A blast that hurts its own cause (a ghast in its own fireball's blast) still records explosion, vanilla records player_explosion
A firework rocket still hurts mobs as an explosion where vanilla uses minecraft:fireworks, Horizon's rockets only have the player or nobody as owner, so this doesn't change them
TNT is left to #4689
A unit test checks source_damage_type for a creeper's blast, a blast with no cause and a mob's bite

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

DamageSources.explosion(entity, cause) picks PLAYER_EXPLOSION when both are set, EXPLOSION otherwise (world/damagesource/DamageSources.java:255-257)
ServerExplosion uses damageSources().explosion(this) when no source is given (world/level/ServerExplosion.java:70), which reads the direct and the indirect entity (world/damagesource/DamageSources.java:251-253)
Explosion.getIndirectSourceEntity is the source itself when it is a living entity, a projectile's living owner, or a primed TNT's owner (world/level/Explosion.java:18-25)
Creeper.explodeCreeper explodes with itself as the source (world/entity/monster/Creeper.java:234), so the creeper is both entities
The same holds for WitherBoss (world/entity/boss/wither/WitherBoss.java:267), WitherSkull (world/entity/projectile/hurtingprojectile/WitherSkull.java:97), LargeFireball (world/entity/projectile/hurtingprojectile/LargeFireball.java:36) and SulfurCube (world/entity/monster/cubemob/SulfurCube.java:306-308)
FireworkRocketEntity hurts with damageSources().fireworks(this, getOwner()) (world/entity/projectile/FireworkRocketEntity.java:232,252)
player_explosion is in #minecraft:can_break_armor_stand and #minecraft:is_explosion, explosion only in the latter (data tags/damage_type)

Self-check

Check Result
Scope ✅ 3 files, +40 −16
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 484 passed (49 s)
rustfmt ✅ (8 s)
clippy ✅ (1 min 59 s)
tests: horizon-client ✅ 1271 passed (4 min 57 s)
doc tests ✅ 0 passed (2 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/4931 **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/creeper-blast-credit` --- ### 📝 Commits (1) - [`d020b5f`](https://github.com/horizon-rust/horizon/commit/d020b5f93cddd5ff8508508e71dd8b485c22ff36) fix(combat): a creeper's blast is a player_explosion ### 📊 Changes **3 files changed** (+40 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/combat.rs` (+1 -7) 📝 `crates/horizon-client/src/game/creatures.rs` (+38 -7) 📝 `crates/horizon-client/src/game/lan.rs` (+1 -2) </details> ### 📄 Description ## What and why A mob hurt or killed by a creeper's blast recorded `minecraft:explosion`, vanilla records `minecraft:player_explosion` Vanilla picks `player_explosion` whenever the blast has both a direct and a causing entity, and an exploding creeper is both, so the type isn't about players at all The pet death message (#4264) already passed "has a causing entity" to `creatures::damage_type`, but the advancement view, the death loot and the LAN damage event still passed "the attacker is the player" This adds `creatures::source_damage_type`, which takes the recorded damage source and passes whether it has a causing entity, and all four use it The flag is only read for explosions, so every other damage type stays as it was The same goes for the other blasts Horizon already gives a mob cause: a sulfur cube, the wither's spawn blast, wither skulls and ghast fireballs, which are `player_explosion` in vanilla as well For players this shows in loot and advancement predicates that test the damage type of a blast that hurt a mob, and in predicates that test `#minecraft:can_break_armor_stand`, the only damage type tag that has `player_explosion` and not `explosion` LAN guests now get `player_explosion` in the damage event for such a mob, like a vanilla server sends No vanilla loot table or advancement tests an explosion type, so they don't change, and death messages don't either `/damage <mob> … minecraft:explosion by <mob>` now records `player_explosion` where vanilla keeps the explicit `explosion`, since the recorded damage doesn't carry the explicit type A blast that hurts its own cause (a ghast in its own fireball's blast) still records `explosion`, vanilla records `player_explosion` A firework rocket still hurts mobs as an explosion where vanilla uses `minecraft:fireworks`, Horizon's rockets only have the player or nobody as owner, so this doesn't change them TNT is left to #4689 A unit test checks `source_damage_type` for a creeper's blast, a blast with no cause and a mob's bite ## 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 `DamageSources.explosion(entity, cause)` picks `PLAYER_EXPLOSION` when both are set, `EXPLOSION` otherwise (`world/damagesource/DamageSources.java:255-257`) `ServerExplosion` uses `damageSources().explosion(this)` when no source is given (`world/level/ServerExplosion.java:70`), which reads the direct and the indirect entity (`world/damagesource/DamageSources.java:251-253`) `Explosion.getIndirectSourceEntity` is the source itself when it is a living entity, a projectile's living owner, or a primed TNT's owner (`world/level/Explosion.java:18-25`) `Creeper.explodeCreeper` explodes with itself as the source (`world/entity/monster/Creeper.java:234`), so the creeper is both entities The same holds for `WitherBoss` (`world/entity/boss/wither/WitherBoss.java:267`), `WitherSkull` (`world/entity/projectile/hurtingprojectile/WitherSkull.java:97`), `LargeFireball` (`world/entity/projectile/hurtingprojectile/LargeFireball.java:36`) and `SulfurCube` (`world/entity/monster/cubemob/SulfurCube.java:306-308`) `FireworkRocketEntity` hurts with `damageSources().fireworks(this, getOwner())` (`world/entity/projectile/FireworkRocketEntity.java:232,252`) `player_explosion` is in `#minecraft:can_break_armor_stand` and `#minecraft:is_explosion`, `explosion` only in the latter (data `tags/damage_type`) ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 3 files, +40 −16 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 484 passed (49 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 min 59 s) | | tests: horizon-client | ✅ 1271 passed (4 min 57 s) | | doc tests | ✅ 0 passed (2 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:10 +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#5950
No description provided.