[PR #2457] [MERGED] Structures: load the template's block entity NBT #4334

Closed
opened 2026-11-03 04:16:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2457
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/template-block-entity-nbt


📝 Commits (1)

  • 041ecb7 Structures: load the template's block entity NBT into every container and sign

📊 Changes

1 file changed (+19 additions, -15 deletions)

View changed files

📝 crates/horizon-client/src/structure_blocks.rs (+19 -15)

📄 Description

What and why

Structure templates place block entities with their saved NBT, but Horizon only read it for spawners, vaults and banners. Every other block entity came out empty: the End City ship's brewing stand had no potions, the igloo basement brewing stand had no weakness potion and its sign had no text, and fixed items in chests, furnaces and dispensers were lost.

generated_block_entity now decodes the template NBT with the same decoder a chunk load uses (decode_block_entity), so all kinds are covered. A container with a LootTable ignores its Items, as in vanilla, and the loot is rolled as before. Block entities without an id (spawners and bee nests placed by features) get the id of their block.

Vanilla reference

  • StructureTemplate.placeInWorld: blockEntity.loadWithComponents(blockInfo.nbt, ...) for each placed block entity.
  • RandomizableContainer.tryLoadLootTable: when a loot table is present, Items are not loaded.

Self-check

cargo check -p horizon-client passes.


🔄 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/2457 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/template-block-entity-nbt` --- ### 📝 Commits (1) - [`041ecb7`](https://github.com/horizon-rust/horizon/commit/041ecb7b7ab6cfef260341f73a95dc1ae720b5f5) Structures: load the template's block entity NBT into every container and sign ### 📊 Changes **1 file changed** (+19 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/structure_blocks.rs` (+19 -15) </details> ### 📄 Description ## What and why Structure templates place block entities with their saved NBT, but Horizon only read it for spawners, vaults and banners. Every other block entity came out empty: the End City ship's brewing stand had no potions, the igloo basement brewing stand had no weakness potion and its sign had no text, and fixed items in chests, furnaces and dispensers were lost. `generated_block_entity` now decodes the template NBT with the same decoder a chunk load uses (`decode_block_entity`), so all kinds are covered. A container with a `LootTable` ignores its `Items`, as in vanilla, and the loot is rolled as before. Block entities without an id (spawners and bee nests placed by features) get the id of their block. ## Vanilla reference - `StructureTemplate.placeInWorld`: `blockEntity.loadWithComponents(blockInfo.nbt, ...)` for each placed block entity. - `RandomizableContainer.tryLoadLootTable`: when a loot table is present, `Items` are not loaded. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:16:24 +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#4334
No description provided.