[PR #988] [MERGED] Generate Formations' structures from the noise column #2968

Closed
opened 2026-11-02 16:00:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/simple-template-structures


📝 Commits (1)

  • a6b183f Generate Formations' structures from the noise column

📊 Changes

8 files changed (+441 additions, -1 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/generator.rs (+27 -0)
📝 crates/horizon-world/src/worldgen/structure.rs (+1 -0)
📝 crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs (+1 -0)
➕ crates/horizon-world/src/worldgen/structure/formations.rs (+340 -0)
📝 crates/horizon-world/src/worldgen/structure/jigsaw.rs (+14 -1)
📝 crates/horizon-world/src/worldgen/structure/piece_limited.rs (+1 -0)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+56 -0)
📝 crates/horizon-world/src/worldgen/structure/yung.rs (+1 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

Formations (Overworld and Nether, SuperMartijn642's structure library) places each structure with Java code that reads the noise column (ChunkGenerator.getBaseColumn) under the template's corners and centre. This PR adds that to the structure context and the structure type that uses it:

  • The context hook: StartContext::noise_column(x, z) -> NoiseColumn, the getBaseColumn blocks as structures test them (NoiseBlock::{Air, Water, Lava, Solid, Other}, from the noise's minimum Y, air past its ends, as NoiseColumn.getBlock). The generator fills it in one noise-column pass (Pipeline::noise_blocks). Solid is blocksMotion, which is BlockState.isSolid for every block the noise makes (no cobwebs or bamboo saplings there).
  • horizon:formations (crates/horizon-world/src/worldgen/structure/formations.rs): Formations' SimpleStructure.findGenerationPoint — a template from the pool, x/z in the chunk, rotation, then the placement's height (all from the structure random, in the mod's order), the start at height - ground_level + 1, one rigid pool piece with waterlogging. All nine StructurePlacements: surface, ceiling, on_water, on_lava, underground, underground_surface, underground_ceiling, underground_buried, underground_on_lava (bounds, loop counts, Math.round of the mean and the max/mean offset limits as in its code).
  • Ground level: PoolElement::Single takes horizon:ground_level (1 by default, vanilla's getGroundLevelDelta), which Formations' elements set (1..9); the beardifier already reads the piece's delta.

Formations' pieced structure (one, formations:pieced) stays out, and its processors (biome replacements, ...) are still dropped: next steps.

Why

modpacks-10 brief, task 3: 50 of Formations' 51 structures and its 128 pool elements could not generate (179 types unsupported). Decompiled (dev-only, local) only structure/ of the library to read the placement contract.

How tested

cargo fmt --all -- --check                                          ok
cargo clippy --workspace --all-targets -- -D warnings                ok (integration commit, below)
cargo test -p horizon-world                                           ok (formations::tests: Math.round, corner order, placement names)

With the carry PR (#989), ATM10's 42 mods, chunks -64..63 (chunkgen_bench --starts):

seed dimension starts before after Formations
1234 Overworld 371 410 39
1234 Nether 484 1,156 672
2 Overworld 438 489 51
2 Nether 515 1,158 643

Every other start is unchanged (after minus Formations = before). Spot check of 14 Nether starts against the terrain (chunk_dump without Formations): the cave ones stand on netherrack/nylium/soul soil under air, the flaming pillars on the lava sea at y 31, the buried sphere cages in netherrack. Formations' sets have spacing 5, so the Nether ones are dense by design (ore shards 245, sphere cages 184 at seed 1234).

Vanilla structure-start oracle on the integration commit (this PR + #969, #974, #975, #981-#984, #989): 150 of 150 vanilla starts match at seed 1234 and 134 of 134 at seed 2 (chunks -64..63). Game-side harnesses: results added when the run on that commit finishes.

Needs Ludovic

Nothing.

Integration run (game-side PRs together)

One commit merging this PR with #969, #974, #975, #981, #982, #983, #984, #988, #989 on main 0af3dd39:

cargo fmt --all -- --check                                                      ok
cargo clippy --workspace --all-targets -- -D warnings                           ok
cargo test -p horizon-world -p horizon-port-pack -p horizon-mods -p horizon-client   ok (0 failed)
tools/parity.py --changed origin/main                                           301 passed, 0 failed in 207.2 min (mob_ai and command_exec included)
vanilla structure-start oracle, chunks -64..63                                  150/150 (seed 1234), 134/134 (seed 2)

(#969's first CI parity run failed command_exec on /random reset * (11 vs 12 sequences); its rerun passed 780/780, so that was a flake. The rerun's mob_ai failure was its Java oracle crashing under load; mob_ai passes on the integration commit.)

🤖 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/988 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/simple-template-structures` --- ### 📝 Commits (1) - [`a6b183f`](https://github.com/horizon-rust/horizon/commit/a6b183f7f5adf7831b602c7e94938ba0dd6a1c2a) Generate Formations' structures from the noise column ### 📊 Changes **8 files changed** (+441 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/generator.rs` (+27 -0) 📝 `crates/horizon-world/src/worldgen/structure.rs` (+1 -0) 📝 `crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs` (+1 -0) ➕ `crates/horizon-world/src/worldgen/structure/formations.rs` (+340 -0) 📝 `crates/horizon-world/src/worldgen/structure/jigsaw.rs` (+14 -1) 📝 `crates/horizon-world/src/worldgen/structure/piece_limited.rs` (+1 -0) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+56 -0) 📝 `crates/horizon-world/src/worldgen/structure/yung.rs` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Formations (Overworld and Nether, SuperMartijn642's structure library) places each structure with Java code that reads the **noise column** (ChunkGenerator.getBaseColumn) under the template's corners and centre. This PR adds that to the structure context and the structure type that uses it: - **The context hook:** `StartContext::noise_column(x, z) -> NoiseColumn`, the getBaseColumn blocks as structures test them (`NoiseBlock::{Air, Water, Lava, Solid, Other}`, from the noise's minimum Y, air past its ends, as NoiseColumn.getBlock). The generator fills it in one noise-column pass (`Pipeline::noise_blocks`). `Solid` is blocksMotion, which is BlockState.isSolid for every block the noise makes (no cobwebs or bamboo saplings there). - **`horizon:formations`** (`crates/horizon-world/src/worldgen/structure/formations.rs`): Formations' `SimpleStructure.findGenerationPoint` — a template from the pool, `x`/`z` in the chunk, rotation, then the placement's height (all from the structure random, in the mod's order), the start at `height - ground_level + 1`, one rigid pool piece with waterlogging. All nine `StructurePlacement`s: `surface`, `ceiling`, `on_water`, `on_lava`, `underground`, `underground_surface`, `underground_ceiling`, `underground_buried`, `underground_on_lava` (bounds, loop counts, `Math.round` of the mean and the max/mean offset limits as in its code). - **Ground level:** `PoolElement::Single` takes `horizon:ground_level` (1 by default, vanilla's getGroundLevelDelta), which Formations' elements set (1..9); the beardifier already reads the piece's delta. Formations' pieced structure (one, `formations:pieced`) stays out, and its processors (biome replacements, ...) are still dropped: next steps. ## Why modpacks-10 brief, task 3: 50 of Formations' 51 structures and its 128 pool elements could not generate (179 types unsupported). Decompiled (dev-only, local) only `structure/` of the library to read the placement contract. ## How tested ``` cargo fmt --all -- --check ok cargo clippy --workspace --all-targets -- -D warnings ok (integration commit, below) cargo test -p horizon-world ok (formations::tests: Math.round, corner order, placement names) ``` With the carry PR (#989), ATM10's 42 mods, chunks -64..63 (`chunkgen_bench --starts`): | seed | dimension | starts before | after | Formations | | --- | --- | --- | --- | --- | | 1234 | Overworld | 371 | 410 | 39 | | 1234 | Nether | 484 | 1,156 | 672 | | 2 | Overworld | 438 | 489 | 51 | | 2 | Nether | 515 | 1,158 | 643 | Every other start is unchanged (after minus Formations = before). Spot check of 14 Nether starts against the terrain (`chunk_dump` without Formations): the cave ones stand on netherrack/nylium/soul soil under air, the flaming pillars on the lava sea at y 31, the buried sphere cages in netherrack. Formations' sets have spacing 5, so the Nether ones are dense by design (ore shards 245, sphere cages 184 at seed 1234). Vanilla structure-start oracle on the integration commit (this PR + #969, #974, #975, #981-#984, #989): **150 of 150** vanilla starts match at seed 1234 and **134 of 134** at seed 2 (chunks -64..63). Game-side harnesses: results added when the run on that commit finishes. ## Needs Ludovic Nothing. ## Integration run (game-side PRs together) One commit merging this PR with #969, #974, #975, #981, #982, #983, #984, #988, #989 on main 0af3dd39: ``` cargo fmt --all -- --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-world -p horizon-port-pack -p horizon-mods -p horizon-client ok (0 failed) tools/parity.py --changed origin/main 301 passed, 0 failed in 207.2 min (mob_ai and command_exec included) vanilla structure-start oracle, chunks -64..63 150/150 (seed 1234), 134/134 (seed 2) ``` (#969's first CI parity run failed command_exec on `/random reset *` (11 vs 12 sequences); its rerun passed 780/780, so that was a flake. The rerun's mob_ai failure was its Java oracle crashing under load; mob_ai passes on the integration commit.) 🤖 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-02 16:00:29 +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#2968
No description provided.