[PR #4687] [MERGED] Structure block: block entity, save format and packet codec #5780

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

📋 Pull Request Information

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

Base: main ← Head: parity/A1-structure


📝 Commits (1)

  • aa44f71 Structure block entity: save format, update tag, packet codec

📊 Changes

9 files changed (+665 additions, -4 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk/block_entity.rs (+2 -0)
📝 crates/horizon-client-render/src/containers.rs (+13 -0)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
➕ crates/horizon-client-render/src/structure_block.rs (+496 -0)
📝 crates/horizon-client/src/game.rs (+4 -2)
📝 crates/horizon-client/src/lan/chunks.rs (+2 -0)
📝 crates/horizon-client/src/lib.rs (+2 -2)
📝 crates/horizon-client/src/save.rs (+2 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+143 -0)

📄 Description

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

Part of #3520, part of #3518 (stage 1 of 4 of the structure/jigsaw/test block project: structure block, step 1 of 3).

What and why

The structure block has no block entity in Horizon: a world's structure blocks lose their data on load, and there is no packet for the editor to send. This adds the data side, with nothing yet using it:

  • StructureBlockEntity: fields, saveAdditional/loadAdditional (clamped offsets and sizes, legacy enum names, defaults), renderMode, getRenderableBox, and the corner scan of detectSize, as a new BlockEntity::StructureBlock. The entity is saved and loaded with the chunk and sent in the chunk update tag (getUpdateTag is saveCustomOnly).
  • ServerboundSetStructureBlockPacket in horizon-protocol (id 60, vanilla's field order, offsets/sizes/integrity clamped on read).

The server handler (handleSetStructureBlock) with saving, loading and scanning comes in the next PR, the edit screen after that.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

StructureBlockEntity.saveAdditional/loadAdditional/renderMode/getRenderableBox/getEnclosingBoundingBox/detectSize, ServerboundSetStructureBlockPacket, StructureMode, Rotation.LEGACY_CODEC, Mirror.LEGACY_CODEC.

Tests

horizon-client-render structure_block::tests (save/load round trip, clamping and defaults, renderable box for rotation and mirror, corner scan) and horizon-protocol set_structure_block_round_trips_and_clamps_like_vanilla. cargo +stable clippy -D warnings clean on the touched crates.

🤖 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/4687 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/A1-structure` --- ### 📝 Commits (1) - [`aa44f71`](https://github.com/horizon-rust/horizon/commit/aa44f715e6cd3a012079874e35fe1ce0cab3b487) Structure block entity: save format, update tag, packet codec ### 📊 Changes **9 files changed** (+665 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk/block_entity.rs` (+2 -0) 📝 `crates/horizon-client-render/src/containers.rs` (+13 -0) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) ➕ `crates/horizon-client-render/src/structure_block.rs` (+496 -0) 📝 `crates/horizon-client/src/game.rs` (+4 -2) 📝 `crates/horizon-client/src/lan/chunks.rs` (+2 -0) 📝 `crates/horizon-client/src/lib.rs` (+2 -2) 📝 `crates/horizon-client/src/save.rs` (+2 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+143 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3520, part of #3518 (stage 1 of 4 of the structure/jigsaw/test block project: structure block, step 1 of 3). ## What and why The structure block has no block entity in Horizon: a world's structure blocks lose their data on load, and there is no packet for the editor to send. This adds the data side, with nothing yet using it: - `StructureBlockEntity`: fields, `saveAdditional`/`loadAdditional` (clamped offsets and sizes, legacy enum names, defaults), `renderMode`, `getRenderableBox`, and the corner scan of `detectSize`, as a new `BlockEntity::StructureBlock`. The entity is saved and loaded with the chunk and sent in the chunk update tag (`getUpdateTag` is `saveCustomOnly`). - `ServerboundSetStructureBlockPacket` in horizon-protocol (id 60, vanilla's field order, offsets/sizes/integrity clamped on read). The server handler (`handleSetStructureBlock`) with saving, loading and scanning comes in the next PR, the edit screen after that. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `StructureBlockEntity.saveAdditional/loadAdditional/renderMode/getRenderableBox/getEnclosingBoundingBox/detectSize`, `ServerboundSetStructureBlockPacket`, `StructureMode`, `Rotation.LEGACY_CODEC`, `Mirror.LEGACY_CODEC`. ## Tests `horizon-client-render` `structure_block::tests` (save/load round trip, clamping and defaults, renderable box for rotation and mirror, corner scan) and `horizon-protocol` `set_structure_block_round_trips_and_clamps_like_vanilla`. `cargo +stable clippy -D warnings` clean on the touched crates. 🤖 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:14:57 +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#5780
No description provided.