[PR #1757] [MERGED] Structure blocks harness: place the oracle's saved pieces; CTOV profile #3746

Closed
opened 2026-11-03 04:12:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/structure-saved-starts


📝 Commits (8)

  • 066f079 Merge remote-tracking branch 'origin/refactor/port-pack-legacy-structure-mods' into feat/yung-port-as-written
  • 379692f Port YUNG's worldgen as written; delete the old YUNG conversion and assembler
  • f80f4e0 Structure blocks harness: the blocks Horizon's structure mods place against the structure oracle's
  • 58e184f Structure blocks harness: place the oracle's own pieces, split piece boxes from their surroundings
  • 3bc38ce YUNG jigsaws: the start is not counted, priority, depth and bounds rules run
  • 35e047f Merge origin/main into feat/yung-port-as-written
  • 355df65 Merge feat/yung-port-as-written into feat/structure-blocks-harness
  • b4700c0 Merge feat/structure-blocks-harness into feat/structure-saved-starts

📊 Changes

19 files changed (+769 additions, -2400 deletions)

View changed files

📝 crates/horizon-port-pack/src/carry.rs (+0 -1)
📝 crates/horizon-port-pack/src/legacy_structure_mods/mod.rs (+0 -1)
➖ crates/horizon-port-pack/src/legacy_structure_mods/yung.rs (+0 -1055)
📝 crates/horizon-port-pack/src/lib.rs (+1 -0)
📝 crates/horizon-port-pack/src/processors.rs (+10 -9)
📝 crates/horizon-port-pack/src/worldgen.rs (+4 -3)
➕ crates/horizon-port-pack/src/yung.rs (+102 -0)
📝 crates/horizon-world/examples/probe/chunk_dump.rs (+16 -0)
📝 crates/horizon-world/src/worldgen/generator.rs (+33 -0)
📝 crates/horizon-world/src/worldgen/generator_structures.rs (+45 -1)
📝 crates/horizon-world/src/worldgen/structure.rs (+0 -1)
📝 crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs (+0 -1)
📝 crates/horizon-world/src/worldgen/structure/jigsaw.rs (+168 -65)
📝 crates/horizon-world/src/worldgen/structure/piece_limited.rs (+0 -1)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+27 -85)
➖ crates/horizon-world/src/worldgen/structure/yung.rs (+0 -1122)
📝 docs/mods.md (+3 -3)
➕ tools/test_structure_blocks_parity.py (+237 -0)
📝 tools/test_structure_layout_parity.py (+123 -52)

📄 Description

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

Stacked on #1753. Part of the clean-room structure-mods series.

Why

Lithostitched lays out every jigsaw structure its own way (spec-lithostitched OPEN-L5), and CTOV's villages go through it. Horizon keeps vanilla's layouts, so comparing generated blocks position by position would mostly measure layout, not the processors this series implements. With this PR, the mod world in tools/test_structure_blocks_parity.py uses the oracle's own saved pieces.

What changes

  • PoolPiece::from_saved (jigsaw.rs) builds a piece from a saved PoolElementStructurePiece tag in JSON: pool_element, position, rotation, ground_level_delta, BB, junctions, liquid_settings.
  • GeneratorWorker::use_saved_start (through generator_structures.rs) replaces the chunk's start of that structure with the saved one, until the starts are forgotten. StructureStart::new now holds the box computation that create_starts did inline.
  • chunk_dump: HORIZON_SAVED_STARTS=<file> lists the saved starts to place.
  • Harness:
    • starts whose pieces are all jigsaw pieces are placed as saved;
    • Lithostitched's wrapper elements place their delegate;
    • 1.21.1 block states are read in 26.3's shape;
    • counts are split between positions inside a piece box and around it (terrain adaptation, decoration);
    • every mismatch class is written to .local/structure-layout/<profile>/blocks-report.json;
    • new ctov profile, with the Lithostitched and CTOV jars taken from a pack's jar folder (.local/structure-oracle/pack-jars).

No game behaviour changes. The new API only replaces a start when a harness asks it to.

Oracle counts

Better Dungeons small dungeons (58 starts): 1,157,376 / 1,166,181 positions match with the saved pieces, against 1,157,337 when Horizon generates its own layout. The layouts are the same, which shows the injection is faithful.

