[PR #6262] [MERGED] Leave dropped items alone when a mob's blast keeps blocks #6751

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

📋 Pull Request Information

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

Base: main ← Head: fix/items-ignore-keep-blast


📝 Commits (1)

  • 37fc39e Leave dropped items alone when a mob's blast keeps blocks

📊 Changes

1 file changed (+29 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/explosion.rs (+29 -0)

📄 Description

ItemEntity.ignoreExplosion delegates to the explosion's own predicate:

// javap -p -c on ItemEntity
 1: invokeinterface Explosion.shouldAffectBlocklikeEntities
 6: ifeq          15
 9: aload_0  10: aload_1  11: invokespecial Entity.ignoreExplosion
15: iconst_1  16: ireturn                     // ignored: no hurt, no push

and ServerExplosion.shouldAffectBlocklikeEntities is mobGriefing ? true : blockInteraction.shouldAffectBlocklikeEntities(), where KEEP (and TRIGGER_BLOCK) answer
false and DESTROY/DESTROY_WITH_DECAY answer true.

Horizon's entity pass ran the item loop unconditionally: with mobGriefing off, a creeper's
blast still destroyed dropped items and threw the survivors around, where vanilla leaves the
whole stack where it lies. The minecart half of the same story
(VehicleEntity.ignoreExplosion, a mob's blast sparing minecarts) is already modelled there.

Proven: on the build VM, cargo test -q -p horizon-client --bin horizon-client items_ignore_a_blast
→ 1 passed, checking KEEP with the rule off and DESTROY / DESTROY_WITH_DECAY / the rule back on.

Not proven: the item loop itself is not under test (it needs a running level); the wiring is
compile-checked. The in-game check: /gamerule mobGriefing false, blow up a creeper next to a
dropped sword, and watch the sword stay put.

One thing not modelled: Explosion.BlockInteraction.TRIGGER_BLOCK has no Horizon counterpart
(wind charges do not go through server_explode), and vanilla answers false for it, so the
predicate here only has the three states Horizon can produce.


🔄 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/6262 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/items-ignore-keep-blast` --- ### 📝 Commits (1) - [`37fc39e`](https://github.com/horizon-rust/horizon/commit/37fc39e48a8e20da49b0c3eb85dcb9c870f50fcb) Leave dropped items alone when a mob's blast keeps blocks ### 📊 Changes **1 file changed** (+29 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/explosion.rs` (+29 -0) </details> ### 📄 Description `ItemEntity.ignoreExplosion` delegates to the explosion's own predicate: ```java // javap -p -c on ItemEntity 1: invokeinterface Explosion.shouldAffectBlocklikeEntities 6: ifeq 15 9: aload_0 10: aload_1 11: invokespecial Entity.ignoreExplosion 15: iconst_1 16: ireturn // ignored: no hurt, no push ``` and `ServerExplosion.shouldAffectBlocklikeEntities` is `mobGriefing ? true : blockInteraction.shouldAffectBlocklikeEntities()`, where `KEEP` (and `TRIGGER_BLOCK`) answer false and `DESTROY`/`DESTROY_WITH_DECAY` answer true. Horizon's entity pass ran the item loop unconditionally: with `mobGriefing` off, a creeper's blast still destroyed dropped items and threw the survivors around, where vanilla leaves the whole stack where it lies. The minecart half of the same story (`VehicleEntity.ignoreExplosion`, a mob's blast sparing minecarts) is already modelled there. **Proven:** on the build VM, `cargo test -q -p horizon-client --bin horizon-client items_ignore_a_blast` → `1 passed`, checking KEEP with the rule off and DESTROY / DESTROY_WITH_DECAY / the rule back on. **Not proven:** the item loop itself is not under test (it needs a running level); the wiring is compile-checked. The in-game check: `/gamerule mobGriefing false`, blow up a creeper next to a dropped sword, and watch the sword stay put. One thing not modelled: `Explosion.BlockInteraction.TRIGGER_BLOCK` has no Horizon counterpart (wind charges do not go through `server_explode`), and vanilla answers false for it, so the predicate here only has the three states Horizon can produce. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:26:05 +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#6751
No description provided.