[PR #2439] [MERGED] Worldgen: blocks with a block entity get vanilla's default one #4316

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

📋 Pull Request Information

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

Base: main ← Head: fix/generated-block-entities


📝 Commits (1)

  • ec81bea Worldgen: blocks with a block entity get vanilla's default one

📊 Changes

2 files changed (+85 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/lan/chunks.rs (+1 -0)
📝 crates/horizon-client/src/vanillagen.rs (+84 -1)

📄 Description

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

What and why

WorldGenRegion.setBlock gives every block that has a block entity a new one, so vanilla saves block entities for:

  • the sculk sensors, catalysts and shriekers of the deep dark,
  • potent sulfur.

Horizon only saved block entities that a structure or feature placed data for. These kinds have none, so a Horizon-made world had none of them. Over seeds 12345, 1 and 8675309 (1,024 × 1,024 blocks) that was 3,035 sculk sensors, 753 catalysts, 329 shriekers and 21 potent sulfur.

What changes:

  • A finished column adds vanilla's default block entity (block_entity_nbt::canonical) for every block that has one, wherever nothing placed one.
  • Kinds Horizon models itself (the sculk blocks) get the modelled block entity, decoded from that NBT the way a loaded chunk's is (save::decode_block_entity). The rest are kept as raw NBT.
  • block_entity_type knows potent_sulfur.

Vanilla reference

  • WorldGenRegion.setBlock: state.hasBlockEntity() → EntityBlock.newBlockEntity.
  • SculkSensorBlockEntity, SculkCatalystBlockEntity, SculkShriekerBlockEntity, PotentSulfurBlockEntity saveAdditional (the defaults canonical already writes).

Tests

  • New unit test vanillagen::default_block_entity_tests::generated_blocks_get_their_block_entities. A column with a sculk sensor and potent sulfur gets a modelled sculk block entity and a raw potent sulfur one. Block entities already there are kept and not doubled.
  • End to end: over seeds 12345, 1 and 8675309, 1,024 × 1,024 blocks, every sculk sensor (2,918), shrieker (316), catalyst (763) and potent sulfur (21) of the Overworld has its block entity, as in vanilla. The sculk ones save the same fields as vanilla's (listener, last_vibration_frequency, warning_level, cursors).

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on f3665da77390, against upstream/main at 68db8847e, 3 min 38 s)

Check Result
Scope ✅ 2 files, +85 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅ (19 s)
tests: horizon-client ✅ 1336 passed (3 min 10 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 331 affected, to run in CI (--quick): arrow, attribute_map_queries, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim, block_entity_render and 319 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/2439 **Author:** [@FusselTV](https://github.com/FusselTV) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/generated-block-entities` --- ### 📝 Commits (1) - [`ec81bea`](https://github.com/horizon-rust/horizon/commit/ec81bea5bfc0270e4b597eff4d0dc2f320258874) Worldgen: blocks with a block entity get vanilla's default one ### 📊 Changes **2 files changed** (+85 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/chunks.rs` (+1 -0) 📝 `crates/horizon-client/src/vanillagen.rs` (+84 -1) </details> ### 📄 Description > 🤖 Opened by FusselTV's AI agent (Claude Code, Opus 5.5), not by FusselTV personally. ## What and why `WorldGenRegion.setBlock` gives every block that has a block entity a new one, so vanilla saves block entities for: - the sculk sensors, catalysts and shriekers of the deep dark, - potent sulfur. Horizon only saved block entities that a structure or feature placed data for. These kinds have none, so a Horizon-made world had none of them. Over seeds 12345, 1 and 8675309 (1,024 × 1,024 blocks) that was 3,035 sculk sensors, 753 catalysts, 329 shriekers and 21 potent sulfur. What changes: - A finished column adds vanilla's default block entity (`block_entity_nbt::canonical`) for every block that has one, wherever nothing placed one. - Kinds Horizon models itself (the sculk blocks) get the modelled block entity, decoded from that NBT the way a loaded chunk's is (`save::decode_block_entity`). The rest are kept as raw NBT. - `block_entity_type` knows `potent_sulfur`. ## Vanilla reference - `WorldGenRegion.setBlock`: `state.hasBlockEntity()` → `EntityBlock.newBlockEntity`. - `SculkSensorBlockEntity`, `SculkCatalystBlockEntity`, `SculkShriekerBlockEntity`, `PotentSulfurBlockEntity` `saveAdditional` (the defaults `canonical` already writes). ## Tests - New unit test `vanillagen::default_block_entity_tests::generated_blocks_get_their_block_entities`. A column with a sculk sensor and potent sulfur gets a modelled sculk block entity and a raw potent sulfur one. Block entities already there are kept and not doubled. - End to end: over seeds 12345, 1 and 8675309, 1,024 × 1,024 blocks, every sculk sensor (2,918), shrieker (316), catalyst (763) and potent sulfur (21) of the Overworld has its block entity, as in vanilla. The sculk ones save the same fields as vanilla's (`listener`, `last_vibration_frequency`, `warning_level`, `cursors`). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on f3665da77390, against upstream/main at 68db8847e, 3 min 38 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +85 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ (19 s) | | tests: horizon-client | ✅ 1336 passed (3 min 10 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 331 affected, to run in CI (--quick): arrow, attribute_map_queries, auto_jump, biome_source_codec, biome_temperature, biome_weather, biome_zoom, block_blob, block_collision_scan, block_column, block_entity_anim, block_entity_render and 319 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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 04:16:18 +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#4316
No description provided.