CTOV, with the old Lithostitched conversion that this series replaces next (3 seeds, 28 starts):

Structure Starts In piece boxes Around them
ctov:small/village_plains 7 484,009 / 488,568 7,432,588 / 7,452,562
ctov:small/village_desert 3 288,711 / 288,958 3,414,584 / 3,423,912
ctov:medium/village_plains 3 383,364 / 388,950 5,440,798 / 5,460,687
ctov:medium/village_taiga 3 269,821 / 274,098 3,693,450 / 3,725,104
ctov:large/village_plains 3 335,549 / 339,662 4,726,526 / 4,736,651
ctov:large/village_savanna 3 212,496 / 219,097 4,344,370 / 4,372,223
ctov:pillager_outpost_plains 3 25,985 / 26,142 606,861 / 608,283
minecraft:village_plains (CTOV world) 3 213,184 / 226,241 5,104,566 / 5,137,490

The harness overlay now applies horizon:add_to files (the CTOV entries added to minecraft:villages) the same way the game's mod_content.rs does. A saved start replaces the starts of its structure sets in its chunk, since a set starts one structure per chunk. Without these two changes, a vanilla village stayed next to each injected CTOV village and added about 40,000 mismatches.

The CTOV profile has no KNOWN entries yet: the Lithostitched processors PR stacked on this one sets them from its own run.

Self-check

python3 tools/pr_ready.py --quick runs on the top of the stack (the Lithostitched PR). This PR adds +248/−42 lines.

