[PR #4236] [MERGED] Explosions break paintings, cushions and armour stands #5505

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4236
Author: @d3grando
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3514-explosions-break-decorations


📝 Commits (1)

  • 16356bd Explosions break paintings, cushions and armour stands

📊 Changes

3 files changed (+151 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game/armor_stands.rs (+35 -11)
📝 crates/horizon-client/src/game/explosion.rs (+113 -1)
📝 crates/horizon-client/src/game/frames.rs (+3 -7)

📄 Description

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

What and why

Part of #3514 (the BlockAttachedEntity.ignoreExplosion row: "explosions do not break paintings, item frames, cushions or armour stands". Item frames were done in #3954. This PR covers the rest of the row.)

A TNT, creeper or fireball blast left paintings, cushions and armour stands untouched. The entity pass in game/explosion.rs (explosion_hurt_entities) only went through the player, LAN guests, mobs, dropped items, primed TNT, minecarts and item frames. Nothing in paintings.rs, cushions.rs or armor_stands.rs responded to an explosion.

Vanilla's ServerExplosion.hurtEntities calls hurtServer on every entity in reach that does not ignoreExplosion:

  • Paintings and cushions: BlockAttachedEntity.hurtServer kills them, then dropItem drops the painting or the coloured cushion. The entity_drops rule and the break sound apply, as for any other break.
  • Armour stands: with an IS_EXPLOSION source, ArmorStand.hurtServer calls brokenByAnything and then kill. The equipment pops above the stand's block, except items with curse of vanishing. The stand item itself does not drop. An invisible stand or a marker is left alone (ArmorStand.ignoreExplosion and the invisible/isMarker check in hurtServer).
  • When decorations are spared: if mobGriefing is off, a blast that keeps blocks is ignored (ServerExplosion.shouldAffectBlocklikeEntities). So is a blast whose source entity is a mob (source.getEntity() instanceof Mob). TNT still breaks them in that case.

Changes:

  • explosion.rs:
    • New explosion_breaks_decorations. It breaks paintings (measured from the centre of their box, which is where HangingEntity.recalculateBoundingBox puts the entity), cushions and armour stands within the blast's diameter.
    • blast_reaches and blast_spares_decorations now hold the range test and the mobGriefing gate. Item frames use the same gate, which now also treats a mob-owned projectile's blast (ghast fireball) as mob-caused.
  • armor_stands.rs:
    • The fire path's brokenByAnything drop code moved into break_armor_stand_by_anything, so burning and blasts share it.
    • New spared_by_blast (invisible or marker).
  • Order fix: vanilla collects the entities in reach before it hurts any of them. So the items that broken decorations drop are not hit by the same blast. Horizon broke frames before its dropped-item pass, so a frame's drops were destroyed right away. Testing this PR showed the same happening to painting drops. Frames and the new decorations now break after the item pass, and their drops land as in vanilla.

Not ported (the frames code has the same gap): BlockAttachedEntity.ignoreExplosion also spares paintings and cushions when the exploding entity is in water. Cushion.isBreakingDeniedFor (a source player who may not build) is also left out, because Horizon does not track a player as the owner of an explosion.

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 with javap on the 26.3 client.jar:

  • ServerExplosion.hurtEntities: one getEntities list, then ignoreExplosion, the distance / diameter <= 1 check and hurtServer.
  • ServerExplosion.shouldAffectBlocklikeEntities: mobGriefing, or the interaction's flag, and not a wind charge.
  • BlockAttachedEntity.ignoreExplosion and BlockAttachedEntity.hurtServer: the mobGriefing + Mob source check, then kill and dropItem.
  • Painting.dropItem and Cushion.hurtServer / Cushion.dropItem.
  • HangingEntity.recalculateBoundingBox: the position is the box centre.
  • ArmorStand.ignoreExplosion, ArmorStand.hurtServer (the IS_EXPLOSION branch), ArmorStand.brokenByAnything (PREVENT_EQUIPMENT_DROP, popResource at blockPosition().above()), ArmorStand.kill, and the empty entities/armor_stand loot table.

No parity harness covers explosions on entities. server_entities has paintings and armour stands, but its TNT has a 2000-tick fuse and never goes off. Bin-target unit tests check the reach, the mobGriefing gate and which stands a blast spares. The full behaviour was checked in game (see Screenshots).

Self-check

tools/pr_ready.py does not run on Windows (it needs SIGHUP), so I ran these steps by hand:

cargo fmt --all -- --check                                        -> ok
cargo clippy -p horizon-client --all-targets -- -D warnings       -> ok (Finished, no warnings)
cargo test -p horizon-client --bin horizon-client -- game::explosion:: game::armor_stands::
  -> test result: ok. 9 passed; 0 failed
     (new: blasts_reach_entities_within_their_diameter,
      mob_griefing_off_spares_decorations_from_kept_and_mob_blasts,
      only_visible_non_marker_stands_are_broken_by_blasts)

Before the fix (the code reverted, the new tests kept), the tests fail because main has no blast path for these entities:

error[E0425]: cannot find function `spared_by_blast` in this scope
error[E0425]: cannot find function `blast_reaches` in this scope
error[E0425]: cannot find function `blast_spares_decorations` in this scope
error: could not compile `horizon-client` (bin "horizon-client" test) due to 12 previous errors

In game (single player on its server thread, cargo build --profile fast, creative): an obsidian room, so the blast breaks no blocks and nothing loses its support. It has two paintings on the wall, two armour stands (one wearing a diamond helmet) and a red cushion. TNT is primed in front of them with a redstone block.

  • main: after the blast all five decorations are still there. The only item on the ground is the redstone block.
  • this branch: all five are gone. The ground holds 2 paintings, 1 red cushion, 1 diamond helmet and no armour stand item (as in vanilla), plus the redstone block.

The window is a client of the server thread, so the removal reaches clients through the entity tracker. A LAN guest uses the same path.

Screenshots

Same obsidian room, same view, noon. Before: main after the TNT went off, with both paintings, both armour stands and the cushion still standing. After: this branch after the same blast, with the decorations gone and their items (two paintings, the cushion and the helmet) on the floor.

before (main): after the TNT blast both paintings, both armour stands and the cushion are still there

after (this branch): the decorations are gone and their items lie on the floor

🤖 Generated with Claude Code


🔄 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/4236 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3514-explosions-break-decorations` --- ### 📝 Commits (1) - [`16356bd`](https://github.com/horizon-rust/horizon/commit/16356bdc5799d7ce2dc5e1c851bd0366d081cc71) Explosions break paintings, cushions and armour stands ### 📊 Changes **3 files changed** (+151 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/armor_stands.rs` (+35 -11) 📝 `crates/horizon-client/src/game/explosion.rs` (+113 -1) 📝 `crates/horizon-client/src/game/frames.rs` (+3 -7) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why Part of #3514 (the `BlockAttachedEntity.ignoreExplosion` row: "explosions do not break paintings, item frames, cushions or armour stands". Item frames were done in #3954. This PR covers the rest of the row.) A TNT, creeper or fireball blast left paintings, cushions and armour stands untouched. The entity pass in `game/explosion.rs` (`explosion_hurt_entities`) only went through the player, LAN guests, mobs, dropped items, primed TNT, minecarts and item frames. Nothing in `paintings.rs`, `cushions.rs` or `armor_stands.rs` responded to an explosion. Vanilla's `ServerExplosion.hurtEntities` calls `hurtServer` on every entity in reach that does not `ignoreExplosion`: - **Paintings and cushions**: `BlockAttachedEntity.hurtServer` kills them, then `dropItem` drops the painting or the coloured cushion. The `entity_drops` rule and the break sound apply, as for any other break. - **Armour stands**: with an `IS_EXPLOSION` source, `ArmorStand.hurtServer` calls `brokenByAnything` and then `kill`. The equipment pops above the stand's block, except items with curse of vanishing. The stand item itself does not drop. An invisible stand or a marker is left alone (`ArmorStand.ignoreExplosion` and the `invisible`/`isMarker` check in `hurtServer`). - **When decorations are spared**: if `mobGriefing` is off, a blast that keeps blocks is ignored (`ServerExplosion.shouldAffectBlocklikeEntities`). So is a blast whose source entity is a mob (`source.getEntity() instanceof Mob`). TNT still breaks them in that case. Changes: - `explosion.rs`: - New `explosion_breaks_decorations`. It breaks paintings (measured from the centre of their box, which is where `HangingEntity.recalculateBoundingBox` puts the entity), cushions and armour stands within the blast's diameter. - `blast_reaches` and `blast_spares_decorations` now hold the range test and the `mobGriefing` gate. Item frames use the same gate, which now also treats a mob-owned projectile's blast (ghast fireball) as mob-caused. - `armor_stands.rs`: - The fire path's `brokenByAnything` drop code moved into `break_armor_stand_by_anything`, so burning and blasts share it. - New `spared_by_blast` (invisible or marker). - **Order fix**: vanilla collects the entities in reach before it hurts any of them. So the items that broken decorations drop are not hit by the same blast. Horizon broke frames before its dropped-item pass, so a frame's drops were destroyed right away. Testing this PR showed the same happening to painting drops. Frames and the new decorations now break after the item pass, and their drops land as in vanilla. Not ported (the frames code has the same gap): `BlockAttachedEntity.ignoreExplosion` also spares paintings and cushions when the exploding entity is in water. `Cushion.isBreakingDeniedFor` (a source player who may not build) is also left out, because Horizon does not track a player as the owner of an explosion. ## 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 with javap on the 26.3 `client.jar`: - `ServerExplosion.hurtEntities`: one `getEntities` list, then `ignoreExplosion`, the distance / diameter <= 1 check and `hurtServer`. - `ServerExplosion.shouldAffectBlocklikeEntities`: `mobGriefing`, or the interaction's flag, and not a wind charge. - `BlockAttachedEntity.ignoreExplosion` and `BlockAttachedEntity.hurtServer`: the `mobGriefing` + `Mob` source check, then `kill` and `dropItem`. - `Painting.dropItem` and `Cushion.hurtServer` / `Cushion.dropItem`. - `HangingEntity.recalculateBoundingBox`: the position is the box centre. - `ArmorStand.ignoreExplosion`, `ArmorStand.hurtServer` (the `IS_EXPLOSION` branch), `ArmorStand.brokenByAnything` (`PREVENT_EQUIPMENT_DROP`, `popResource` at `blockPosition().above()`), `ArmorStand.kill`, and the empty `entities/armor_stand` loot table. No parity harness covers explosions on entities. `server_entities` has paintings and armour stands, but its TNT has a 2000-tick fuse and never goes off. Bin-target unit tests check the reach, the `mobGriefing` gate and which stands a blast spares. The full behaviour was checked in game (see Screenshots). ## Self-check `tools/pr_ready.py` does not run on Windows (it needs SIGHUP), so I ran these steps by hand: ``` cargo fmt --all -- --check -> ok cargo clippy -p horizon-client --all-targets -- -D warnings -> ok (Finished, no warnings) cargo test -p horizon-client --bin horizon-client -- game::explosion:: game::armor_stands:: -> test result: ok. 9 passed; 0 failed (new: blasts_reach_entities_within_their_diameter, mob_griefing_off_spares_decorations_from_kept_and_mob_blasts, only_visible_non_marker_stands_are_broken_by_blasts) ``` Before the fix (the code reverted, the new tests kept), the tests fail because main has no blast path for these entities: ``` error[E0425]: cannot find function `spared_by_blast` in this scope error[E0425]: cannot find function `blast_reaches` in this scope error[E0425]: cannot find function `blast_spares_decorations` in this scope error: could not compile `horizon-client` (bin "horizon-client" test) due to 12 previous errors ``` In game (single player on its server thread, `cargo build --profile fast`, creative): an obsidian room, so the blast breaks no blocks and nothing loses its support. It has two paintings on the wall, two armour stands (one wearing a diamond helmet) and a red cushion. TNT is primed in front of them with a redstone block. - main: after the blast all five decorations are still there. The only item on the ground is the redstone block. - this branch: all five are gone. The ground holds 2 paintings, 1 red cushion, 1 diamond helmet and no armour stand item (as in vanilla), plus the redstone block. The window is a client of the server thread, so the removal reaches clients through the entity tracker. A LAN guest uses the same path. ## Screenshots Same obsidian room, same view, noon. Before: main after the TNT went off, with both paintings, both armour stands and the cushion still standing. After: this branch after the same blast, with the decorations gone and their items (two paintings, the cushion and the helmet) on the floor. ![before (main): after the TNT blast both paintings, both armour stands and the cushion are still there](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/3514-explosions-break-decorations-1.png) ![after (this branch): the decorations are gone and their items lie on the floor](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/3514-explosions-break-decorations-2.png) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:03 +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#5505
No description provided.