[PR #7546] A dimension_origin structure set places its start in the generator's origin chunk #7661

Open
opened 2026-11-03 07:21:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7546
Author: @MSedgeMC
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/dimension-origin


📝 Commits (3)

  • 24dcd97 fix: a dimension_origin structure set places its start in the generator's origin chunk
  • 9d7aca5 test: the dimension origin chunk, and the checks it skips
  • 053b231 port_map: the dimension_origin row says where the placement now is

📊 Changes

4 files changed (+139 additions, -12 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/generator.rs (+31 -11)
📝 crates/horizon-world/src/worldgen/generator_structures.rs (+9 -0)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+97 -0)
📝 tools/port_map/classes-07.tsv (+2 -1)

📄 Description

StructurePlacements registers three placement codecs — concentric_rings, dimension_origin, random_spread — and Horizon decoded two of them. A set whose placement is minecraft:dimension_origin fell through to Placement::Unsupported, so it placed no start in any chunk.

Vanilla

net.minecraft.world.level.levelgen.structure.placement.StructurePlacements, static init:

 1: ldc           #1   // String concentric_rings
 6: invokestatic  #9   // Registry.register
11: ldc           #15  // String dimension_origin
13: getstatic     #17  // Field DimensionOriginStructurePlacement.CODEC
16: invokestatic  #9   // Registry.register
21: ldc           #20  // String random_spread

DimensionOriginStructurePlacement.isStructureChunk(ChunkGeneratorStructureState, int, int):

 0: aload_1
 1: invokevirtual #7   // ChunkGeneratorStructureState.getDimensionOrigin:()Lnet/minecraft/world/level/ChunkPos;
 4: astore        4
 6: aload         4
 8: invokevirtual #13  // ChunkPos.x:()I
11: iload_2
12: if_icmpne     28
15: aload         4
17: invokevirtual #19  // ChunkPos.z:()I
20: iload_3
21: if_icmpne     28
24: iconst_1
25: goto          29
28: iconst_0
29: ireturn

One chunk: the dimension origin. ChunkGeneratorStructureState.getDimensionOrigin returns the state's origin field, which ChunkGenerator.createState passes from getOrigin(RandomState):

  • ChunkGenerator.getOrigin returns ChunkPos.ZERO.
  • NoiseBasedChunkGenerator.getOrigin returns ChunkPos.containing(NoiseSpawnFinder.findSpawnPosition(settings.spawnTarget(), samplers)), and ZERO when spawnTarget() is empty.

The type implements StructurePlacement directly, not AbstractSpreadingStructurePlacement. The frequency reduction (applyAdditionalChunkRestrictions) and the exclusion zone (applyInteractionsWithOtherStructures) are called from AbstractSpreadingStructurePlacement.isStructureChunk only, so neither runs for it; its codec is MapCodec.unit(INSTANCE), with no salt, spacing, frequency or exclusion zone field.

What Horizon got wrong

StructureRegistry::new (crates/horizon-world/src/worldgen/structure/start.rs) mapped minecraft:random_spread and minecraft:concentric_rings and sent every other type to Placement::Unsupported, which StructureRegistry::structure_chunk answers false for: the set placed nothing, in any chunk.

Now minecraft:dimension_origin decodes to Placement::DimensionOrigin; structure_chunk answers the origin chunk before the spreading placements' rings, distance, avoid, frequency and exclusion checks; and ChunkGenerator.getOrigin reaches the registry through StructureRegistry::set_dimension_origin. Pipeline::new fills it from the pipeline's cached spawn column (the NoiseSpawnFinder position), computing that search only when a set actually reads the origin, so worlds without such a set pay nothing.

Proven

cargo test -p horizon-world --lib dimension_origin:

  • dimension_origin_places_the_generators_origin_chunk_alone: with the type decoded as unsupported, is_structure_chunk(set, 0, 0, 0) is false — the test panics on the origin chunk holds the start. With the fix it is true, is false at (1, 0) and (0, -1), and moves with set_dimension_origin(ChunkPos::new(-37, 12)) to (-37, 12) and nowhere beside it.
  • dimension_origin_ignores_a_frequency_and_an_exclusion_zone: with the type unsupported, is_structure_chunk(set, 0, 2, 2) is false even with the origin set to (2, 2). With the fix it is true although the set carries frequency: 0.0 and an exclusion_zone whose other set (spacing 1, separation 0) spreads over every chunk, so a spreading placement would lose that chunk twice.

cargo test -p horizon-world passes (lib, integration tests, doctests); cargo clippy -q -p horizon-world --lib prints nothing; rustfmt --edition 2024 --check is clean.

Not proven

  • The ledger map-check of the changed tools/port_map/classes-07.tsv rows: the VM was unreachable when this was written. VM queue, CI will run it.
  • No world in this repository ships a structure set with minecraft:dimension_origin (the row this replaces said the same), so the effect is shown by the unit tests rather than by a generated world.
  • /locate: ChunkGenerator.getNearestGeneratedStructure enumerates candidates only for RandomSpreadStructurePlacement and ConcentricRingsStructurePlacement, so vanilla does not locate a dimension-origin structure either; nothing changed there.

🔄 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/7546 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/dimension-origin` --- ### 📝 Commits (3) - [`24dcd97`](https://github.com/horizon-rust/horizon/commit/24dcd971299a4534459b249ea0847f73060d449e) fix: a dimension_origin structure set places its start in the generator's origin chunk - [`9d7aca5`](https://github.com/horizon-rust/horizon/commit/9d7aca5ad685965c45086432f94ca0414b1c345c) test: the dimension origin chunk, and the checks it skips - [`053b231`](https://github.com/horizon-rust/horizon/commit/053b23101c02bfe818363ca0d0c4a1bb167fa816) port_map: the dimension_origin row says where the placement now is ### 📊 Changes **4 files changed** (+139 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/generator.rs` (+31 -11) 📝 `crates/horizon-world/src/worldgen/generator_structures.rs` (+9 -0) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+97 -0) 📝 `tools/port_map/classes-07.tsv` (+2 -1) </details> ### 📄 Description `StructurePlacements` registers three placement codecs — `concentric_rings`, `dimension_origin`, `random_spread` — and Horizon decoded two of them. A set whose placement is `minecraft:dimension_origin` fell through to `Placement::Unsupported`, so it placed no start in any chunk. ## Vanilla `net.minecraft.world.level.levelgen.structure.placement.StructurePlacements`, static init: ``` 1: ldc #1 // String concentric_rings 6: invokestatic #9 // Registry.register 11: ldc #15 // String dimension_origin 13: getstatic #17 // Field DimensionOriginStructurePlacement.CODEC 16: invokestatic #9 // Registry.register 21: ldc #20 // String random_spread ``` `DimensionOriginStructurePlacement.isStructureChunk(ChunkGeneratorStructureState, int, int)`: ``` 0: aload_1 1: invokevirtual #7 // ChunkGeneratorStructureState.getDimensionOrigin:()Lnet/minecraft/world/level/ChunkPos; 4: astore 4 6: aload 4 8: invokevirtual #13 // ChunkPos.x:()I 11: iload_2 12: if_icmpne 28 15: aload 4 17: invokevirtual #19 // ChunkPos.z:()I 20: iload_3 21: if_icmpne 28 24: iconst_1 25: goto 29 28: iconst_0 29: ireturn ``` One chunk: the dimension origin. `ChunkGeneratorStructureState.getDimensionOrigin` returns the state's `origin` field, which `ChunkGenerator.createState` passes from `getOrigin(RandomState)`: - `ChunkGenerator.getOrigin` returns `ChunkPos.ZERO`. - `NoiseBasedChunkGenerator.getOrigin` returns `ChunkPos.containing(NoiseSpawnFinder.findSpawnPosition(settings.spawnTarget(), samplers))`, and ZERO when `spawnTarget()` is empty. The type implements `StructurePlacement` directly, not `AbstractSpreadingStructurePlacement`. The frequency reduction (`applyAdditionalChunkRestrictions`) and the exclusion zone (`applyInteractionsWithOtherStructures`) are called from `AbstractSpreadingStructurePlacement.isStructureChunk` only, so neither runs for it; its codec is `MapCodec.unit(INSTANCE)`, with no salt, spacing, frequency or exclusion zone field. ## What Horizon got wrong `StructureRegistry::new` (`crates/horizon-world/src/worldgen/structure/start.rs`) mapped `minecraft:random_spread` and `minecraft:concentric_rings` and sent every other type to `Placement::Unsupported`, which `StructureRegistry::structure_chunk` answers `false` for: the set placed nothing, in any chunk. Now `minecraft:dimension_origin` decodes to `Placement::DimensionOrigin`; `structure_chunk` answers the origin chunk before the spreading placements' rings, distance, avoid, frequency and exclusion checks; and `ChunkGenerator.getOrigin` reaches the registry through `StructureRegistry::set_dimension_origin`. `Pipeline::new` fills it from the pipeline's cached spawn column (the NoiseSpawnFinder position), computing that search only when a set actually reads the origin, so worlds without such a set pay nothing. ## Proven `cargo test -p horizon-world --lib dimension_origin`: - `dimension_origin_places_the_generators_origin_chunk_alone`: with the type decoded as unsupported, `is_structure_chunk(set, 0, 0, 0)` is `false` — the test panics on `the origin chunk holds the start`. With the fix it is `true`, is `false` at `(1, 0)` and `(0, -1)`, and moves with `set_dimension_origin(ChunkPos::new(-37, 12))` to `(-37, 12)` and nowhere beside it. - `dimension_origin_ignores_a_frequency_and_an_exclusion_zone`: with the type unsupported, `is_structure_chunk(set, 0, 2, 2)` is `false` even with the origin set to `(2, 2)`. With the fix it is `true` although the set carries `frequency: 0.0` and an `exclusion_zone` whose other set (spacing 1, separation 0) spreads over every chunk, so a spreading placement would lose that chunk twice. `cargo test -p horizon-world` passes (lib, integration tests, doctests); `cargo clippy -q -p horizon-world --lib` prints nothing; `rustfmt --edition 2024 --check` is clean. ## Not proven - The ledger map-check of the changed `tools/port_map/classes-07.tsv` rows: the VM was unreachable when this was written. VM queue, CI will run it. - No world in this repository ships a structure set with `minecraft:dimension_origin` (the row this replaces said the same), so the effect is shown by the unit tests rather than by a generated world. - `/locate`: `ChunkGenerator.getNearestGeneratedStructure` enumerates candidates only for `RandomSpreadStructurePlacement` and `ConcentricRingsStructurePlacement`, so vanilla does not locate a dimension-origin structure either; nothing changed there. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7661
No description provided.