[PR #4997] [MERGED] fix(combat): firework rockets hurt as fireworks #5995

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

📋 Pull Request Information

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

Base: main ← Head: fix/firework-damage-type


📝 Commits (1)

  • 45094a9 fix(combat): firework rockets hurt as fireworks

📊 Changes

5 files changed (+130 additions, -55 deletions)

View changed files

📝 crates/horizon-client/src/game/combat.rs (+32 -22)
📝 crates/horizon-client/src/game/creatures.rs (+27 -8)
📝 crates/horizon-client/src/game/fireworks.rs (+25 -22)
📝 crates/horizon-client/src/mobs.rs (+10 -0)
📝 crates/horizon-client/src/mobs/sulfur_cube.rs (+36 -3)

📄 Description

What and why

A firework rocket's burst hurt mobs as minecraft:explosion (or player_explosion for the player's rockets), vanilla hurts them with minecraft:fireworks
The player's hurt already had the fireworks type but nothing else of the source, so a rocket never knocked a player back, a shield never blocked it and the death message could fall back to "went off with a bang while fighting Zombie"
The burst now hurts mobs with Damage::fireworks, with the rocket's owner as the cause and the rocket's position as the source
The player's hurt now goes through the same hurt_player_from flow as a mob's hit, with the rocket as the direct entity and no causing mob
Knockback: fireworks is not in #minecraft:no_knockback, so mobs and players in the burst are now knocked away from the rocket, as in vanilla
A gliding player whose rocket bursts is knocked back too, which halves their speed as in vanilla
Shield: fireworks is not in #minecraft:bypasses_shield, so a shield raised towards the rocket now blocks the burst
Sulfur cube: fireworks is in #minecraft:is_explosion, so a burst still lights a TNT cube's short fuse and a cube carrying a block still shrugs it off and is pushed about, as before
Protection: Blast Protection already counted fireworks, since its damage_protection tests #minecraft:is_explosion, so armour reduces the burst as before
Death message: a named pet killed by a rocket now reads "went off with a bang" instead of "blew up" or "was blown up by"
A player or pet killed by a rocket nobody fired gets the same message, the rocket being the direct entity, where Horizon could use the .player form after a mob's hit
Advancement and loot predicates now see minecraft:fireworks with the rocket as the direct entity (is_direct false), for mobs, for the player's killing blow and for entity_hurt_player, which now fires for a rocket
Only a rocket names its direct entity in entity_hurt_player, arrows and other projectiles still name none there
LAN guests get fireworks in the damage event for such a mob
Every other blast keeps its type
Left as is: the player's hurt records no causing player, so for any player's rocket there is no kill credit, no thorns on its owner and no .item death message ("due to a firework fired from X by Player" for a named crossbow)
Left as is: for the same reason entity_hurt_player has no source entity for a rocket, where vanilla has its owner
Left as is: a guest's attached rocket sits exactly at the guest, without the hand angle, so a gliding guest is knocked in a random direction where vanilla pushes them away from the hand
Left as is: a block-carrying sulfur cube's push uses the rocket's position, where vanilla's SulfurCube.knockback uses the owner's eyes and look and adds an angle scale and power transfer, so a crossbow rocket's push can differ a lot
Left as is: for a rocket nobody fired vanilla gives such a cube the plain knockback, Horizon the cube's own
Left as is: an explosion still pushes a block-carrying cube with the cube's own knockback, where vanilla pushes it only with the explosion's impulse
Left as is: the burst reaches only mobs, not the ender dragon or armor stands
A unit test checks that Damage::fireworks, the source the burst gives mobs, primes a TNT cube with vanilla's short fuse, leaves its health and pushes it away, and that a cube without a block takes the hit, records fireworks and is knocked away from the rocket

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

