[PR #5199] [MERGED] fix(explosion): a guest hit by a blast remembers its source for fall_after_explosion #6135

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

📋 Pull Request Information

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

Base: main ← Head: fix/guest-blast-advancement-cause


📝 Commits (2)

  • c9a8724 fix(explosion): a guest hit by a blast remembers its source for fall_after_explosion
  • 352c633 Merge origin/main into fix/guest-blast-source

📊 Changes

1 file changed (+17 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/explosion.rs (+17 -4)

📄 Description

What and why

explosion_hurt_player set the player's blast mark from self.combat.explosion_cause
In a guest's turn (as_guest), self.combat is the guest's own combat state
The cause there was always None, since only the host's state had it
The mark feeds fall_after_explosion, so a cause predicate (a creeper, a wither, a sulfur cube) never matched for a LAN guest
It never matched on the server thread either, where the window's own player is a client of the server like any guest
explode now reads the blast's source once, before the guests' turns, and passes it to each player's hurt
This follows vanilla, where hurtEntities calls onExplosionHit(this.source) with the same source for every player in reach

Left as is: only creeper, wither and sulfur cube blasts set a cause, so TNT, fireballs, wither skulls, end crystals and TNT minecarts still give none, for the host too
Left as is: a blast never fires entity_hurt_player for the player, host or guest, since its one caller is the mob hit path
Left as is: a spectator in reach still gets the mark, where vanilla's getEntities leaves spectators out
The death message and entity_killed_player for a guest's blast death are #5071's part
This and #5071 change the same explosion_hurt_player calls, so whichever lands second needs a small rebase

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

  • ServerExplosion.hurtEntities (net/minecraft/world/level/ServerExplosion.java:181-206): every entity in reach gets onExplosionHit(this.source)
  • ServerPlayer.onExplosionHit (net/minecraft/server/level/ServerPlayer.java:1385-1389): keeps the impact position and currentExplosionCause
  • ServerPlayer.trackStartFallingPosition (net/minecraft/server/level/ServerPlayer.java:893-901): fires FALL_AFTER_EXPLOSION with that cause
  • FallAfterExplosionTrigger.trigger (net/minecraft/advancements/triggers/FallAfterExplosionTrigger.java:26-29): the cause is the cause predicate's entity

No harness covers a guest's blast mark
The change is a value passed through, with no new logic to test inline

Other projects' code

none

Self-check

Check Result
Scope ✅ 1 files, +22 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (56 s)
rustfmt ✅ (8 s)
clippy ✅ (1 min 59 s)
tests: horizon-client ✅ 1341 passed (5 min 19 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/5199 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/guest-blast-advancement-cause` --- ### 📝 Commits (2) - [`c9a8724`](https://github.com/horizon-rust/horizon/commit/c9a8724b61b1d577877fdd15386fed53427fc30e) fix(explosion): a guest hit by a blast remembers its source for fall_after_explosion - [`352c633`](https://github.com/horizon-rust/horizon/commit/352c6336ad93f5d9e6817ac3c2a3a52564aa1c93) Merge origin/main into fix/guest-blast-source ### 📊 Changes **1 file changed** (+17 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/explosion.rs` (+17 -4) </details> ### 📄 Description ## What and why `explosion_hurt_player` set the player's blast mark from `self.combat.explosion_cause` In a guest's turn (`as_guest`), `self.combat` is the guest's own combat state The cause there was always `None`, since only the host's state had it The mark feeds `fall_after_explosion`, so a `cause` predicate (a creeper, a wither, a sulfur cube) never matched for a LAN guest It never matched on the server thread either, where the window's own player is a client of the server like any guest `explode` now reads the blast's source once, before the guests' turns, and passes it to each player's hurt This follows vanilla, where `hurtEntities` calls `onExplosionHit(this.source)` with the same source for every player in reach Left as is: only creeper, wither and sulfur cube blasts set a cause, so TNT, fireballs, wither skulls, end crystals and TNT minecarts still give none, for the host too Left as is: a blast never fires `entity_hurt_player` for the player, host or guest, since its one caller is the mob hit path Left as is: a spectator in reach still gets the mark, where vanilla's `getEntities` leaves spectators out The death message and `entity_killed_player` for a guest's blast death are #5071's part This and #5071 change the same `explosion_hurt_player` calls, so whichever lands second needs a small rebase ## 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 - `ServerExplosion.hurtEntities` (`net/minecraft/world/level/ServerExplosion.java:181-206`): every entity in reach gets `onExplosionHit(this.source)` - `ServerPlayer.onExplosionHit` (`net/minecraft/server/level/ServerPlayer.java:1385-1389`): keeps the impact position and `currentExplosionCause` - `ServerPlayer.trackStartFallingPosition` (`net/minecraft/server/level/ServerPlayer.java:893-901`): fires `FALL_AFTER_EXPLOSION` with that cause - `FallAfterExplosionTrigger.trigger` (`net/minecraft/advancements/triggers/FallAfterExplosionTrigger.java:26-29`): the cause is the `cause` predicate's entity No harness covers a guest's blast mark The change is a value passed through, with no new logic to test inline ## Other projects' code none ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 1 files, +22 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (56 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 min 59 s) | | tests: horizon-client | ✅ 1341 passed (5 min 19 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 06:13:48 +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#6135
No description provided.