[PR #1765] [MERGED] Lithostitched's processors as the game's own types; replace the old Lithostitched conversion #3748

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/1765
Author: @ludovic111
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: feat/lithostitched-processors


📝 Commits (10+)

  • 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
  • c43f4bd Lithostitched's processors as the game's own types; replace the old Lithostitched conversion
  • 58e184f Structure blocks harness: place the oracle's own pieces, split piece boxes from their surroundings
  • d89fb16 Structure blocks harness: CTOV's known differences
  • eb6c819 Lithostitched processors: unit tests rewritten from the spec
  • 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

📊 Changes

26 files changed (+2147 additions, -3415 deletions)

View changed files

📝 crates/horizon-port-pack/src/carry.rs (+3 -4)
📝 crates/horizon-port-pack/src/legacy_structure_mods/ctov.rs (+1 -0)
➖ crates/horizon-port-pack/src/legacy_structure_mods/lithostitched.rs (+0 -503)
📝 crates/horizon-port-pack/src/legacy_structure_mods/mod.rs (+2 -2)
➖ crates/horizon-port-pack/src/legacy_structure_mods/yung.rs (+0 -1055)
📝 crates/horizon-port-pack/src/lib.rs (+2 -0)
➕ crates/horizon-port-pack/src/lithostitched.rs (+434 -0)
📝 crates/horizon-port-pack/src/processors.rs (+12 -12)
📝 crates/horizon-port-pack/src/worldgen.rs (+14 -20)
➕ 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/processor.rs (+62 -39)
➕ crates/horizon-world/src/worldgen/structure/processor/litho.rs (+841 -0)
➖ crates/horizon-world/src/worldgen/structure/processor/lithostitched.rs (+0 -434)

...and 6 more files

📄 Description

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

Stacked on #1757 (base feat/structure-saved-starts), so on #1746 underneath. This is a clean-room implementation of spec-lithostitched §3–§5 and spec-ctov §4. It replaces the old Lithostitched conversion and CTOV's modular compat.

Game (horizon-world)

structure/processor/litho.rs reads Lithostitched's processors the way its data writes them:

Type What it does
block_swap Swaps a block and keeps only the properties the new block can have. In CTOV's farms, ripe wheat becomes ripe carrots, but beetroot, whose age stops at 3, keeps its default (spec-ctov §4 MUST).
reference Runs the lists it names.
apply_random Picks one list by weight, per block or per piece.
condition Supports else, and a single processor or a list in each branch.
set_block Simple and weighted providers, preserve_state, block_entity_modifier.
discard_input
Conditions all_of, any_of, not, random_chance, true, and matching_blocks (on the input or the location block, with properties).

How Lithostitched seeds its random is still open (OPEN-L6), so a stand-in is used: a positional random built from the world seed, the processor and the block's position (per block) or the piece's position (per piece). See IQ-7. Choice shares follow the weights, but the exact blocks chosen do not match Java's.

The old horizon:{block_swap,apply_random,condition,set_block} types are gone, and structure/processor/lithostitched.rs was deleted without being read.

Port (horizon-port-pack)

A new lithostitched module provides the same entry points as the module it replaces:

  • Processors are carried as written, and the processors nested inside them are carried too.
    • What the game can't read is dropped and counted as a Java processor: lists named by tag, and providers other than simple or weighted.
    • CTOV's modular_compat becomes a reference when its mod is ported along. Otherwise it is removed, which is a no-op, as in the mod.
  • lithostitched:jigsaw becomes vanilla's jigsaw. This keeps vanilla layouts, as decided for L5; docs/modpacks.md now says so.
  • limited, guaranteed and delegating elements place their delegate. Their limits are counted as lost until the next PR.
  • add_template_pool_elements becomes a horizon:add_to pool when its NeoForge load conditions pass.
  • Deleted unread: legacy_structure_mods/lithostitched.rs.
  • Blind edits in the legacy folder, located by exact text or by the compiler's error position:
    • removed its module line;
    • added #[allow(dead_code)] on mod ctov (its modular compat is unused now; its set entries go with C1) and on a test helper;
    • set #[ignore] on ctov's modular-compat test, which is superseded by this module's tests.

docs/modpacks.md: the Lithostitched processor paragraph is rewritten from this implementation.

Oracle counts (CTOV, tools/test_structure_blocks_parity.py --profile ctov, 3 seeds, 28 starts)

The harness places the oracle's own saved pieces, so these counts do not depend on layout.

Positions in piece boxes Old conversion This PR
all CTOV structures 2,213,119 / 2,251,716 (98.29 %) 2,195,966 / 2,251,716 (97.52 %)
ctov:pillager_outpost_plains 25,985 / 26,142 25,985 / 26,142
ctov:small/village_desert 288,711 / 288,958 286,633 / 288,958
ctov:small/village_plains 484,009 / 488,568 480,531 / 488,568

Where this PR does worse than the old conversion. The whole gap is random choices: dirt path, grass, cobblestone and mossy cobblestone on roads, and sandstone against smooth sandstone. 18,525 blocks were swapped inside these mixes, against 7,015 with the old conversion. The old conversion seems to have reproduced part of Lithostitched's seeding. I did not use it, and it can't be used in a clean room. L6 stays with the spec team. Their probe samples are in the oracle files.

What is left in both runs, now listed as KNOWN, is decoration: grass and trees where the village changed the terrain.

Spec questions recorded

impl-questions.md:

  • IQ-7: the stand-in random.
  • IQ-8: unknown blocks in block_swap and matching_blocks, lists named by tag, and providers.
  • IQ-9: the jigsaw mapping and the element unwrapping until the modifiers PR.

Self-check

python3 tools/pr_ready.py --quick (Mac mini, against origin/main, so its scope covers the whole stack):

  • rustfmt, clippy and tests all pass (horizon-port-pack and horizon-world: 290; launcher: 118).
  • Python tests: the same 2 environment errors as #1753, which do not come from this branch (java with an empty PATH, and macOS's /private/var).

New tests:

  • litho::tests, 4 tests: property-keeping swaps, conditions, draws per piece and per block, weighted set_block.
  • lithostitched::tests, 4 tests: jigsaw, elements, modifiers and conditions, and a CTOV-shaped list end to end through carry and upgrade.

This PR's diff is +1012/−1020. About 400 of those lines are tests, and 937 deletions are the two old modules. It stays one PR because the game and the port have to switch types together.

🤖 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/1765 **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/lithostitched-processors` --- ### 📝 Commits (10+) - [`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 - [`c43f4bd`](https://github.com/horizon-rust/horizon/commit/c43f4bdb2b649caab9e0eca68c1614e11724f33f) Lithostitched's processors as the game's own types; replace the old Lithostitched conversion - [`58e184f`](https://github.com/horizon-rust/horizon/commit/58e184f5d591f866f164be084173f22633416ebd) Structure blocks harness: place the oracle's own pieces, split piece boxes from their surroundings - [`d89fb16`](https://github.com/horizon-rust/horizon/commit/d89fb16f601c245c23d9ab2ba98323cec84cc084) Structure blocks harness: CTOV's known differences - [`eb6c819`](https://github.com/horizon-rust/horizon/commit/eb6c81945ad8b1d6acb2c5b9a089b0e7239a7092) Lithostitched processors: unit tests rewritten from the spec - [`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 ### 📊 Changes **26 files changed** (+2147 additions, -3415 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-port-pack/src/carry.rs` (+3 -4) 📝 `crates/horizon-port-pack/src/legacy_structure_mods/ctov.rs` (+1 -0) ➖ `crates/horizon-port-pack/src/legacy_structure_mods/lithostitched.rs` (+0 -503) 📝 `crates/horizon-port-pack/src/legacy_structure_mods/mod.rs` (+2 -2) ➖ `crates/horizon-port-pack/src/legacy_structure_mods/yung.rs` (+0 -1055) 📝 `crates/horizon-port-pack/src/lib.rs` (+2 -0) ➕ `crates/horizon-port-pack/src/lithostitched.rs` (+434 -0) 📝 `crates/horizon-port-pack/src/processors.rs` (+12 -12) 📝 `crates/horizon-port-pack/src/worldgen.rs` (+14 -20) ➕ `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/processor.rs` (+62 -39) ➕ `crates/horizon-world/src/worldgen/structure/processor/litho.rs` (+841 -0) ➖ `crates/horizon-world/src/worldgen/structure/processor/lithostitched.rs` (+0 -434) _...and 6 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1757 (base `feat/structure-saved-starts`), so on #1746 underneath. This is a clean-room implementation of spec-lithostitched §3–§5 and spec-ctov §4. It replaces the old Lithostitched conversion and CTOV's modular compat. ## Game (`horizon-world`) `structure/processor/litho.rs` reads Lithostitched's processors the way its data writes them: | Type | What it does | |---|---| | `block_swap` | Swaps a block and keeps only the properties the new block can have. In CTOV's farms, ripe wheat becomes ripe carrots, but beetroot, whose age stops at 3, keeps its default (spec-ctov §4 MUST). | | `reference` | Runs the lists it names. | | `apply_random` | Picks one list by weight, per block or per piece. | | `condition` | Supports `else`, and a single processor or a list in each branch. | | `set_block` | Simple and weighted providers, `preserve_state`, `block_entity_modifier`. | | `discard_input` | | | Conditions | `all_of`, `any_of`, `not`, `random_chance`, `true`, and `matching_blocks` (on the input or the location block, with properties). | How Lithostitched seeds its random is still open (OPEN-L6), so a stand-in is used: a positional random built from the world seed, the processor and the block's position (per block) or the piece's position (per piece). See IQ-7. Choice shares follow the weights, but the exact blocks chosen do not match Java's. The old `horizon:{block_swap,apply_random,condition,set_block}` types are gone, and `structure/processor/lithostitched.rs` was deleted without being read. ## Port (`horizon-port-pack`) A new `lithostitched` module provides the same entry points as the module it replaces: - **Processors** are carried as written, and the processors nested inside them are carried too. - What the game can't read is dropped and counted as a Java processor: lists named by tag, and providers other than simple or weighted. - CTOV's `modular_compat` becomes a `reference` when its mod is ported along. Otherwise it is removed, which is a no-op, as in the mod. - **`lithostitched:jigsaw`** becomes vanilla's jigsaw. This keeps vanilla layouts, as decided for L5; `docs/modpacks.md` now says so. - **`limited`, `guaranteed` and `delegating` elements** place their delegate. Their limits are counted as lost until the next PR. - **`add_template_pool_elements`** becomes a `horizon:add_to` pool when its NeoForge load conditions pass. - **Deleted unread:** `legacy_structure_mods/lithostitched.rs`. - **Blind edits in the legacy folder**, located by exact text or by the compiler's error position: - removed its module line; - added `#[allow(dead_code)]` on `mod ctov` (its modular compat is unused now; its set entries go with C1) and on a test helper; - set `#[ignore]` on ctov's modular-compat test, which is superseded by this module's tests. `docs/modpacks.md`: the Lithostitched processor paragraph is rewritten from this implementation. ## Oracle counts (CTOV, `tools/test_structure_blocks_parity.py --profile ctov`, 3 seeds, 28 starts) The harness places the oracle's own saved pieces, so these counts do not depend on layout. | Positions in piece boxes | Old conversion | This PR | |---|---|---| | all CTOV structures | 2,213,119 / 2,251,716 (98.29 %) | 2,195,966 / 2,251,716 (97.52 %) | | `ctov:pillager_outpost_plains` | 25,985 / 26,142 | 25,985 / 26,142 | | `ctov:small/village_desert` | 288,711 / 288,958 | 286,633 / 288,958 | | `ctov:small/village_plains` | 484,009 / 488,568 | 480,531 / 488,568 | **Where this PR does worse than the old conversion.** The whole gap is random choices: dirt path, grass, cobblestone and mossy cobblestone on roads, and sandstone against smooth sandstone. 18,525 blocks were swapped inside these mixes, against 7,015 with the old conversion. The old conversion seems to have reproduced part of Lithostitched's seeding. I did not use it, and it can't be used in a clean room. L6 stays with the spec team. Their probe samples are in the oracle files. **What is left in both runs**, now listed as `KNOWN`, is decoration: grass and trees where the village changed the terrain. ## Spec questions recorded `impl-questions.md`: - **IQ-7**: the stand-in random. - **IQ-8**: unknown blocks in `block_swap` and `matching_blocks`, lists named by tag, and providers. - **IQ-9**: the jigsaw mapping and the element unwrapping until the modifiers PR. ## Self-check `python3 tools/pr_ready.py --quick` (Mac mini, against origin/main, so its scope covers the whole stack): - rustfmt, clippy and tests all pass (horizon-port-pack and horizon-world: 290; launcher: 118). - Python tests: the same 2 environment errors as #1753, which do not come from this branch (`java` with an empty PATH, and macOS's `/private/var`). New tests: - `litho::tests`, 4 tests: property-keeping swaps, conditions, draws per piece and per block, weighted `set_block`. - `lithostitched::tests`, 4 tests: jigsaw, elements, modifiers and conditions, and a CTOV-shaped list end to end through carry and upgrade. This PR's diff is +1012/−1020. About 400 of those lines are tests, and 937 deletions are the two old modules. It stays one PR because the game and the port have to switch types together. 🤖 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#3748
No description provided.