[PR #4941] [MERGED] fix(commands): /place template places as a structure template does #5960

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

📋 Pull Request Information

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

Base: main ← Head: fix/place-template-flags


📝 Commits (1)

  • f651954 fix(commands): /place template places as a structure template does

📊 Changes

2 files changed (+64 additions, -119 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/place.rs (+16 -104)
📝 crates/horizon-client/src/game/structure_blocks.rs (+48 -15)

📄 Description

What and why

/place template placed each block in its own loop with UPDATE_ALL when not strict, where vanilla goes through StructureTemplate.placeInWorld with flags 2
The loop also drew the palette from the seed random even at full integrity, where vanilla seeds it from the position
It failed with "commands.place.template.failed" when integrity removed every block, where vanilla succeeds once the template has blocks
It skipped blocks in unloaded chunks instead of checking the template's chunks first and failing with "argument.pos.unloaded"
Its entities kept their saved yaw and facing instead of turning with the template
A template that loaded with no palette failed as invalid, where vanilla reports it as failed

/place template now goes through the structure block's placement (place_template_entry, Behaviours::place_template, place_in_world) with the same settings PlaceCommand.placeTemplate builds
Not strict, it places with flags 2 and an unknown shape, so it gets the edge shape pass now and the per-block shape and neighbour updates once #4932 merges
Strict, it places with 2 | 816 and a known shape, as before
The structure block and the command now build their settings in one function, and a test checks its flags and known shape for both modes
Block entities, loot seeds, waterlogging and the barrier step come from place_in_world, so the command's own block entity handling is gone
The barrier write removes a replaced block entity, stops a jukebox and closes a container screen open on it, so the case #3767 handled for #3708 still holds
Like the structure block, it needs the level's worldgen data, and before that is loaded it reports failed

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

PlaceCommand.placeTemplate (server/commands/PlaceCommand.java:341): checkLoaded from the position's chunk to the chunk of the position plus the template's size (:365), mirror, rotation and setKnownShape(strict) (:366), BlockRotProcessor(integrity) and createRandom(seed) below full integrity (:368), placeInWorld(level, pos, pos, settings, createRandom(seed), 2 | (strict ? 816 : 0)) (:371)
StructureTemplate.placeInWorld (world/level/levelgen/structure/templatesystem/StructureTemplate.java:241): the palette from settings.getRandomPalette (:252), setBlock with the caller's flags (:279), the shape pass when the shape is not known (:345-368), the entities (:381), true once the template has blocks (:394)
StructurePlaceSettings.getRandom seeds from the position when no random is set (world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java:112)
StructureBlockEntity.placeStructure builds the same settings (world/level/block/entity/StructureBlockEntity.java:412-428)

Self-check

The one failure is a_swimming_passenger_sits_up_even_when_standing_does_not_fit (motion.rs), it fails on main too with prepared data (since #4662)

Check Result
Scope ✅ 2 files, +64 −119
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 486 passed (55 s)
rustfmt ✅ (8 s)
clippy ✅ (1 min 42 s)
tests: horizon-client ❌ 908 passed, 1 failed (2 min 47 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/4941 **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/place-template-flags` --- ### 📝 Commits (1) - [`f651954`](https://github.com/horizon-rust/horizon/commit/f65195491306802ed6c486a7493c01cd5b1035dc) fix(commands): /place template places as a structure template does ### 📊 Changes **2 files changed** (+64 additions, -119 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/place.rs` (+16 -104) 📝 `crates/horizon-client/src/game/structure_blocks.rs` (+48 -15) </details> ### 📄 Description ## What and why `/place template` placed each block in its own loop with `UPDATE_ALL` when not strict, where vanilla goes through `StructureTemplate.placeInWorld` with flags 2 The loop also drew the palette from the seed random even at full integrity, where vanilla seeds it from the position It failed with "commands.place.template.failed" when integrity removed every block, where vanilla succeeds once the template has blocks It skipped blocks in unloaded chunks instead of checking the template's chunks first and failing with "argument.pos.unloaded" Its entities kept their saved yaw and facing instead of turning with the template A template that loaded with no palette failed as invalid, where vanilla reports it as failed `/place template` now goes through the structure block's placement (`place_template_entry`, `Behaviours::place_template`, `place_in_world`) with the same settings `PlaceCommand.placeTemplate` builds Not strict, it places with flags 2 and an unknown shape, so it gets the edge shape pass now and the per-block shape and neighbour updates once #4932 merges Strict, it places with `2 | 816` and a known shape, as before The structure block and the command now build their settings in one function, and a test checks its flags and known shape for both modes Block entities, loot seeds, waterlogging and the barrier step come from `place_in_world`, so the command's own block entity handling is gone The barrier write removes a replaced block entity, stops a jukebox and closes a container screen open on it, so the case #3767 handled for #3708 still holds Like the structure block, it needs the level's worldgen data, and before that is loaded it reports failed ## 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 `PlaceCommand.placeTemplate` (`server/commands/PlaceCommand.java:341`): `checkLoaded` from the position's chunk to the chunk of the position plus the template's size (`:365`), mirror, rotation and `setKnownShape(strict)` (`:366`), `BlockRotProcessor(integrity)` and `createRandom(seed)` below full integrity (`:368`), `placeInWorld(level, pos, pos, settings, createRandom(seed), 2 | (strict ? 816 : 0))` (`:371`) `StructureTemplate.placeInWorld` (`world/level/levelgen/structure/templatesystem/StructureTemplate.java:241`): the palette from `settings.getRandomPalette` (`:252`), `setBlock` with the caller's flags (`:279`), the shape pass when the shape is not known (`:345-368`), the entities (`:381`), true once the template has blocks (`:394`) `StructurePlaceSettings.getRandom` seeds from the position when no random is set (`world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java:112`) `StructureBlockEntity.placeStructure` builds the same settings (`world/level/block/entity/StructureBlockEntity.java:412-428`) ## Self-check The one failure is `a_swimming_passenger_sits_up_even_when_standing_does_not_fit` (`motion.rs`), it fails on `main` too with prepared data (since #4662) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +64 −119 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 486 passed (55 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 min 42 s) | | tests: horizon-client | ❌ 908 passed, 1 failed (2 min 47 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:14 +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#5960
No description provided.