[PR #1971] [MERGED] Firework explosions hurt nearby players, not only the boosted one #3900

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1971
Author: @kacpherek
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/1477-firework-player-damage


📝 Commits (2)

  • 785e83f Firework explosions hurt nearby players, not only the boosted one
  • 31eecdc Compute a firework's blast distance in floats, as Entity.distanceTo does

📊 Changes

2 files changed (+85 additions, -17 deletions)

View changed files

📝 crates/horizon-client/src/game/fireworks.rs (+73 -15)
📝 crates/horizon-client/src/game/lan_mobs.rs (+12 -2)

📄 Description

Fixes #1477.

What and why

A firework rocket bursting next to a player on foot did no damage to them, in both single player modes,
while a cow standing just as close was hurt. Horizon only hurt the player the rocket was attached to (an
elytra boost) and the nearby mobs; vanilla hurts every living entity within 5 blocks that the rocket can
see.

Now the explosion also hurts:

  • the window's player (in-frame), unless it is the player the rocket is boosting, who keeps the full
    attached damage as before;
  • every other player in the level (LAN guests, and the players of the server thread), each swapped in as
    the player, as the TNT explosion already does (each_guest_hit).

Rebased onto 9ec5f1dd ("a guest's boost rocket hurts them"): the guest a rocket is attached to still
takes the full damage there (now through the same hurtServer path, armor included), and is left out of
the blast that hurts the other players, as dealExplosionDamage skips attachedToEntity
(each_guest_hit_except).

The damage is damageAmount * sqrt((5 - distanceTo) / 5) as minecraft:fireworks damage; creative and
spectator players are immune, armor absorbs it and wears as for any hurtServer. distanceTo is now a
float, as vanilla computes it, for the mobs too (a rounding-level change for them).

Vanilla reference

  • FireworkRocketEntity.dealExplosionDamage: 5 + 2 * explosions to attachedToEntity, then every
    LivingEntity in the box grown by 5 that is not the attached one, within distanceToSqr <= 25, seen
    from the rocket at getY(0) or getY(0.5) (ClipContext.Block.COLLIDER, Fluid.NONE).
  • LivingEntity.hurtServer / Player.hurtServer: creative and spectator invulnerability, armor
    absorption and hurtArmor.

cargo check passes after the rebase; the in-game check and the harness results below are from before it.

Checked in game with horizon-ctl in survival, regeneration off, the issue's rocket
(flight_duration:0, one large ball) launched on the floor 3 blocks away under a ceiling 2 blocks up:

Path health before after vanilla (issue's native control)
server thread (default) 20.0 16.145 (was 20.0) 20 → 16.05
--in-frame 16.145 12.256 (was unchanged) -3.95

(The burst point varies with the rocket's random lifetime, hence the small spread.)

No harness covers firework explosion damage; the harnesses next to the change still pass:

  • test_dispenser_parity: 6000/6000 cases match (0 oracle errors; 1194 spawning cases compared without the final level random)
  • test_server_player_damage_parity: client and server, 373,455 output lines match Rust
  • test_player_hurt_parity: client and server, 410,880 output lines match Rust
  • test_combat_rules_parity: client and server, 184,248 output lines match Rust

Overlap: open PR #1671 (elytra boost on a server) edits the same if r.attached block of
explode_rocket to hurt a boosting guest through a new Rocket::guest. Whichever lands second should
keep both: the attached guest takes the full damage there and is skipped in the area pass
(each_guest_hit), as the window's own attached player is here.

Self-check

I did not paste a tools/pr_ready.py block: I work on Windows, where tools/parity.py cannot run (it needs
fcntl) and three horizon-client tests fail on upstream/main as well
(crash::tests::stacks_start_at_the_panicking_frame,
packs::cache::tests::directory_inputs_config_and_owned_output_recovery,
save::tests::session_lock_is_exclusive). cargo fmt --all -- --check passes; CI runs clippy and the
tests on Linux, and the harnesses above were run one by one (python tools/test_<name>_parity.py).


🔄 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/1971 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1477-firework-player-damage` --- ### 📝 Commits (2) - [`785e83f`](https://github.com/horizon-rust/horizon/commit/785e83feebb6bfcff4a28585113161e26f484af6) Firework explosions hurt nearby players, not only the boosted one - [`31eecdc`](https://github.com/horizon-rust/horizon/commit/31eecdc271750def0532029e62ef007878762c01) Compute a firework's blast distance in floats, as Entity.distanceTo does ### 📊 Changes **2 files changed** (+85 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/fireworks.rs` (+73 -15) 📝 `crates/horizon-client/src/game/lan_mobs.rs` (+12 -2) </details> ### 📄 Description Fixes #1477. ## What and why A firework rocket bursting next to a player on foot did no damage to them, in both single player modes, while a cow standing just as close was hurt. Horizon only hurt the player the rocket was attached to (an elytra boost) and the nearby mobs; vanilla hurts every living entity within 5 blocks that the rocket can see. Now the explosion also hurts: - the window's player (in-frame), unless it is the player the rocket is boosting, who keeps the full attached damage as before; - every other player in the level (LAN guests, and the players of the server thread), each swapped in as the player, as the TNT explosion already does (`each_guest_hit`). Rebased onto 9ec5f1dd ("a guest's boost rocket hurts them"): the guest a rocket is attached to still takes the full damage there (now through the same `hurtServer` path, armor included), and is left out of the blast that hurts the other players, as `dealExplosionDamage` skips `attachedToEntity` (`each_guest_hit_except`). The damage is `damageAmount * sqrt((5 - distanceTo) / 5)` as `minecraft:fireworks` damage; creative and spectator players are immune, armor absorbs it and wears as for any `hurtServer`. `distanceTo` is now a float, as vanilla computes it, for the mobs too (a rounding-level change for them). ## Vanilla reference - `FireworkRocketEntity.dealExplosionDamage`: `5 + 2 * explosions` to `attachedToEntity`, then every `LivingEntity` in the box grown by 5 that is not the attached one, within `distanceToSqr <= 25`, seen from the rocket at `getY(0)` or `getY(0.5)` (`ClipContext.Block.COLLIDER`, `Fluid.NONE`). - `LivingEntity.hurtServer` / `Player.hurtServer`: creative and spectator invulnerability, armor absorption and `hurtArmor`. `cargo check` passes after the rebase; the in-game check and the harness results below are from before it. Checked in game with `horizon-ctl` in survival, regeneration off, the issue's rocket (`flight_duration:0`, one large ball) launched on the floor 3 blocks away under a ceiling 2 blocks up: | Path | health before | after | vanilla (issue's native control) | | --- | ---: | ---: | ---: | | server thread (default) | 20.0 | 16.145 (was 20.0) | 20 → 16.05 | | `--in-frame` | 16.145 | 12.256 (was unchanged) | -3.95 | (The burst point varies with the rocket's random lifetime, hence the small spread.) No harness covers firework explosion damage; the harnesses next to the change still pass: - `test_dispenser_parity`: 6000/6000 cases match (0 oracle errors; 1194 spawning cases compared without the final level random) - `test_server_player_damage_parity`: client and server, 373,455 output lines match Rust - `test_player_hurt_parity`: client and server, 410,880 output lines match Rust - `test_combat_rules_parity`: client and server, 184,248 output lines match Rust Overlap: open PR #1671 (elytra boost on a server) edits the same `if r.attached` block of `explode_rocket` to hurt a boosting guest through a new `Rocket::guest`. Whichever lands second should keep both: the attached guest takes the full damage there and is skipped in the area pass (`each_guest_hit`), as the window's own attached player is here. ## Self-check I did not paste a `tools/pr_ready.py` block: I work on Windows, where `tools/parity.py` cannot run (it needs `fcntl`) and three horizon-client tests fail on upstream/main as well (`crash::tests::stacks_start_at_the_panicking_frame`, `packs::cache::tests::directory_inputs_config_and_owned_output_recovery`, `save::tests::session_lock_is_exclusive`). `cargo fmt --all -- --check` passes; CI runs clippy and the tests on Linux, and the harnesses above were run one by one (`python tools/test_<name>_parity.py`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:08 +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#3900
No description provided.