FireworkRocketEntity.dealExplosionDamage hurts the attached entity and every living entity it sees within 5 blocks with damageSources().fireworks(this, getOwner()) (world/entity/projectile/FireworkRocketEntity.java:232,252)
DamageSources.fireworks makes the rocket the direct entity and the owner the cause (world/damagesource/DamageSources.java:227)
LivingEntity.hurtServer knocks back unless the type is in #minecraft:no_knockback (world/entity/LivingEntity.java:1258), and dealDefaultKnockback takes the direction from the projectile (world/entity/LivingEntity.java:1302-1314)
LivingEntity.knockback halves the velocity before the push (world/entity/LivingEntity.java:1659-1676)
FireworkRocketEntity.calculateHorizontalHurtKnockbackDirection is the target's offset from the rocket (world/entity/projectile/FireworkRocketEntity.java:317-321)
SulfurCube.hurtServer primes on #minecraft:is_explosion and with a block ignores #minecraft:sulfur_cube_with_block_immune_to, knocking back unless #minecraft:no_knockback (world/entity/monster/cubemob/SulfurCube.java:244-264)
SulfurCube.primeTime uses PrimedTnt.getRandomShortFuse for an imminent fuse (world/entity/monster/cubemob/SulfurCube.java:336-343, world/entity/item/PrimedTnt.java:185-187)
SulfurCube.knockback aims from the causing entity's eyes and look (world/entity/monster/cubemob/SulfurCube.java:829-873)
DamageSource.getLocalizedDeathMessage names the direct entity when there is no cause (world/damagesource/DamageSource.java:77-91)
Data damage_type/fireworks.json: exhaustion 0.1, message id fireworks, scaling when_caused_by_living_non_player
Data tags/damage_type/is_explosion.json has fireworks, no_knockback.json and bypasses_shield.json do not, sulfur_cube_with_block_immune_to.json has #minecraft:is_explosion
Data enchantment/blast_protection.json: damage_protection for #minecraft:is_explosion

Self-check

