[PR #5079] [MERGED] fix(worldgen): a template with entities and no blocks places them #6046

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

📋 Pull Request Information

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

Base: main ← Head: fix/entities-only-template


📝 Commits (1)

  • 67188b6 fix(worldgen): a template with entities and no blocks places them

📊 Changes

2 files changed (+80 additions, -5 deletions)

View changed files

📝 crates/horizon-world/src/level/growth_tests.rs (+74 -2)
📝 crates/horizon-world/src/worldgen/structure/processor.rs (+6 -3)

📄 Description

What and why

A structure template with entities and no blocks did not place
place_in_world returned false as soon as the chosen palette had no blocks, before it reached the entities
So /place template reported commands.place.template.failed for such a template and spawned nothing
A structure block in Load mode spawned nothing either (it ignores the result, as vanilla does)

place_in_world now goes on when the palette has blocks, or when entities are not ignored and the template has some, as vanilla does
It still returns false with no palette, with no blocks and no entities to place, or with a side below 1
With no blocks the block, fluid and shape passes have nothing to do, so only the entities are placed
/place template then sends commands.place.template.success, and the structure block spawns the entities
A test places a template with one pig and no blocks
It places and hands back the pig moved to the placed position
The same template with entities ignored fails, and so does one with neither blocks nor entities

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 (net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java:249-256): false when palettes is empty, then it places when !blockInfoList.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty() and every side is at least 1
It returns true after placeEntities (:379-394), false otherwise (:396)
PlaceCommand.placeTemplate throws ERROR_TEMPLATE_FAILED when it returns false, else sends commands.place.template.success (net/minecraft/server/commands/PlaceCommand.java:371-378)
StructureBlockEntity.placeStructure ignores the result (net/minecraft/world/level/block/entity/StructureBlockEntity.java:428)
No parity oracle calls placeInWorld, so the unit test in growth_tests.rs is the check

Other projects' code

none

Self-check

Check Result
Scope ✅ 2 files, +80 −5
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (56 s)
rustfmt ✅ (8 s)
clippy ✅ (1 s)
tests: horizon-world ✅ 317 passed (1 min 17 s)
doc tests ✅ 0 passed (2 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/5079 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/entities-only-template` --- ### 📝 Commits (1) - [`67188b6`](https://github.com/horizon-rust/horizon/commit/67188b668c910dbe26a41d597c17a1ea8ac67272) fix(worldgen): a template with entities and no blocks places them ### 📊 Changes **2 files changed** (+80 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/level/growth_tests.rs` (+74 -2) 📝 `crates/horizon-world/src/worldgen/structure/processor.rs` (+6 -3) </details> ### 📄 Description ## What and why A structure template with entities and no blocks did not place `place_in_world` returned false as soon as the chosen palette had no blocks, before it reached the entities So `/place template` reported `commands.place.template.failed` for such a template and spawned nothing A structure block in Load mode spawned nothing either (it ignores the result, as vanilla does) `place_in_world` now goes on when the palette has blocks, or when entities are not ignored and the template has some, as vanilla does It still returns false with no palette, with no blocks and no entities to place, or with a side below 1 With no blocks the block, fluid and shape passes have nothing to do, so only the entities are placed `/place template` then sends `commands.place.template.success`, and the structure block spawns the entities A test places a template with one pig and no blocks It places and hands back the pig moved to the placed position The same template with entities ignored fails, and so does one with neither blocks nor entities ## 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` (`net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java:249-256`): false when `palettes` is empty, then it places when `!blockInfoList.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty()` and every side is at least 1 It returns true after `placeEntities` (`:379-394`), false otherwise (`:396`) `PlaceCommand.placeTemplate` throws `ERROR_TEMPLATE_FAILED` when it returns false, else sends `commands.place.template.success` (`net/minecraft/server/commands/PlaceCommand.java:371-378`) `StructureBlockEntity.placeStructure` ignores the result (`net/minecraft/world/level/block/entity/StructureBlockEntity.java:428`) No parity oracle calls `placeInWorld`, so the unit test in `growth_tests.rs` is the check ## Other projects' code none ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 2 files, +80 −5 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (56 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 s) | | tests: horizon-world | ✅ 317 passed (1 min 17 s) | | doc tests | ✅ 0 passed (2 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:51 +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#6046
No description provided.