[PR #5039] [MERGED] TNT minecart: a primed cart's blast spares rails and the blocks under them #6020

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

📋 Pull Request Information

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

Base: main ← Head: fix/tnt-minecart-spares-rails


📝 Commits (1)

  • 9cccb97 TNT minecart: a primed cart's blast spares rails and the blocks under them

📊 Changes

4 files changed (+44 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/combat.rs (+4 -0)
📝 crates/horizon-client/src/game/explosion.rs (+12 -2)
📝 crates/horizon-client/src/game/minecarts.rs (+4 -0)
📝 tools/command_exec_corpus.py (+24 -0)

📄 Description

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

What and why

Fixes #4992. In vanilla, a TNT minecart that goes off while primed (an activator rail lit its fuse) leaves rails and the block under a rail alone: its blast gives them no resistance and never breaks them. Horizon blew them up like any block, so a cart primed on an activator rail destroyed its own track and the block holding it. The reporter's "explodes through blocks on an activator rail" is partly vanilla: because those blocks have no resistance, the blast passes through them.

  • game/minecarts.rs explode_cart: sets combat.rail_proof_blast for the blast when the cart is primed (fuse >= 0, MinecartTNT.isPrimed: fuse > -1). An unprimed cart (one that fell or burned) blasts rails as before.
  • game/explosion.rs exploded_positions: under that flag, a rail or a block with a rail above loses no ray power to resistance (0, though air still costs nothing) and is never added to the blown positions.
  • game/combat.rs: the flag, next to hive_emptying_blast, which is set the same way.
  • Rails are the #minecraft:rails set that Game::rail already recognises (rail, powered, detector, activator).

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

Read from the 26.3 bytecode (javap):

  • MinecartTNT.getBlockExplosionResistance(Explosion, BlockGetter, BlockPos, BlockState, FluidState, float): isPrimed() && (state.is(BlockTags.RAILS) || level.getBlockState(pos.above()).is(BlockTags.RAILS)) → 0.0F, otherwise super.
  • MinecartTNT.shouldBlockExplode(...): the same test → false, otherwise super.
  • EntityBasedExplosionDamageCalculator maps those over the default resistance (empty for air with no fluid), and ServerExplosion.calculateExplodedPositions adds a position only when shouldBlockExplode.

Harness: tools/test_command_exec_parity.py, new group tnt minecart rails in command_exec_corpus.py. A cart is primed on an activator rail over a redstone block inside a 5×5×5 obsidian box, with stone beside the redstone block and stone outside the box. After the blast, the rail and the redstone block are still there, the stone beside them is gone, and the obsidian and outside stone hold.

  • This branch: tnt minecart rails: 8/8, and the whole harness passes, 935/935 commands match (all 26 groups).
  • Main with the new group: 6/8. The activator rail and the redstone block are destroyed (vanilla: "Test passed", Horizon: "Test failed").

I ran it locally with lab.prepare on the pinned 26.3 jars (checksums from research-lock.json), with Java 25.

Self-check

pr_ready (tools/pr_ready.py --quick on arch, against origin/main at 9d979caa4, 6 min 44 s)

Check Result
Scope ✅ 4 files, +44 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (1 min 2 s)
rustfmt ✅ (14 s)
clippy ✅ (47 s)
tests: horizon-client ❌ 932 passed, 1 failed (4 min 38 s)
doc tests ✅ 0 passed (2 s)
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)

About the one failure: it was a library test on that run, with the vanilla data in .local/. I ran pr_ready's exact command (cargo test --locked -p horizon-client --tests) again on the same commit, and every binary passed (lib 933, main 358, horizon-ctl 18, and the integration tests). The lib tests alone also passed again. I didn't catch which test failed the first time, so I'm treating it as flaky, and I've left the row as it printed.


🔄 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/5039 **Author:** [@apeirs](https://github.com/apeirs) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/tnt-minecart-spares-rails` --- ### 📝 Commits (1) - [`9cccb97`](https://github.com/horizon-rust/horizon/commit/9cccb97de106123e51514e1eacdf4c3eb6bbcecb) TNT minecart: a primed cart's blast spares rails and the blocks under them ### 📊 Changes **4 files changed** (+44 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/combat.rs` (+4 -0) 📝 `crates/horizon-client/src/game/explosion.rs` (+12 -2) 📝 `crates/horizon-client/src/game/minecarts.rs` (+4 -0) 📝 `tools/command_exec_corpus.py` (+24 -0) </details> ### 📄 Description > 🤖 Opened by apeirs's AI agent (Claude Code, Claude Opus 5.5), not by apeirs personally. ## What and why Fixes #4992. In vanilla, a TNT minecart that goes off while primed (an activator rail lit its fuse) leaves rails and the block under a rail alone: its blast gives them no resistance and never breaks them. Horizon blew them up like any block, so a cart primed on an activator rail destroyed its own track and the block holding it. The reporter's "explodes through blocks on an activator rail" is partly vanilla: because those blocks have no resistance, the blast passes through them. - `game/minecarts.rs` `explode_cart`: sets `combat.rail_proof_blast` for the blast when the cart is primed (`fuse >= 0`, `MinecartTNT.isPrimed`: `fuse > -1`). An unprimed cart (one that fell or burned) blasts rails as before. - `game/explosion.rs` `exploded_positions`: under that flag, a rail or a block with a rail above loses no ray power to resistance (`0`, though air still costs nothing) and is never added to the blown positions. - `game/combat.rs`: the flag, next to `hive_emptying_blast`, which is set the same way. - Rails are the `#minecraft:rails` set that `Game::rail` already recognises (rail, powered, detector, activator). ## 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 Read from the 26.3 bytecode (javap): - `MinecartTNT.getBlockExplosionResistance(Explosion, BlockGetter, BlockPos, BlockState, FluidState, float)`: `isPrimed() && (state.is(BlockTags.RAILS) || level.getBlockState(pos.above()).is(BlockTags.RAILS))` → `0.0F`, otherwise `super`. - `MinecartTNT.shouldBlockExplode(...)`: the same test → `false`, otherwise `super`. - `EntityBasedExplosionDamageCalculator` maps those over the default resistance (empty for air with no fluid), and `ServerExplosion.calculateExplodedPositions` adds a position only when `shouldBlockExplode`. Harness: `tools/test_command_exec_parity.py`, new group `tnt minecart rails` in `command_exec_corpus.py`. A cart is primed on an activator rail over a redstone block inside a 5×5×5 obsidian box, with stone beside the redstone block and stone outside the box. After the blast, the rail and the redstone block are still there, the stone beside them is gone, and the obsidian and outside stone hold. - This branch: `tnt minecart rails: 8/8`, and the whole harness passes, `935/935 commands match` (all 26 groups). - Main with the new group: `6/8`. The activator rail and the redstone block are destroyed (vanilla: "Test passed", Horizon: "Test failed"). I ran it locally with `lab.prepare` on the pinned 26.3 jars (checksums from `research-lock.json`), with Java 25. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on arch, against origin/main at 9d979caa4, 6 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +44 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (1 min 2 s) | | rustfmt | ✅ (14 s) | | clippy | ✅ (47 s) | | tests: horizon-client | ❌ 932 passed, 1 failed (4 min 38 s) | | doc tests | ✅ 0 passed (2 s) | | 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) | About the one failure: it was a library test on that run, with the vanilla data in `.local/`. I ran pr_ready's exact command (`cargo test --locked -p horizon-client --tests`) again on the same commit, and every binary passed (lib 933, main 358, horizon-ctl 18, and the integration tests). The lib tests alone also passed again. I didn't catch which test failed the first time, so I'm treating it as flaky, and I've left the row as it printed. --- <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:41 +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#6020
No description provided.