[PR #7889] setBlock over a moving piston keeps the extended base #7882

Open
opened 2026-11-03 07:25:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7889
Author: @grkthegreat2018-bot
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/7863-setblock-moving-piston


📝 Commits (1)

  • 7a79e25 setBlock over a moving piston keeps the extended base

📊 Changes

3 files changed (+58 additions, -11 deletions)

View changed files

📝 crates/horizon-world/src/level/hooks.rs (+7 -1)
📝 crates/horizon-world/src/level/tests.rs (+47 -5)
📝 crates/horizon-world/src/level/update.rs (+4 -5)

📄 Description

🤖 Opened by GRKTheGreat's AI agent (Devin, SWE-2 Max), not by GRKTheGreat personally.

What and why

LevelChunk.setBlockState ran MovingPistonBlock.destroy's extended-base
removal on every state change over a moving piston, so /setblock, /fill,
explosions and decay also deleted the extended piston base behind it — a
headless extended piston could not survive. Vanilla only runs destroy on the
player-break path; the finalTick block-entity cleanup still happens on
setBlock.

The fix keeps PistonMovingBlockEntity.finalTick (remove_moving_piston) in
chunk_set_block_state and moves destroy_moving_piston_base to
player_destroy, so only a player breaking the head takes the base with it.

Fixes #7863.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

  • LevelChunk.setBlockState → PistonMovingBlockEntity.preRemoveSideEffects /
    finalTick (block entity removed on replacement)
  • MovingPistonBlock.destroy → ServerPlayerGameMode.destroyBlock
    (extended base removed only on the player break)
  • Tests: replacing_a_moving_piston_leaves_its_extended_base,
    breaking_a_moving_piston_removes_its_extended_base in
    crates/horizon-world/src/level/tests.rs

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on GRKTheGreat, against origin/main at 31f83499b, 4 min 0 s)

Check Result
Scope ✅ 3 files, +58 −11
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (1 min 13 s)
rustfmt ✅ (9 s)
clippy ✅ (1 min 33 s)
tests: horizon-world ✅ 412 passed (1 min 0 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
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)

🤖 Generated with Devin


🔄 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/7889 **Author:** [@grkthegreat2018-bot](https://github.com/grkthegreat2018-bot) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7863-setblock-moving-piston` --- ### 📝 Commits (1) - [`7a79e25`](https://github.com/horizon-rust/horizon/commit/7a79e25da4662c7bb2126776c321ca0c67dbba88) setBlock over a moving piston keeps the extended base ### 📊 Changes **3 files changed** (+58 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/level/hooks.rs` (+7 -1) 📝 `crates/horizon-world/src/level/tests.rs` (+47 -5) 📝 `crates/horizon-world/src/level/update.rs` (+4 -5) </details> ### 📄 Description > 🤖 Opened by GRKTheGreat's AI agent (Devin, SWE-2 Max), not by GRKTheGreat personally. ## What and why `LevelChunk.setBlockState` ran `MovingPistonBlock.destroy`'s extended-base removal on every state change over a moving piston, so `/setblock`, `/fill`, explosions and decay also deleted the extended piston base behind it — a headless extended piston could not survive. Vanilla only runs `destroy` on the player-break path; the `finalTick` block-entity cleanup still happens on `setBlock`. The fix keeps `PistonMovingBlockEntity.finalTick` (`remove_moving_piston`) in `chunk_set_block_state` and moves `destroy_moving_piston_base` to `player_destroy`, so only a player breaking the head takes the base with it. Fixes #7863. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference - `LevelChunk.setBlockState` → `PistonMovingBlockEntity.preRemoveSideEffects` / `finalTick` (block entity removed on replacement) - `MovingPistonBlock.destroy` → `ServerPlayerGameMode.destroyBlock` (extended base removed only on the player break) - Tests: `replacing_a_moving_piston_leaves_its_extended_base`, `breaking_a_moving_piston_removes_its_extended_base` in `crates/horizon-world/src/level/tests.rs` ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on GRKTheGreat, against origin/main at 31f83499b, 4 min 0 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +58 −11 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (1 min 13 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (1 min 33 s) | | tests: horizon-world | ✅ 412 passed (1 min 0 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | 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) | 🤖 Generated with [Devin](https://devin.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7882
No description provided.