[PR #4932] [MERGED] fix(worldgen): placed templates update their shapes and neighbours in the live level #5952

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4932
Author: @reservedbytes
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/structure-shape-pass


📝 Commits (3)

  • fb7f8a7 fix(worldgen): placed templates update their shapes and neighbours in the live level
  • 32cb2a7 Merge origin/main (brings #4955's block_update/random_tick oracle fix)
  • 9831e6d Merge main into #4932

📊 Changes

3 files changed (+93 additions, -2 deletions)

View changed files

📝 crates/horizon-world/src/level/feature_world.rs (+18 -0)
📝 crates/horizon-world/src/level/growth_tests.rs (+72 -0)
📝 crates/horizon-world/src/worldgen/placement/context.rs (+3 -2)

📄 Description

What and why

A template placed in the live level skipped the shape pass vanilla runs over its blocks once they are down
place_in_world already calls update_from_neighbour_shapes for each placed block when the settings don't know the shape, but LevelFeatureWorld had no implementation, so the trait's no-op ran
So fences, panes, walls and stairs in a template stayed unconnected on the sides where a neighbour was placed before them, and nothing next to the template got a neighbour update
This shows with a structure block in Load mode (not strict) and with /place structure for template pieces such as igloos, shipwrecks and ruined portals
Jigsaw pieces (villages) know their shape and skip the pass, as in vanilla
Template and fossil features placed in the live level (/place feature) get the pass too, as vanilla's do on ServerLevel

LevelFeatureWorld now runs Block.updateFromNeighbourShapes on the placed block, writes the new state with the flags the caller passes (flags & !1 | 16) when it changed, then updates the neighbours around it for the new block, as ServerLevel.updateNeighborsAt does
The world generation region keeps its shape-only pass, since WorldGenRegion leaves updateNeighborsAt a no-op
A test places two fences and a redstone block next to a lamp: not strict, the middle fence connects to the fence placed before it and the lamp lights
Strict, neither happens
/place template places blocks through its own loop and has a separate deviation, left as is here

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

StructureTemplate.placeInWorld (world/level/levelgen/structure/templatesystem/StructureTemplate.java:241): when the settings don't know the shape, updateShapeAtEdge (:345-356), then for each placed block Block.updateFromNeighbourShapes, setBlock with updateMode & -2 | 16 when it changed, and updateNeighborsAt for the new block (:361-368)
StructureBlockEntity.placeStructure places with 2 | (strict ? 816 : 0) and a known shape only when strict (world/level/block/entity/StructureBlockEntity.java:428)
TemplateStructurePiece.postProcess places with flags 2 (world/level/levelgen/structure/TemplateStructurePiece.java:93)
SinglePoolElement sets a known shape (world/level/levelgen/structure/pools/SinglePoolElement.java:170)
LevelAccessor.updateNeighborsAt is a no-op by default (world/level/LevelAccessor.java:62), ServerLevel overrides it (server/level/ServerLevel.java:1172)

Self-check

The horizon-world failure is a_candle_on_an_uneaten_cake_makes_a_candle_cake (#4780)

Check Result
Scope ✅ 3 files, +92 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 484 passed (49 s)
rustfmt ✅ (9 s)
clippy ✅ (2 min 25 s)
tests: horizon-world ❌ 226 passed, 1 failed (1 min 51 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root 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)

🔄 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/4932 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/structure-shape-pass` --- ### 📝 Commits (3) - [`fb7f8a7`](https://github.com/horizon-rust/horizon/commit/fb7f8a7656cd4c7514003516ba507299825f1ff5) fix(worldgen): placed templates update their shapes and neighbours in the live level - [`32cb2a7`](https://github.com/horizon-rust/horizon/commit/32cb2a76be5775c4554d7ffe5caff03560bbd13b) Merge origin/main (brings #4955's block_update/random_tick oracle fix) - [`9831e6d`](https://github.com/horizon-rust/horizon/commit/9831e6d14616cfcbbc6d6a14ae4be61d33bc318c) Merge main into #4932 ### 📊 Changes **3 files changed** (+93 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/level/feature_world.rs` (+18 -0) 📝 `crates/horizon-world/src/level/growth_tests.rs` (+72 -0) 📝 `crates/horizon-world/src/worldgen/placement/context.rs` (+3 -2) </details> ### 📄 Description ## What and why A template placed in the live level skipped the shape pass vanilla runs over its blocks once they are down `place_in_world` already calls `update_from_neighbour_shapes` for each placed block when the settings don't know the shape, but `LevelFeatureWorld` had no implementation, so the trait's no-op ran So fences, panes, walls and stairs in a template stayed unconnected on the sides where a neighbour was placed before them, and nothing next to the template got a neighbour update This shows with a structure block in Load mode (not strict) and with `/place structure` for template pieces such as igloos, shipwrecks and ruined portals Jigsaw pieces (villages) know their shape and skip the pass, as in vanilla Template and fossil features placed in the live level (`/place feature`) get the pass too, as vanilla's do on `ServerLevel` `LevelFeatureWorld` now runs `Block.updateFromNeighbourShapes` on the placed block, writes the new state with the flags the caller passes (`flags & !1 | 16`) when it changed, then updates the neighbours around it for the new block, as `ServerLevel.updateNeighborsAt` does The world generation region keeps its shape-only pass, since `WorldGenRegion` leaves `updateNeighborsAt` a no-op A test places two fences and a redstone block next to a lamp: not strict, the middle fence connects to the fence placed before it and the lamp lights Strict, neither happens `/place template` places blocks through its own loop and has a separate deviation, left as is here ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `StructureTemplate.placeInWorld` (`world/level/levelgen/structure/templatesystem/StructureTemplate.java:241`): when the settings don't know the shape, `updateShapeAtEdge` (`:345-356`), then for each placed block `Block.updateFromNeighbourShapes`, `setBlock` with `updateMode & -2 | 16` when it changed, and `updateNeighborsAt` for the new block (`:361-368`) `StructureBlockEntity.placeStructure` places with `2 | (strict ? 816 : 0)` and a known shape only when strict (`world/level/block/entity/StructureBlockEntity.java:428`) `TemplateStructurePiece.postProcess` places with flags 2 (`world/level/levelgen/structure/TemplateStructurePiece.java:93`) `SinglePoolElement` sets a known shape (`world/level/levelgen/structure/pools/SinglePoolElement.java:170`) `LevelAccessor.updateNeighborsAt` is a no-op by default (`world/level/LevelAccessor.java:62`), `ServerLevel` overrides it (`server/level/ServerLevel.java:1172`) ## Self-check The horizon-world failure is `a_candle_on_an_uneaten_cake_makes_a_candle_cake` (#4780) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +92 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 484 passed (49 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 min 25 s) | | tests: horizon-world | ❌ 226 passed, 1 failed (1 min 51 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root 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) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:10 +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#5952
No description provided.