[PR #5941] [MERGED] Explosions push projectiles #6576

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5941
Author: @HrafnaValkyrja
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/explosions-push-projectiles


📝 Commits (3)

  • 43ec4c8 Explosions push projectiles
  • b2263f7 Merge origin/main
  • 6d09cbb Explosions push thrown tridents too

📊 Changes

3 files changed (+128 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/explosion.rs (+68 -0)
📝 crates/horizon-client/src/projectiles.rs (+9 -0)
📝 tools/lan_e2e.py (+51 -2)

📄 Description

🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself.

What and why

Explosions (TNT, TNT minecart, creeper, bed, crystal) did not push projectiles: explosion_hurt_entities had no loop over creatures.projectiles or the firework rockets. TNT minecart railguns depend on this (arrows floating on water get launched). The loop is added after the minecart push, with the same shape as the item and cart loops: distance from the feet, exposure over the projectile's own box (Projectile::bounds), direction from the eyes (0.85 of the height), velocity += dir * (1 - dist) * exposure, and needs_sync so clients see the new velocity at once (Entity.push sets needsSync). Arrows and tridents stuck in the ground are skipped. New blast-projectiles check in tools/lan_e2e.py.

Not done (left for a follow-up to keep this diff small next to #5637): fishing hooks (state lives per player, guests' in host.play), and setOwner(damageSource.getEntity()) for redirectable projectiles (ghast fireball, wind charges).

Fixes #5908

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: every entity in the box that is not ignoreExplosion, dist = sqrt(distanceToSqr(center)) / (2 * radius) <= 1, direction from getEyePosition() (position for PrimedTnt), exposure from getSeenPercent, knockback dir * (1 - dist) * exposure * knockbackMultiplier * (1 - resistance), then entity.pushFromExplosion. No random draws.
  • Entity.pushFromExplosion = push(Vec3) = push(double, double, double). Only Warden, ArmorStand, ItemEntity, BlockAttachedEntity and VehicleEntity override ignoreExplosion; no projectile does.
  • AbstractArrow.push(double, double, double): if (isInGround()) return; super.push(...). Applies to trident too.
  • Projectile.hurtServer / AbstractHurtingProjectile.hurtServer never damage (return false), so the damage half is a no-op.
  • EntityTypes static initialiser: eyeHeight(0.13F) for arrow, spectral arrow and trident, eyeHeight(0.0F) for wind charges. Other projectiles keep the default 0.85 of their height. ProjectileKind::eye_height carries this.

Test: new blast-projectiles check in tools/lan_e2e.py, on two real games. It fails with explosion.rs reverted.

I also ran one scene on the real 26.3 server jar and in Horizon: TNT with fuse 5, tick freeze, then tick step 8. Velocity after the blast:

Projectile Vanilla Horizon
arrow 0.56725137, -0.00112332 0.56725137, -0.00112332
snowball 0.30181795, -0.64526303 0.30181793, -0.64526302
arrow in the ground unmoved unmoved

Not compared against vanilla: TNT minecarts, rockets and the other projectile types. Summoned arrows ignore NoGravity in arrow_from_nbt, a separate bug not touched here.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at c1f4a7c19, 5 min 40 s)

Check Result
Scope ✅ 4 files, +104 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 515 passed (20 s)
rustfmt ✅ (7 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (1 min 36 s)
tests: horizon-client ✅ 1678 passed (3 min 33 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 ➖ 319 affected, to run in CI (--quick): arrow, auto_jump, block_removal, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen and 307 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
🤖 Generated with Claude Code

https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 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/5941 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/explosions-push-projectiles` --- ### 📝 Commits (3) - [`43ec4c8`](https://github.com/horizon-rust/horizon/commit/43ec4c8319d38f1db8434815e44fe14c8d49f0ac) Explosions push projectiles - [`b2263f7`](https://github.com/horizon-rust/horizon/commit/b2263f7ecab2e8d7418d77bf24b254facc50042e) Merge origin/main - [`6d09cbb`](https://github.com/horizon-rust/horizon/commit/6d09cbb10f0b15a150a69300e2181d20cd24afa3) Explosions push thrown tridents too ### 📊 Changes **3 files changed** (+128 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/explosion.rs` (+68 -0) 📝 `crates/horizon-client/src/projectiles.rs` (+9 -0) 📝 `tools/lan_e2e.py` (+51 -2) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Explosions (TNT, TNT minecart, creeper, bed, crystal) did not push projectiles: `explosion_hurt_entities` had no loop over `creatures.projectiles` or the firework rockets. TNT minecart railguns depend on this (arrows floating on water get launched). The loop is added after the minecart push, with the same shape as the item and cart loops: distance from the feet, exposure over the projectile's own box (`Projectile::bounds`), direction from the eyes (0.85 of the height), `velocity += dir * (1 - dist) * exposure`, and `needs_sync` so clients see the new velocity at once (`Entity.push` sets `needsSync`). Arrows and tridents stuck in the ground are skipped. New `blast-projectiles` check in `tools/lan_e2e.py`. Not done (left for a follow-up to keep this diff small next to #5637): fishing hooks (state lives per player, guests' in `host.play`), and `setOwner(damageSource.getEntity())` for redirectable projectiles (ghast fireball, wind charges). Fixes #5908 ## 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`: every entity in the box that is not `ignoreExplosion`, `dist = sqrt(distanceToSqr(center)) / (2 * radius) <= 1`, direction from `getEyePosition()` (position for `PrimedTnt`), exposure from `getSeenPercent`, knockback `dir * (1 - dist) * exposure * knockbackMultiplier * (1 - resistance)`, then `entity.pushFromExplosion`. No random draws. - `Entity.pushFromExplosion` = `push(Vec3)` = `push(double, double, double)`. Only Warden, ArmorStand, ItemEntity, BlockAttachedEntity and VehicleEntity override `ignoreExplosion`; no projectile does. - `AbstractArrow.push(double, double, double)`: `if (isInGround()) return; super.push(...)`. Applies to trident too. - `Projectile.hurtServer` / `AbstractHurtingProjectile.hurtServer` never damage (return false), so the damage half is a no-op. - `EntityTypes` static initialiser: `eyeHeight(0.13F)` for arrow, spectral arrow and trident, `eyeHeight(0.0F)` for wind charges. Other projectiles keep the default 0.85 of their height. `ProjectileKind::eye_height` carries this. Test: new `blast-projectiles` check in `tools/lan_e2e.py`, on two real games. It fails with `explosion.rs` reverted. I also ran one scene on the real 26.3 server jar and in Horizon: TNT with fuse 5, `tick freeze`, then `tick step 8`. Velocity after the blast: | Projectile | Vanilla | Horizon | | --- | --- | --- | | arrow | 0.56725137, -0.00112332 | 0.56725137, -0.00112332 | | snowball | 0.30181795, -0.64526303 | 0.30181793, -0.64526302 | | arrow in the ground | unmoved | unmoved | Not compared against vanilla: TNT minecarts, rockets and the other projectile types. Summoned arrows ignore `NoGravity` in `arrow_from_nbt`, a separate bug not touched here. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at c1f4a7c19, 5 min 40 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +104 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 515 passed (20 s) | | rustfmt | ✅ (7 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (1 min 36 s) | | tests: horizon-client | ✅ 1678 passed (3 min 33 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 | ➖ 319 affected, to run in CI (--quick): arrow, auto_jump, block_removal, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen and 307 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:23:15 +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#6576
No description provided.