[PR #4703] [MERGED] Structure block: handleSetStructureBlock (save, load, scan) #5792

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

📋 Pull Request Information

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

Base: main ← Head: parity/A1b-structure-server


📝 Commits (2)

  • 177aff1 Structure block: handleSetStructureBlock, save, load, scan and redstone trigger
  • dc6e548 Merge remote-tracking branch 'hr/main' into parity/A1b-structure-server

📊 Changes

13 files changed (+889 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+16 -0)
📝 crates/horizon-client/src/game/commands/data.rs (+1 -1)
📝 crates/horizon-client/src/game/commands/place.rs (+12 -7)
📝 crates/horizon-client/src/game/lan_actions.rs (+1 -0)
➕ crates/horizon-client/src/game/structure_blocks.rs (+595 -0)
📝 crates/horizon-world/src/level/bonemeal.rs (+67 -0)
📝 crates/horizon-world/src/level/feature_world.rs (+16 -0)
📝 crates/horizon-world/src/level/growth.rs (+3 -0)
📝 crates/horizon-world/src/level/hooks.rs (+6 -0)
📝 crates/horizon-world/src/level/mod.rs (+1 -0)
📝 crates/horizon-world/src/worldgen/live.rs (+4 -0)
📝 crates/horizon-world/src/worldgen/structure.rs (+1 -1)
📝 crates/horizon-world/src/worldgen/structure/template.rs (+166 -0)

📄 Description

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

Part of #3520 (stage 1b of the structure/jigsaw/test block project: the structure block server handler).

What and why

#4687 added the structure block entity and packet; nothing handled the packet. This adds the server side on the server-thread / LAN guest path (lan_actions.rs).

  • ServerGamePacketListenerImpl.handleSetStructureBlock: game masters only (creative, permission 2), applies the fields, then runs the update type: save, load (prepare/execute), and corner size scan, with the vanilla chat messages (structure_block.*).
  • StructureBlockEntity.saveStructure/loadStructure/detectSize/placeStructureIfSameSize: templates are cached like StructureTemplateManager (misses included) and written to <world>/generated/<ns>/structures/<path>.nbt, falling back to resources on load.
  • StructureTemplate.fillFromWorld and save (new save_nbt in horizon-world: full blocks, other blocks, block entities, palette, entities, size, DataVersion) and placeInWorld on the live level (Behaviours::place_template: mirror, rotation, integrity, seed, flags, block entities and entities).
  • StructureBlock.neighborChanged (redstone trigger) and setPlacedBy (author).

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

handleSetStructureBlock, StructureBlockEntity.*, StructureBlock.neighborChanged/setPlacedBy, StructureTemplate.fillFromWorld/save/placeInWorld, StructureTemplateManager.

Tests

save_tests in horizon-world (template save/from_nbt round trip) and game::structure_blocks tests. fmt and clippy -D warnings clean on horizon-world and horizon-client.

🤖 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/4703 **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/A1b-structure-server` --- ### 📝 Commits (2) - [`177aff1`](https://github.com/horizon-rust/horizon/commit/177aff124043f3315d03b4078984e60073f6433a) Structure block: handleSetStructureBlock, save, load, scan and redstone trigger - [`dc6e548`](https://github.com/horizon-rust/horizon/commit/dc6e5485389316cf13525918b6bfcbb79cfe5a79) Merge remote-tracking branch 'hr/main' into parity/A1b-structure-server ### 📊 Changes **13 files changed** (+889 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+16 -0) 📝 `crates/horizon-client/src/game/commands/data.rs` (+1 -1) 📝 `crates/horizon-client/src/game/commands/place.rs` (+12 -7) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+1 -0) ➕ `crates/horizon-client/src/game/structure_blocks.rs` (+595 -0) 📝 `crates/horizon-world/src/level/bonemeal.rs` (+67 -0) 📝 `crates/horizon-world/src/level/feature_world.rs` (+16 -0) 📝 `crates/horizon-world/src/level/growth.rs` (+3 -0) 📝 `crates/horizon-world/src/level/hooks.rs` (+6 -0) 📝 `crates/horizon-world/src/level/mod.rs` (+1 -0) 📝 `crates/horizon-world/src/worldgen/live.rs` (+4 -0) 📝 `crates/horizon-world/src/worldgen/structure.rs` (+1 -1) 📝 `crates/horizon-world/src/worldgen/structure/template.rs` (+166 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3520 (stage 1b of the structure/jigsaw/test block project: the structure block server handler). ## What and why #4687 added the structure block entity and packet; nothing handled the packet. This adds the server side on the server-thread / LAN guest path (`lan_actions.rs`). - `ServerGamePacketListenerImpl.handleSetStructureBlock`: game masters only (creative, permission 2), applies the fields, then runs the update type: save, load (prepare/execute), and corner size scan, with the vanilla chat messages (`structure_block.*`). - `StructureBlockEntity.saveStructure/loadStructure/detectSize/placeStructureIfSameSize`: templates are cached like `StructureTemplateManager` (misses included) and written to `<world>/generated/<ns>/structures/<path>.nbt`, falling back to resources on load. - `StructureTemplate.fillFromWorld` and `save` (new `save_nbt` in horizon-world: full blocks, other blocks, block entities, palette, entities, size, DataVersion) and `placeInWorld` on the live level (`Behaviours::place_template`: mirror, rotation, integrity, seed, flags, block entities and entities). - `StructureBlock.neighborChanged` (redstone trigger) and `setPlacedBy` (author). ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `handleSetStructureBlock`, `StructureBlockEntity.*`, `StructureBlock.neighborChanged/setPlacedBy`, `StructureTemplate.fillFromWorld/save/placeInWorld`, `StructureTemplateManager`. ## Tests `save_tests` in horizon-world (template save/from_nbt round trip) and `game::structure_blocks` tests. fmt and clippy `-D warnings` clean on horizon-world and horizon-client. 🤖 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:15:01 +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#5792
No description provided.