[PR #169] [MERGED] Beds and straw beds blow up when used in the Nether and the End #2371

Closed
opened 2026-11-02 15:55:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/169
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: fix/bed-explosions-101


📝 Commits (1)

  • 190f89b Beds and straw beds blow up when used in the Nether and the End

📊 Changes

5 files changed (+112 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/dispense_fixture.rs (+4 -2)
📝 crates/horizon-client/src/game/respawn_anchor.rs (+53 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java (+7 -1)
📝 tools/test_use_item_on_parity.py (+45 -2)

📄 Description

Stacked on #163 (respawn anchors): it reuses that PR's explosion work (the bad_respawn_point damage type, BaseFireBlock.getState fire, the explosion radius in block loot, TntBlock.wasExploded). GitHub retargets this PR to main when #163 merges; the diff against #163 is 5 files.

What was wrong

Right-clicking a bed in the Nether or the End tried to sleep in it as in the Overworld ("You can sleep only at night…" or sleeping, and setting the respawn point there), instead of blowing up.

What vanilla does

AbstractBedBlock.useWithoutItem (after finding the head) reads getBedRule, the dimension's minecraft:gameplay/bed_rule environment attribute (straw_bed_rule for straw beds). In the_nether and the_end both are destroy_on_use: true (no error message), so it calls destroyOnUse:

  • BedBlock.destroyOnUse: removeBlock(head), then removeBlock(foot) if the block behind the head is still this bed, then level.explode(null, damageSources().badRespawnPointExplosion(center), null, center, 5.0F, true, ExplosionInteraction.BLOCK) at the head's centre — the "Intentional Game Design" death message.
  • StrawBedBlock.destroyOnUse → destroyBed: block.straw_bed.break_leave, setBlockAndUpdate(head, AIR) (the foot follows through updateShape).
    A bed missing its other half returns CONSUME before any of this.

The fix

PlayerEffect::Sleep (the head of a whole bed) goes to destroy_bed_on_use in the Nether and the End: the halves removed in vanilla's order, then the same block_explosion the respawn anchor uses (power 5, fire, bad_respawn_point, BLOCK interaction with block_explosion_drop_decay); straw beds play their sound and fall apart.

How it was tested

tools/test_use_item_on_parity.py now clicks beds (several colours) and straw beds — head or foot, with or without their other half, any facing, among stone, planks, glass, TNT, water, obsidian… — in the Nether and the End (the oracle gains the End's dimension type and attributes), with an empty hand or an item, through vanilla's real ServerPlayerGameMode.useItemOn and ServerExplosion. Every block change, drop, primed TNT, sound, game event and the final level random: 4,000 / 4,000 cases match (344 explosions in the run). cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace, tools/check_public_tree.py.

Fixes #101

🤖 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/169 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/bed-explosions-101` --- ### 📝 Commits (1) - [`190f89b`](https://github.com/horizon-rust/horizon/commit/190f89b21452143b33b739fe96ad329b391d9235) Beds and straw beds blow up when used in the Nether and the End ### 📊 Changes **5 files changed** (+112 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/dispense_fixture.rs` (+4 -2) 📝 `crates/horizon-client/src/game/respawn_anchor.rs` (+53 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java` (+7 -1) 📝 `tools/test_use_item_on_parity.py` (+45 -2) </details> ### 📄 Description **Stacked on #163** (respawn anchors): it reuses that PR's explosion work (the `bad_respawn_point` damage type, `BaseFireBlock.getState` fire, the explosion radius in block loot, `TntBlock.wasExploded`). GitHub retargets this PR to `main` when #163 merges; the diff against #163 is 5 files. ## What was wrong Right-clicking a bed in the Nether or the End tried to sleep in it as in the Overworld ("You can sleep only at night…" or sleeping, and setting the respawn point there), instead of blowing up. ## What vanilla does `AbstractBedBlock.useWithoutItem` (after finding the head) reads `getBedRule`, the dimension's `minecraft:gameplay/bed_rule` environment attribute (`straw_bed_rule` for straw beds). In `the_nether` and `the_end` both are `destroy_on_use: true` (no error message), so it calls `destroyOnUse`: - `BedBlock.destroyOnUse`: `removeBlock(head)`, then `removeBlock(foot)` if the block behind the head is still this bed, then `level.explode(null, damageSources().badRespawnPointExplosion(center), null, center, 5.0F, true, ExplosionInteraction.BLOCK)` at the head's centre — the "Intentional Game Design" death message. - `StrawBedBlock.destroyOnUse` → `destroyBed`: `block.straw_bed.break_leave`, `setBlockAndUpdate(head, AIR)` (the foot follows through `updateShape`). A bed missing its other half returns `CONSUME` before any of this. ## The fix `PlayerEffect::Sleep` (the head of a whole bed) goes to `destroy_bed_on_use` in the Nether and the End: the halves removed in vanilla's order, then the same `block_explosion` the respawn anchor uses (power 5, fire, `bad_respawn_point`, `BLOCK` interaction with `block_explosion_drop_decay`); straw beds play their sound and fall apart. ## How it was tested `tools/test_use_item_on_parity.py` now clicks beds (several colours) and straw beds — head or foot, with or without their other half, any facing, among stone, planks, glass, TNT, water, obsidian… — in the Nether and the End (the oracle gains the End's dimension type and attributes), with an empty hand or an item, through vanilla's real `ServerPlayerGameMode.useItemOn` and `ServerExplosion`. Every block change, drop, primed TNT, sound, game event and the final level random: **4,000 / 4,000** cases match (344 explosions in the run). `cargo fmt --check`, `cargo clippy --workspace --all-targets -D warnings`, `cargo test --workspace`, `tools/check_public_tree.py`. Fixes #101 🤖 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-02 15:55:25 +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#2371
No description provided.