[PR #1318] [MERGED] Explosions hurt and push minecarts, so TNT minecarts chain #3483

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1318
Author: @levzzz5154
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @ludovic111

Base: main ← Head: fix/tnt-minecart-explosions


📝 Commits (2)

  • 18bf8cd Minecarts push each other in their own ticks, as vanilla does
  • 18078e0 Explosions hurt and push minecarts, so TNT minecarts chain

📊 Changes

2 files changed (+118 additions, -61 deletions)

View changed files

📝 crates/horizon-client/src/game/explosion.rs (+29 -1)
📝 crates/horizon-client/src/game/minecarts.rs (+89 -60)

📄 Description

Builds on #1317, which changes the same cart tick loop. Only the second commit (Explosions hurt and push minecarts…) is new here; once #1317 merges this diff shrinks to that commit.

What and why

TNT minecarts don't set each other off like in Java. ServerExplosion.hurtEntities in Horizon covered the player, mobs, dropped items and primed TNT, but skipped minecarts, so a TNT cart's blast never reached the carts beside it.

Explosions now reach minecarts as in vanilla:

  • Damage through VehicleEntity.hurtServer: a cart is destroyed past 40. MinecartTNT.destroy then primes a TNT cart with a nextInt(20) + nextInt(20) fuse, since damageSourceIgnitesTnt counts explosions. Other carts break and drop as before.
  • Knockback from the cart's eye position (0.85 of its height), scaled by distance and exposure, like other non-living entities.
  • The exploding cart is the explosion's source, so it's removed before the blast and can't hit itself.
  • Cart ticks look carts up by id, because a blast can remove or prime other carts partway through the loop. Before, an index could then point at the wrong cart. The guest-ridden cart skip from #1280 is kept.
  • MinecartTNT.destroy's speed threshold now uses the float 0.01f, as vanilla does.

Tested in game: six TNT minecarts 3 blocks apart on a rail, with only the first one lit. It now sets off and pushes the others one after another, and all six are gone in about 3 seconds. Before this, only the first one exploded.

Vanilla reference

  • ServerExplosion.hurtEntities
  • VehicleEntity.hurtServer
  • MinecartTNT.hurtServer, MinecartTNT.destroy, MinecartTNT.damageSourceIgnitesTnt, MinecartTNT.explode
  • Entity.pushFromExplosion

No harness yet: there is no minecart or explosion-on-vehicle harness to extend. Happy to add one if you'd like it here.

Self-check

Run with --quick (no local parity cache yet; the harnesses are left to run-parity).

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at 07e717977, 1 min 48 s)

Check Result
Scope ✅ 2 files, +118 −61
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (4 s)
clippy ✅ (3 s)
tests: horizon-client ✅ 1137 passed (1 min 39 s)
doc tests ✅ 0 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 246 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, datafix, decorated_region, decoration, decoration_region, dedicated_server, delta, density and 234 more
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/1318 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/tnt-minecart-explosions` --- ### 📝 Commits (2) - [`18bf8cd`](https://github.com/horizon-rust/horizon/commit/18bf8cd2ef0fda0582bf59540ade05d0ce5a9d27) Minecarts push each other in their own ticks, as vanilla does - [`18078e0`](https://github.com/horizon-rust/horizon/commit/18078e058d52e7aef20cea156326d3816ca61918) Explosions hurt and push minecarts, so TNT minecarts chain ### 📊 Changes **2 files changed** (+118 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/explosion.rs` (+29 -1) 📝 `crates/horizon-client/src/game/minecarts.rs` (+89 -60) </details> ### 📄 Description > **Builds on #1317**, which changes the same cart tick loop. Only the second commit (`Explosions hurt and push minecarts…`) is new here; once #1317 merges this diff shrinks to that commit. ## What and why TNT minecarts don't set each other off like in Java. `ServerExplosion.hurtEntities` in Horizon covered the player, mobs, dropped items and primed TNT, but skipped minecarts, so a TNT cart's blast never reached the carts beside it. Explosions now reach minecarts as in vanilla: - **Damage** through `VehicleEntity.hurtServer`: a cart is destroyed past 40. `MinecartTNT.destroy` then primes a TNT cart with a `nextInt(20) + nextInt(20)` fuse, since `damageSourceIgnitesTnt` counts explosions. Other carts break and drop as before. - **Knockback** from the cart's eye position (0.85 of its height), scaled by distance and exposure, like other non-living entities. - **The exploding cart is the explosion's source**, so it's removed before the blast and can't hit itself. - **Cart ticks look carts up by id**, because a blast can remove or prime other carts partway through the loop. Before, an index could then point at the wrong cart. The guest-ridden cart skip from #1280 is kept. - `MinecartTNT.destroy`'s speed threshold now uses the float `0.01f`, as vanilla does. Tested in game: six TNT minecarts 3 blocks apart on a rail, with only the first one lit. It now sets off and pushes the others one after another, and all six are gone in about 3 seconds. Before this, only the first one exploded. ## Vanilla reference - `ServerExplosion.hurtEntities` - `VehicleEntity.hurtServer` - `MinecartTNT.hurtServer`, `MinecartTNT.destroy`, `MinecartTNT.damageSourceIgnitesTnt`, `MinecartTNT.explode` - `Entity.pushFromExplosion` No harness yet: there is no minecart or explosion-on-vehicle harness to extend. Happy to add one if you'd like it here. ## Self-check Run with `--quick` (no local parity cache yet; the harnesses are left to `run-parity`). **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at 07e717977, 1 min 48 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +118 −61 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (4 s) | | clippy | ✅ (3 s) | | tests: horizon-client | ✅ 1137 passed (1 min 39 s) | | doc tests | ✅ 0 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 246 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, datafix, decorated_region, decoration, decoration_region, dedicated_server, delta, density and 234 more | | 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 04:09:51 +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#3483
No description provided.