[PR #838] [MERGED] Structure templates read without a node cap, as vanilla does #2849

Closed
opened 2026-11-02 15:59:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/large-structure-templates


📝 Commits (1)

  • 5710661 Structure templates read without a node cap, as vanilla does

📊 Changes

3 files changed (+27 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/place.rs (+1 -7)
📝 crates/horizon-world/src/nbt.rs (+25 -0)
📝 crates/horizon-world/src/worldgen/structure.rs (+1 -5)

📄 Description

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

What

Structure templates (structure/*.nbt) are now read without a node cap, as vanilla does: TemplateSource.readStructure reads them with NbtAccounter.unlimitedHeap(). Horizon read them with the default limits (1,000,000 tags), so a bigger template failed to parse and loaded as an empty template. Its jigsaw anchor was then missing and the structure never started.

nbt::Limits::templates() keeps the 256 MiB cap on the decompressed file and drops the node cap. Worldgen (StructureResources::template) and /place template use it. List allocations are still bounded by the bytes left, so a hostile count cannot allocate past the file.

Measured (ATM10 8.3's carried mods, seed 1234, chunkgen_bench --starts, on the integration of #832 #833 and the YUNG's PRs)

  • Carried templates over 1M tags: 7 of 8,962. YUNG's Better Ocean Monuments' start piece (115×64×126 blocks, 3.65M tags), four When Dungeons Arise main pieces (2.8M to 8.1M tags), and two Nullscape End pieces.
  • Chunks -64..63: Better Ocean Monuments 0 → 3 starts (4,427 pieces). When Dungeons Arise 11 → 12 starts (334 → 411 pieces). All starts 361 → 365, pieces 17,290 → 21,794.
  • Chunks -256..255: Better Ocean Monuments 0 → 7 starts (10,242 pieces). When Dungeons Arise 173 → 175 starts.
  • Vanilla's templates are all under the cap, so vanilla worlds don't change.

Self-check

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-world --lib -- structure nbt: passed. New: templates_read_past_the_default_node_cap (1,000,001 tags: the default limits refuse it, Limits::templates() reads it back the same).
  • Vanilla structure-start oracle (seed 1234, chunks -24..23): 35 of 35 match.
  • Parity: all 304 harnesses that depend on the changed files pass on one integration of this agent's PRs (#832, #833, #838, #839, #840, #846, #847, #850, #851 merged onto origin/main at 845a122f): 298 run (298 passed, 0 failed in 82.4 min), 6 already passing for the same inputs. The vanilla structure-start oracle stays at 35/35.

Nothing needs Ludovic. The mod jars stayed in a local work folder.

🤖 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/838 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/large-structure-templates` --- ### 📝 Commits (1) - [`5710661`](https://github.com/horizon-rust/horizon/commit/571066158ede74d0d73c729d8a3745f880cc741e) Structure templates read without a node cap, as vanilla does ### 📊 Changes **3 files changed** (+27 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/place.rs` (+1 -7) 📝 `crates/horizon-world/src/nbt.rs` (+25 -0) 📝 `crates/horizon-world/src/worldgen/structure.rs` (+1 -5) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Structure templates (`structure/*.nbt`) are now read without a node cap, as vanilla does: `TemplateSource.readStructure` reads them with `NbtAccounter.unlimitedHeap()`. Horizon read them with the default limits (1,000,000 tags), so a bigger template failed to parse and loaded as an empty template. Its jigsaw anchor was then missing and the structure never started. `nbt::Limits::templates()` keeps the 256 MiB cap on the decompressed file and drops the node cap. Worldgen (`StructureResources::template`) and `/place template` use it. List allocations are still bounded by the bytes left, so a hostile count cannot allocate past the file. ## Measured (ATM10 8.3's carried mods, seed 1234, `chunkgen_bench --starts`, on the integration of #832 #833 and the YUNG's PRs) - Carried templates over 1M tags: 7 of 8,962. YUNG's Better Ocean Monuments' start piece (115×64×126 blocks, 3.65M tags), four When Dungeons Arise main pieces (2.8M to 8.1M tags), and two Nullscape End pieces. - Chunks -64..63: Better Ocean Monuments 0 → 3 starts (4,427 pieces). When Dungeons Arise 11 → 12 starts (334 → 411 pieces). All starts 361 → 365, pieces 17,290 → 21,794. - Chunks -256..255: Better Ocean Monuments 0 → 7 starts (10,242 pieces). When Dungeons Arise 173 → 175 starts. - Vanilla's templates are all under the cap, so vanilla worlds don't change. ## Self-check - `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-world --lib -- structure nbt`: passed. New: `templates_read_past_the_default_node_cap` (1,000,001 tags: the default limits refuse it, `Limits::templates()` reads it back the same). - Vanilla structure-start oracle (seed 1234, chunks -24..23): 35 of 35 match. - Parity: all 304 harnesses that depend on the changed files pass on one integration of this agent's PRs (#832, #833, #838, #839, #840, #846, #847, #850, #851 merged onto origin/main at 845a122f): 298 run (298 passed, 0 failed in 82.4 min), 6 already passing for the same inputs. The vanilla structure-start oracle stays at 35/35. Nothing needs Ludovic. The mod jars stayed in a local work folder. 🤖 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 15:59:33 +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#2849
No description provided.