[PR #3328] [MERGED] Piston head: destroy fitting base without drops in creative mode #4905

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3328
Author: @echo-ilovech3ss
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/creative-piston-head-drop


📝 Commits (3)

  • 0320e7d Piston head: destroy fitting base without drops in creative mode
  • 9db690b Merge remote-tracking branch 'origin/main' into upd/3328
  • 5302f6a Creative piston head test: check the base drops nothing (main's shape update now removes the head, which drops its empty loot)

📊 Changes

2 files changed (+82 additions, -0 deletions)

View changed files

📝 crates/horizon-world/src/level/hooks.rs (+9 -0)
📝 crates/horizon-world/src/level/tests.rs (+73 -0)

📄 Description

What and Why

Fixes #3317.

In Creative mode, breaking an extended piston head dropped a piston item into the world because PistonHead lacked a creative destruction handler in player_destroy, causing the removal hook to destroy the base with drop = true.

In vanilla Minecraft Java Edition (PistonHeadBlock.playerWillDestroy), breaking the head in creative mode destroys the fitting base block with dropResources = false before the head itself is removed.

Changes

  • crates/horizon-world/src/level/hooks.rs: In player_destroy, if creative && data.is(Class::PistonHead), find the fitting base block and call destroy_block(base_pos, false, super::flags::UPDATE_LIMIT).
  • crates/horizon-world/src/level/tests.rs: Added unit tests verifying that breaking extended normal and sticky piston heads in Creative mode drops zero items, while Survival mode breaking continues to drop the base piston.

Checks

  • cargo test -p horizon-world --lib: all 180 tests pass.
  • python3 -m unittest discover -s tests: 402 tests pass.
  • python3 tools/check_public_tree.py: passed.
  • Verified against vanilla Minecraft 26.3 client bytecode and reviewed by sol-reviewer.

🔄 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/3328 **Author:** [@echo-ilovech3ss](https://github.com/echo-ilovech3ss) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/creative-piston-head-drop` --- ### 📝 Commits (3) - [`0320e7d`](https://github.com/horizon-rust/horizon/commit/0320e7d593a4c21538eaa142bee58525fffeb6a5) Piston head: destroy fitting base without drops in creative mode - [`9db690b`](https://github.com/horizon-rust/horizon/commit/9db690b1e0782764abe6b4d49eb064b94165bef7) Merge remote-tracking branch 'origin/main' into upd/3328 - [`5302f6a`](https://github.com/horizon-rust/horizon/commit/5302f6a22a7a75679318f53c5df4259897659b49) Creative piston head test: check the base drops nothing (main's shape update now removes the head, which drops its empty loot) ### 📊 Changes **2 files changed** (+82 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/level/hooks.rs` (+9 -0) 📝 `crates/horizon-world/src/level/tests.rs` (+73 -0) </details> ### 📄 Description ### What and Why Fixes #3317. In Creative mode, breaking an extended piston head dropped a piston item into the world because `PistonHead` lacked a creative destruction handler in `player_destroy`, causing the removal hook to destroy the base with `drop = true`. In vanilla Minecraft Java Edition (`PistonHeadBlock.playerWillDestroy`), breaking the head in creative mode destroys the fitting base block with `dropResources = false` before the head itself is removed. ### Changes - `crates/horizon-world/src/level/hooks.rs`: In `player_destroy`, if `creative && data.is(Class::PistonHead)`, find the fitting base block and call `destroy_block(base_pos, false, super::flags::UPDATE_LIMIT)`. - `crates/horizon-world/src/level/tests.rs`: Added unit tests verifying that breaking extended normal and sticky piston heads in Creative mode drops zero items, while Survival mode breaking continues to drop the base piston. ### Checks - `cargo test -p horizon-world --lib`: all 180 tests pass. - `python3 -m unittest discover -s tests`: 402 tests pass. - `python3 tools/check_public_tree.py`: passed. - Verified against vanilla Minecraft 26.3 client bytecode and reviewed by sol-reviewer. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:48 +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#4905
No description provided.