[PR #4577] [MERGED] Data packs: a world's own biome table, and /locate finds its biomes #5704

Closed
opened 2026-11-03 05:14:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4577
Author: @masa-masa-0314
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feat/worldgen-pack-content


📝 Commits (10+)

  • a3dc4c7 Biomes: the palette holds a world's biomes too
  • d2145ac Commands: a world's packs complete and match their biomes and tags
  • 4885673 Data packs: the world's chunks and the game read one biome table
  • 6eada86 Data packs: one pack list builds the biomes, the worldgen and the commands
  • 34be912 Biomes: the table survives world switches, and tags nest
  • 69cc8ab Merge remote-tracking branch 'origin/main' into pr-4577
  • 9950e27 Fix packed_biomes call after merging main; restore world_worldgen_overrides's doc comment
  • 725a91b Data packs: pack tag overlays reach TagLoader's ids
  • c2af3b1 Merge main into #4577
  • 89fe9cf Merge main into #4577

📊 Changes

2 files changed (+57 additions, -2 deletions)

View changed files

📝 crates/horizon-items/src/items.rs (+4 -2)
📝 crates/horizon-world/src/loot.rs (+53 -0)

📄 Description

🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally.

What and why

A world whose data packs add world generation could not be opened, and once it could, /locate biome
still refused and never completed the packs' biomes. Three separate breaks:

  • Two pack lists. WorldgenOverrides (the generator) is built from datapack::discover with
    enabled_ids; the client's biome table was built from content_overlay, which reads
    datapacks.json — empty until a world writes it. So a pack's biomes never reached the table that
    WorldgenOverrides::finish tests against, it dropped each new biome ("biome X is new: Horizon
    cannot add biomes yet"), and the generator then failed on a material rule naming one:
    invalid world generation field: unknown material biome. The table and the worldgen now come from
    the same list (world_loading::packed_biomes).
  • Biomes::with_packs had no callers. The packed table (a pack's worldgen/biome files over the
    game's, as RegistryDataLoader layers registries) existed but nothing built it, so a packed biome
    resolved through Biomes::the builtin table and drew, spawned and saved as the fallback. It is
    built when a world opens and every biome lookup goes through it (world_biomes!, a field-level
    borrow for the loops that also take &mut self), and make_streaming hands the same table to the
    generator so the ids terrain names and the ids the client draws agree.
  • The commands read the resource root alone. /locate biome terralith:x failed at parse time
    ("Can't find element … of type 'minecraft:worldgen/biome'") because command-registries.json lists
    the game's own ids, and #tag matched only data/<ns>/tags/worldgen/biome on disk. The packs'
    biome/structure/set/pool/processor ids and their worldgen tag ids now join the completion
    registries from the same overrides the generator uses, and the tag lookup reads the pack stack with
    replace dropping the lower sources' entries (TagLoader.load).

The biome palette's global width also goes from 7 to 8 bits: vanilla's 67 fit, a pack of ~100 more
(Terralith) passes the 128 ceiling.

Vanilla reference

  • RegistryDataLoader / SimpleJsonResourceReloadListener for the file-over-packs layering of the
    biome registry.
  • TagLoader.load for the tag merge (replace drops the lower sources).
  • FeatureFlags is not involved here; the feature packs are untouched by this PR.

Self-check

rustfmt: pass
clippy -p horizon-client -p horizon-client-render --lib --bins -D warnings: pass
horizon-client lib: 789 passed, 1 failed
horizon-client-render lib: 496 passed
horizon-world lib: 181 passed

The one failure is title::tests::each_world_preset_writes_its_own_generator, which builds a
directory named after a preset id (minecraft:normal) — invalid on Windows; it fails on a clean
upstream/main checkout too and this change does not touch it.

Verified in a headless client with Terralith 2.6.5 as the world's only data pack:

/locate biome terralith:alpine_highlands
  -> The nearest terralith:alpine_highlands is at [545, 85, -574] (814 blocks away)
/locate biome #c:is_lush
  -> The nearest #c:is_lush (terralith:cave/underground_jungle) is at [1505, 21, 1442] (2106 blocks away)

Before the change the world did not open at all (unknown material biome).

Screenshots

None: the behaviour is command output and a world that opens, captured headlessly above.

🤖 Generated with ZCode


🔄 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/4577 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/worldgen-pack-content` --- ### 📝 Commits (10+) - [`a3dc4c7`](https://github.com/horizon-rust/horizon/commit/a3dc4c74abe425c47ed6a41336bcc61bda4d5a45) Biomes: the palette holds a world's biomes too - [`d2145ac`](https://github.com/horizon-rust/horizon/commit/d2145ac8205ad3b44e6cbc3d37002cf433d4bcd6) Commands: a world's packs complete and match their biomes and tags - [`4885673`](https://github.com/horizon-rust/horizon/commit/48856738b0d12ad9e283fc535eb3d702ba3816f1) Data packs: the world's chunks and the game read one biome table - [`6eada86`](https://github.com/horizon-rust/horizon/commit/6eada864b195708527f9445822568bb5d1f482f5) Data packs: one pack list builds the biomes, the worldgen and the commands - [`34be912`](https://github.com/horizon-rust/horizon/commit/34be9125df8c2e2a49d3ee9873c56e2bbeefb811) Biomes: the table survives world switches, and tags nest - [`69cc8ab`](https://github.com/horizon-rust/horizon/commit/69cc8ab35b302cec2bb1420814909a0804ea2bab) Merge remote-tracking branch 'origin/main' into pr-4577 - [`9950e27`](https://github.com/horizon-rust/horizon/commit/9950e27f87d7efd8f589be401a1be5b04c5fc76f) Fix packed_biomes call after merging main; restore world_worldgen_overrides's doc comment - [`725a91b`](https://github.com/horizon-rust/horizon/commit/725a91b23fd807382f75e7f84aee17ec18589ac1) Data packs: pack tag overlays reach TagLoader's ids - [`c2af3b1`](https://github.com/horizon-rust/horizon/commit/c2af3b13b9a24932e43447edaab0d34e2fd04adc) Merge main into #4577 - [`89fe9cf`](https://github.com/horizon-rust/horizon/commit/89fe9cfe0c7b9780184b2e8aea168f5038b4f187) Merge main into #4577 ### 📊 Changes **2 files changed** (+57 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-items/src/items.rs` (+4 -2) 📝 `crates/horizon-world/src/loot.rs` (+53 -0) </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What and why A world whose data packs add world generation could not be opened, and once it could, `/locate biome` still refused and never completed the packs' biomes. Three separate breaks: - **Two pack lists.** `WorldgenOverrides` (the generator) is built from `datapack::discover` with `enabled_ids`; the client's biome table was built from `content_overlay`, which reads `datapacks.json` — empty until a world writes it. So a pack's biomes never reached the table that `WorldgenOverrides::finish` tests against, it dropped each new biome ("biome X is new: Horizon cannot add biomes yet"), and the generator then failed on a material rule naming one: `invalid world generation field: unknown material biome`. The table and the worldgen now come from the same list (`world_loading::packed_biomes`). - **`Biomes::with_packs` had no callers.** The packed table (a pack's `worldgen/biome` files over the game's, as `RegistryDataLoader` layers registries) existed but nothing built it, so a packed biome resolved through `Biomes::the builtin table` and drew, spawned and saved as the fallback. It is built when a world opens and every biome lookup goes through it (`world_biomes!`, a field-level borrow for the loops that also take `&mut self`), and `make_streaming` hands the same table to the generator so the ids terrain names and the ids the client draws agree. - **The commands read the resource root alone.** `/locate biome terralith:x` failed at parse time ("Can't find element … of type 'minecraft:worldgen/biome'") because `command-registries.json` lists the game's own ids, and `#tag` matched only `data/<ns>/tags/worldgen/biome` on disk. The packs' biome/structure/set/pool/processor ids and their worldgen tag ids now join the completion registries from the same overrides the generator uses, and the tag lookup reads the pack stack with `replace` dropping the lower sources' entries (`TagLoader.load`). The biome palette's global width also goes from 7 to 8 bits: vanilla's 67 fit, a pack of ~100 more (Terralith) passes the 128 ceiling. ## Vanilla reference - `RegistryDataLoader` / `SimpleJsonResourceReloadListener` for the file-over-packs layering of the biome registry. - `TagLoader.load` for the tag merge (`replace` drops the lower sources). - `FeatureFlags` is not involved here; the feature packs are untouched by this PR. ## Self-check ``` rustfmt: pass clippy -p horizon-client -p horizon-client-render --lib --bins -D warnings: pass horizon-client lib: 789 passed, 1 failed horizon-client-render lib: 496 passed horizon-world lib: 181 passed ``` The one failure is `title::tests::each_world_preset_writes_its_own_generator`, which builds a directory named after a preset id (`minecraft:normal`) — invalid on Windows; it fails on a clean `upstream/main` checkout too and this change does not touch it. Verified in a headless client with Terralith 2.6.5 as the world's only data pack: ``` /locate biome terralith:alpine_highlands -> The nearest terralith:alpine_highlands is at [545, 85, -574] (814 blocks away) /locate biome #c:is_lush -> The nearest #c:is_lush (terralith:cave/underground_jungle) is at [1505, 21, 1442] (2106 blocks away) ``` Before the change the world did not open at all (`unknown material biome`). ## Screenshots None: the behaviour is command output and a world that opens, captured headlessly above. 🤖 Generated with ZCode --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:26 +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#5704
No description provided.