The one failure is a_swimming_passenger_sits_up_even_when_standing_does_not_fit (motion.rs), it fails on main too with prepared data (since #4662)

Check Result
Scope ✅ 5 files, +130 −55
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 486 passed (50 s)
rustfmt ✅ (9 s)
clippy ✅ (2 min 2 s)
tests: horizon-client ❌ 911 passed, 1 failed (4 min 11 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/4997 **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/firework-damage-type` --- ### 📝 Commits (1) - [`45094a9`](https://github.com/horizon-rust/horizon/commit/45094a9007d10d261218481d83a9e5d661c6b4b2) fix(combat): firework rockets hurt as fireworks ### 📊 Changes **5 files changed** (+130 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/combat.rs` (+32 -22) 📝 `crates/horizon-client/src/game/creatures.rs` (+27 -8) 📝 `crates/horizon-client/src/game/fireworks.rs` (+25 -22) 📝 `crates/horizon-client/src/mobs.rs` (+10 -0) 📝 `crates/horizon-client/src/mobs/sulfur_cube.rs` (+36 -3) </details> ### 📄 Description ## What and why A firework rocket's burst hurt mobs as `minecraft:explosion` (or `player_explosion` for the player's rockets), vanilla hurts them with `minecraft:fireworks` The player's hurt already had the `fireworks` type but nothing else of the source, so a rocket never knocked a player back, a shield never blocked it and the death message could fall back to "went off with a bang while fighting Zombie" The burst now hurts mobs with `Damage::fireworks`, with the rocket's owner as the cause and the rocket's position as the source The player's hurt now goes through the same `hurt_player_from` flow as a mob's hit, with the rocket as the direct entity and no causing mob Knockback: `fireworks` is not in `#minecraft:no_knockback`, so mobs and players in the burst are now knocked away from the rocket, as in vanilla A gliding player whose rocket bursts is knocked back too, which halves their speed as in vanilla Shield: `fireworks` is not in `#minecraft:bypasses_shield`, so a shield raised towards the rocket now blocks the burst Sulfur cube: `fireworks` is in `#minecraft:is_explosion`, so a burst still lights a TNT cube's short fuse and a cube carrying a block still shrugs it off and is pushed about, as before Protection: Blast Protection already counted `fireworks`, since its `damage_protection` tests `#minecraft:is_explosion`, so armour reduces the burst as before Death message: a named pet killed by a rocket now reads "went off with a bang" instead of "blew up" or "was blown up by" A player or pet killed by a rocket nobody fired gets the same message, the rocket being the direct entity, where Horizon could use the `.player` form after a mob's hit Advancement and loot predicates now see `minecraft:fireworks` with the rocket as the direct entity (`is_direct` false), for mobs, for the player's killing blow and for `entity_hurt_player`, which now fires for a rocket Only a rocket names its direct entity in `entity_hurt_player`, arrows and other projectiles still name none there LAN guests get `fireworks` in the damage event for such a mob Every other blast keeps its type Left as is: the player's hurt records no causing player, so for any player's rocket there is no kill credit, no thorns on its owner and no `.item` death message ("due to a firework fired from X by Player" for a named crossbow) Left as is: for the same reason `entity_hurt_player` has no source entity for a rocket, where vanilla has its owner Left as is: a guest's attached rocket sits exactly at the guest, without the hand angle, so a gliding guest is knocked in a random direction where vanilla pushes them away from the hand Left as is: a block-carrying sulfur cube's push uses the rocket's position, where vanilla's `SulfurCube.knockback` uses the owner's eyes and look and adds an angle scale and power transfer, so a crossbow rocket's push can differ a lot Left as is: for a rocket nobody fired vanilla gives such a cube the plain knockback, Horizon the cube's own Left as is: an explosion still pushes a block-carrying cube with the cube's own knockback, where vanilla pushes it only with the explosion's impulse Left as is: the burst reaches only mobs, not the ender dragon or armor stands A unit test checks that `Damage::fireworks`, the source the burst gives mobs, primes a TNT cube with vanilla's short fuse, leaves its health and pushes it away, and that a cube without a block takes the hit, records `fireworks` and is knocked away from the rocket ## 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 `FireworkRocketEntity.dealExplosionDamage` hurts the attached entity and every living entity it sees within 5 blocks with `damageSources().fireworks(this, getOwner())` (`world/entity/projectile/FireworkRocketEntity.java:232,252`) `DamageSources.fireworks` makes the rocket the direct entity and the owner the cause (`world/damagesource/DamageSources.java:227`) `LivingEntity.hurtServer` knocks back unless the type is in `#minecraft:no_knockback` (`world/entity/LivingEntity.java:1258`), and `dealDefaultKnockback` takes the direction from the projectile (`world/entity/LivingEntity.java:1302-1314`) `LivingEntity.knockback` halves the velocity before the push (`world/entity/LivingEntity.java:1659-1676`) `FireworkRocketEntity.calculateHorizontalHurtKnockbackDirection` is the target's offset from the rocket (`world/entity/projectile/FireworkRocketEntity.java:317-321`) `SulfurCube.hurtServer` primes on `#minecraft:is_explosion` and with a block ignores `#minecraft:sulfur_cube_with_block_immune_to`, knocking back unless `#minecraft:no_knockback` (`world/entity/monster/cubemob/SulfurCube.java:244-264`) `SulfurCube.primeTime` uses `PrimedTnt.getRandomShortFuse` for an imminent fuse (`world/entity/monster/cubemob/SulfurCube.java:336-343`, `world/entity/item/PrimedTnt.java:185-187`) `SulfurCube.knockback` aims from the causing entity's eyes and look (`world/entity/monster/cubemob/SulfurCube.java:829-873`) `DamageSource.getLocalizedDeathMessage` names the direct entity when there is no cause (`world/damagesource/DamageSource.java:77-91`) Data `damage_type/fireworks.json`: exhaustion 0.1, message id `fireworks`, scaling `when_caused_by_living_non_player` Data `tags/damage_type/is_explosion.json` has `fireworks`, `no_knockback.json` and `bypasses_shield.json` do not, `sulfur_cube_with_block_immune_to.json` has `#minecraft:is_explosion` Data `enchantment/blast_protection.json`: `damage_protection` for `#minecraft:is_explosion` ## Self-check The one failure is `a_swimming_passenger_sits_up_even_when_standing_does_not_fit` (`motion.rs`), it fails on `main` too with prepared data (since #4662) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +130 −55 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 486 passed (50 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 min 2 s) | | tests: horizon-client | ❌ 911 passed, 1 failed (4 min 11 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:30 +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#5995
No description provided.