🤖 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/1757 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/structure-saved-starts` --- ### 📝 Commits (8) - [`066f079`](https://github.com/horizon-rust/horizon/commit/066f07968bab4d557bbfc2c205dea38ee5978d0c) Merge remote-tracking branch 'origin/refactor/port-pack-legacy-structure-mods' into feat/yung-port-as-written - [`379692f`](https://github.com/horizon-rust/horizon/commit/379692f35545e149cc323f48966697b00a24fffa) Port YUNG's worldgen as written; delete the old YUNG conversion and assembler - [`f80f4e0`](https://github.com/horizon-rust/horizon/commit/f80f4e01e762a32a06eca5b5f6b8592b8c478cac) Structure blocks harness: the blocks Horizon's structure mods place against the structure oracle's - [`58e184f`](https://github.com/horizon-rust/horizon/commit/58e184f5d591f866f164be084173f22633416ebd) Structure blocks harness: place the oracle's own pieces, split piece boxes from their surroundings - [`3bc38ce`](https://github.com/horizon-rust/horizon/commit/3bc38cebb4aa90bb791f7e3244cf1c0767b625f8) YUNG jigsaws: the start is not counted, priority, depth and bounds rules run - [`35e047f`](https://github.com/horizon-rust/horizon/commit/35e047fb8ecc581cd71174b300f004a137956772) Merge origin/main into feat/yung-port-as-written - [`355df65`](https://github.com/horizon-rust/horizon/commit/355df65240f227988a7537877623e7db7f7c9ec2) Merge feat/yung-port-as-written into feat/structure-blocks-harness - [`b4700c0`](https://github.com/horizon-rust/horizon/commit/b4700c0a9d88ad5ad4765a7b7691c90f4d5a0b5b) Merge feat/structure-blocks-harness into feat/structure-saved-starts ### 📊 Changes **19 files changed** (+769 additions, -2400 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-port-pack/src/carry.rs` (+0 -1) 📝 `crates/horizon-port-pack/src/legacy_structure_mods/mod.rs` (+0 -1) ➖ `crates/horizon-port-pack/src/legacy_structure_mods/yung.rs` (+0 -1055) 📝 `crates/horizon-port-pack/src/lib.rs` (+1 -0) 📝 `crates/horizon-port-pack/src/processors.rs` (+10 -9) 📝 `crates/horizon-port-pack/src/worldgen.rs` (+4 -3) ➕ `crates/horizon-port-pack/src/yung.rs` (+102 -0) 📝 `crates/horizon-world/examples/probe/chunk_dump.rs` (+16 -0) 📝 `crates/horizon-world/src/worldgen/generator.rs` (+33 -0) 📝 `crates/horizon-world/src/worldgen/generator_structures.rs` (+45 -1) 📝 `crates/horizon-world/src/worldgen/structure.rs` (+0 -1) 📝 `crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs` (+0 -1) 📝 `crates/horizon-world/src/worldgen/structure/jigsaw.rs` (+168 -65) 📝 `crates/horizon-world/src/worldgen/structure/piece_limited.rs` (+0 -1) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+27 -85) ➖ `crates/horizon-world/src/worldgen/structure/yung.rs` (+0 -1122) 📝 `docs/mods.md` (+3 -3) ➕ `tools/test_structure_blocks_parity.py` (+237 -0) 📝 `tools/test_structure_layout_parity.py` (+123 -52) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1753. Part of the clean-room structure-mods series. ## Why Lithostitched lays out every jigsaw structure its own way (spec-lithostitched OPEN-L5), and CTOV's villages go through it. Horizon keeps vanilla's layouts, so comparing generated blocks position by position would mostly measure layout, not the processors this series implements. With this PR, the mod world in `tools/test_structure_blocks_parity.py` uses the oracle's own saved pieces. ## What changes - **`PoolPiece::from_saved`** (`jigsaw.rs`) builds a piece from a saved `PoolElementStructurePiece` tag in JSON: `pool_element`, position, rotation, `ground_level_delta`, `BB`, `junctions`, `liquid_settings`. - **`GeneratorWorker::use_saved_start`** (through `generator_structures.rs`) replaces the chunk's start of that structure with the saved one, until the starts are forgotten. `StructureStart::new` now holds the box computation that `create_starts` did inline. - **`chunk_dump`**: `HORIZON_SAVED_STARTS=<file>` lists the saved starts to place. - **Harness**: - starts whose pieces are all jigsaw pieces are placed as saved; - Lithostitched's wrapper elements place their `delegate`; - 1.21.1 block states are read in 26.3's shape; - counts are split between positions inside a piece box and around it (terrain adaptation, decoration); - every mismatch class is written to `.local/structure-layout/<profile>/blocks-report.json`; - new `ctov` profile, with the Lithostitched and CTOV jars taken from a pack's jar folder (`.local/structure-oracle/pack-jars`). No game behaviour changes. The new API only replaces a start when a harness asks it to. ## Oracle counts **Better Dungeons small dungeons** (58 starts): 1,157,376 / 1,166,181 positions match with the saved pieces, against 1,157,337 when Horizon generates its own layout. The layouts are the same, which shows the injection is faithful. **CTOV**, with the old Lithostitched conversion that this series replaces next (3 seeds, 28 starts): | Structure | Starts | In piece boxes | Around them | |---|---|---|---| | `ctov:small/village_plains` | 7 | 484,009 / 488,568 | 7,432,588 / 7,452,562 | | `ctov:small/village_desert` | 3 | 288,711 / 288,958 | 3,414,584 / 3,423,912 | | `ctov:medium/village_plains` | 3 | 383,364 / 388,950 | 5,440,798 / 5,460,687 | | `ctov:medium/village_taiga` | 3 | 269,821 / 274,098 | 3,693,450 / 3,725,104 | | `ctov:large/village_plains` | 3 | 335,549 / 339,662 | 4,726,526 / 4,736,651 | | `ctov:large/village_savanna` | 3 | 212,496 / 219,097 | 4,344,370 / 4,372,223 | | `ctov:pillager_outpost_plains` | 3 | 25,985 / 26,142 | 606,861 / 608,283 | | `minecraft:village_plains` (CTOV world) | 3 | 213,184 / 226,241 | 5,104,566 / 5,137,490 | The harness overlay now applies `horizon:add_to` files (the CTOV entries added to `minecraft:villages`) the same way the game's `mod_content.rs` does. A saved start replaces the starts of its structure sets in its chunk, since a set starts one structure per chunk. Without these two changes, a vanilla village stayed next to each injected CTOV village and added about 40,000 mismatches. The CTOV profile has no `KNOWN` entries yet: the Lithostitched processors PR stacked on this one sets them from its own run. ## Self-check `python3 tools/pr_ready.py --quick` runs on the top of the stack (the Lithostitched PR). This PR adds +248/−42 lines. 🤖 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-03 04:12:01 +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#3746
No description provided.