[PR #3904] [CLOSED] Data packs: a world's biomes reach the client, /locate and the tags #5282

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3904
Author: @masa-masa-0314
Created: 10/29/2026
Status: ❌ Closed

Base: main ← Head: fix/datapack-worldgen-pack-overlay


📝 Commits (10+)

  • e72a8c5 Data packs: load the world's packs into the content tables
  • 6e2ac25 Re-trigger the pull request checks (no run arrived for the head commit)
  • 845dbae Fix a recursive fallback in the world content tables' accessors
  • 75723d3 Data packs: load the world's packs into the registry tables
  • 74341d6 Data packs: load the world's packs' structures
  • de76987 Create New World: the Experiments and Data Packs screens
  • 19c08cb Data packs: load the world's packs' worldgen registries
  • 5e66de9 Create New World: the data packs' temporary folder, drops and vanilla layout
  • 7a14c35 Data packs: key a tag file by its folder, not by its last path part
  • ebfcf2b Data packs: a world's level stems come from the pack's dimension registry

📊 Changes

156 files changed (+3316 additions, -841 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client-render/src/assets.rs (+3 -1)
📝 crates/horizon-client-render/src/biome.rs (+89 -51)
📝 crates/horizon-client-render/src/brewing.rs (+35 -16)
📝 crates/horizon-client-render/src/chunk.rs (+4 -3)
📝 crates/horizon-client-render/src/datapack.rs (+90 -1)
📝 crates/horizon-client-render/src/pack_screen.rs (+11 -2)
📝 crates/horizon-client/examples/chunk_load_bench.rs (+8 -1)
📝 crates/horizon-client/examples/mod_port_probe.rs (+4 -3)
📝 crates/horizon-client/examples/probe/block_entity_anim_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/block_entity_render_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/block_transform_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/cauldron_fixture.rs (+4 -3)
📝 crates/horizon-client/examples/probe/creative_mining_probe.rs (+2 -1)
📝 crates/horizon-client/examples/probe/enchanting_fixture.rs (+3 -2)
📝 crates/horizon-client/examples/probe/entity_death_loot_fixture.rs (+2 -2)
📝 crates/horizon-client/examples/probe/finalize_spawn_fixture.rs (+3 -2)
📝 crates/horizon-client/examples/probe/firework_tooltip_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/ghost_recipe_fixture.rs (+4 -3)
📝 crates/horizon-client/examples/probe/hotbar_fixture.rs (+5 -1)

...and 80 more files

📄 Description

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

What and why

A world's data packs can already add worldgen registries; this branch makes the client and the
commands see the same biomes the generator does.

  • The packs' biomes reach the client's table. Biomes::load read only
    data/minecraft/worldgen/biome from the resource root, so a packed biome had no colours,
    precipitation or spawns, and Biomes::id (which VanillaTerrain uses to translate the
    generator's biome ids) fell back to plains — every packed biome rendered and saved as plains.
    Biomes::load_over merges the packs' worldgen/biome/<id>.json over the game's by id.
    WorldTables carries that table and Game::biomes() hands it out; make_streaming builds the
    same one for the generator, so both sides resolve one table.
  • /locate biome accepts and completes the packs' biomes and tags. A packed biome id was
    rejected at parse time ("Can't find element … of type 'minecraft:worldgen/biome'") because
    command-registries.json lists only the game's own ids; the packs' worldgen/biome ids and
    their tags/worldgen/biome ids now join the completion registries beside the structures.
  • Biome tags read the pack stack. The tag lookup behind #tag matched only the resource
    root's files, keyed a pack's file as tags/<registry>/minecraft:<tag> (missing every other
    namespace), and took only the top pack's file. It now reads the whole stack in order with
    replace dropping lower sources (TagLoader.load), which fixes structure tags too.
  • The biome palette widens to 8 bits. Vanilla's 67 fit in 7; Terralith's ~100 more pass the
    128 ceiling.
  • Earlier commits on this branch fix the data pack function system: function lines run at
    permission level 2 (MinecraftServer.createCommandSourceStack), the minecraft:load tag writes
    after the world's saved data is loaded, #minecraft:tick runs before the levels' entity ticks
    (MinecraftServer.tickChildren), a fresh drop keeps Age: 0 for that tick
    (EntityTickList.ensureActiveIsNotIterated), and type_specific/player matches players only and
    honours input (InputPredicate, input.sneak = Input.shift()).

This branch is stacked on #3300 (which is stacked on a registry-overlay branch): the commits up to
ebfcf2b57 are that earlier work and are not new here. The commits this PR asks review for are
70294a3b3, e2be56d06 and 62579dda4.

Vanilla reference

  • net.minecraft.client.resources.model.*'s SimpleJsonResourceReloadListener layering for the
    biome JSON overlay; Biome's colour accessors for the fields read.
  • NbtPathArgument, CommandStorage, ServerFunctionManager.getGameLoopSender (permission level
    2 + suppressed output), MinecraftServer.tickChildren, EntityTickList.ensureActiveIsNotIterated,
    ItemEntity.tick, advancements.predicates.InputPredicate and entity.PlayerPredicate for the
    function/predicate behaviour.
  • TagLoader.load for the tag merge (replace drops lower sources).

Self-check

rustfmt: pass
clippy -p horizon-client -p horizon-client-render -p horizon-world --all-targets -D warnings: pass
horizon-client lib: 626 passed
horizon-client-render lib: 496 passed
horizon-world lib: 181 passed

tools/pr_ready.py: rustfmt and clippy pass; the Python suite reports one failure,
tests/test_port_publish.py::test_body_has_names_and_signatures_only, which compares a doc path
containing ~/code/... against the Windows path the tool prints (~\code\...) — a platform
path-separator issue in the test, not touched here.

Verified in a headless client with Terralith 2.6.5 as the world's data pack: /locate biome terralith:cave/underground_jungle finds it at [1473, 5, 1415], /locate biome terralith:alpine_highlands at [545, 69, -569], /locate biome #c:is_lush reports
terralith:cave/underground_jungle, and a Vein Miner pack's tick-driven chain mining still works.

Screenshots

Not available: this machine's offscreen renderer draws a blank window, so no in-game capture was
taken. The change is verified through the headless client's command output above.

🤖 Generated with ZCode

Create New World, the data pack screen and the feature packs

The Create World flow now does what vanilla's screens do around it:

  • Preparing step. WorldOpenFlows/CreateWorldScreen.openCreateWorldScreen queues a
    GenericMessageScreen with createWorld.preparing and loads the world generation context
    before the create screen opens. Horizon opened the screen at once and read the generator data
    only when the world did. The Create New World button now shows that message (centred, in its
    12-pixel black box) while Game reads the generator data on a worker, and the screen opens when
    it is done — so pressing Create does not read it again. Changing the data packs re-runs it
    (CreateWorldScreen's second queueLoadScreen), keeping what the player typed.
  • Dropped packs ask first. PackSelectionScreen.onFilesDrop shows a ConfirmScreen
    (pack.dropConfirm as its title, the file names as its message) and only then detects which
    entries are packs, copies those and lists the rest in an AlertScreen
    (pack.dropRejected.title/.message). The dialog is a screen of its own — menu background,
    centred layout, 150-wide buttons — and No/Escape dismisses it.
  • A feature pack is one whose pack.mcmeta declares features.
    FeatureFlags.isExperimental tests the flags a pack asks for, and ServerPacksSource takes
    every folder under data/minecraft/datapacks. Both the Experiments screen and the create
    screen's default disabled set used to name minecart_improvements,
    redstone_experiments and trade_rebalance or guess from the id; they read the pack's own
    flags now, so a pack a later version ships is picked up and a world pack with a plain id is
    not mistaken for one.

Self-check for these commits:

rustfmt: pass
clippy -p horizon-client -p horizon-client-render --lib --bins -D warnings: pass
horizon-client lib: 626 passed
horizon-client-render lib: 496 passed
horizon-world lib: 181 passed

Still open, on its own branch: the flags themselves (minecart speed, the redstone rules, the
rebalanced trades) change nothing yet, and a world does not record its enabled_features.


🔄 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/3904 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/datapack-worldgen-pack-overlay` --- ### 📝 Commits (10+) - [`e72a8c5`](https://github.com/horizon-rust/horizon/commit/e72a8c5c6eae96b20ca290f342331d008fff2931) Data packs: load the world's packs into the content tables - [`6e2ac25`](https://github.com/horizon-rust/horizon/commit/6e2ac2522d75f7c44e289008d4accec7d5e8ee4f) Re-trigger the pull request checks (no run arrived for the head commit) - [`845dbae`](https://github.com/horizon-rust/horizon/commit/845dbae91b2db8eadc318cbc9572a439ac45cb74) Fix a recursive fallback in the world content tables' accessors - [`75723d3`](https://github.com/horizon-rust/horizon/commit/75723d34ba524d46585841f6565c5aa4470c2226) Data packs: load the world's packs into the registry tables - [`74341d6`](https://github.com/horizon-rust/horizon/commit/74341d672288185abf5a9e514fadc7f773503cfe) Data packs: load the world's packs' structures - [`de76987`](https://github.com/horizon-rust/horizon/commit/de769873d1a5826dc3d2f3756e52d9e97c334173) Create New World: the Experiments and Data Packs screens - [`19c08cb`](https://github.com/horizon-rust/horizon/commit/19c08cbc9bc5f508ddec8d6d357f0ee09b2f97d3) Data packs: load the world's packs' worldgen registries - [`5e66de9`](https://github.com/horizon-rust/horizon/commit/5e66de936191b105bd5c9578a83903421d9544d5) Create New World: the data packs' temporary folder, drops and vanilla layout - [`7a14c35`](https://github.com/horizon-rust/horizon/commit/7a14c352cb6562bf772af51394201a291f9c7804) Data packs: key a tag file by its folder, not by its last path part - [`ebfcf2b`](https://github.com/horizon-rust/horizon/commit/ebfcf2b577962feb5f1341444413da8dda8c7e36) Data packs: a world's level stems come from the pack's dimension registry ### 📊 Changes **156 files changed** (+3316 additions, -841 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client-render/src/assets.rs` (+3 -1) 📝 `crates/horizon-client-render/src/biome.rs` (+89 -51) 📝 `crates/horizon-client-render/src/brewing.rs` (+35 -16) 📝 `crates/horizon-client-render/src/chunk.rs` (+4 -3) 📝 `crates/horizon-client-render/src/datapack.rs` (+90 -1) 📝 `crates/horizon-client-render/src/pack_screen.rs` (+11 -2) 📝 `crates/horizon-client/examples/chunk_load_bench.rs` (+8 -1) 📝 `crates/horizon-client/examples/mod_port_probe.rs` (+4 -3) 📝 `crates/horizon-client/examples/probe/block_entity_anim_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/block_entity_render_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/block_transform_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/cauldron_fixture.rs` (+4 -3) 📝 `crates/horizon-client/examples/probe/creative_mining_probe.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/enchanting_fixture.rs` (+3 -2) 📝 `crates/horizon-client/examples/probe/entity_death_loot_fixture.rs` (+2 -2) 📝 `crates/horizon-client/examples/probe/finalize_spawn_fixture.rs` (+3 -2) 📝 `crates/horizon-client/examples/probe/firework_tooltip_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/ghost_recipe_fixture.rs` (+4 -3) 📝 `crates/horizon-client/examples/probe/hotbar_fixture.rs` (+5 -1) _...and 80 more files_ </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What and why A world's data packs can already add worldgen registries; this branch makes the client and the commands see the same biomes the generator does. - **The packs' biomes reach the client's table.** `Biomes::load` read only `data/minecraft/worldgen/biome` from the resource root, so a packed biome had no colours, precipitation or spawns, and `Biomes::id` (which `VanillaTerrain` uses to translate the generator's biome ids) fell back to plains — every packed biome rendered and saved as plains. `Biomes::load_over` merges the packs' `worldgen/biome/<id>.json` over the game's by id. `WorldTables` carries that table and `Game::biomes()` hands it out; `make_streaming` builds the same one for the generator, so both sides resolve one table. - **`/locate biome` accepts and completes the packs' biomes and tags.** A packed biome id was rejected at parse time ("Can't find element … of type 'minecraft:worldgen/biome'") because `command-registries.json` lists only the game's own ids; the packs' `worldgen/biome` ids and their `tags/worldgen/biome` ids now join the completion registries beside the structures. - **Biome tags read the pack stack.** The tag lookup behind `#tag` matched only the resource root's files, keyed a pack's file as `tags/<registry>/minecraft:<tag>` (missing every other namespace), and took only the top pack's file. It now reads the whole stack in order with `replace` dropping lower sources (`TagLoader.load`), which fixes structure tags too. - **The biome palette widens to 8 bits.** Vanilla's 67 fit in 7; Terralith's ~100 more pass the 128 ceiling. - Earlier commits on this branch fix the data pack function system: function lines run at permission level 2 (`MinecraftServer.createCommandSourceStack`), the `minecraft:load` tag writes after the world's saved data is loaded, `#minecraft:tick` runs before the levels' entity ticks (`MinecraftServer.tickChildren`), a fresh drop keeps `Age: 0` for that tick (`EntityTickList.ensureActiveIsNotIterated`), and `type_specific/player` matches players only and honours `input` (`InputPredicate`, `input.sneak` = `Input.shift()`). This branch is stacked on #3300 (which is stacked on a registry-overlay branch): the commits up to `ebfcf2b57` are that earlier work and are not new here. The commits this PR asks review for are `70294a3b3`, `e2be56d06` and `62579dda4`. ## Vanilla reference - `net.minecraft.client.resources.model.*`'s `SimpleJsonResourceReloadListener` layering for the biome JSON overlay; `Biome`'s colour accessors for the fields read. - `NbtPathArgument`, `CommandStorage`, `ServerFunctionManager.getGameLoopSender` (permission level 2 + suppressed output), `MinecraftServer.tickChildren`, `EntityTickList.ensureActiveIsNotIterated`, `ItemEntity.tick`, `advancements.predicates.InputPredicate` and `entity.PlayerPredicate` for the function/predicate behaviour. - `TagLoader.load` for the tag merge (`replace` drops lower sources). ## Self-check ``` rustfmt: pass clippy -p horizon-client -p horizon-client-render -p horizon-world --all-targets -D warnings: pass horizon-client lib: 626 passed horizon-client-render lib: 496 passed horizon-world lib: 181 passed ``` `tools/pr_ready.py`: rustfmt and clippy pass; the Python suite reports one failure, `tests/test_port_publish.py::test_body_has_names_and_signatures_only`, which compares a doc path containing `~/code/...` against the Windows path the tool prints (`~\code\...`) — a platform path-separator issue in the test, not touched here. Verified in a headless client with Terralith 2.6.5 as the world's data pack: `/locate biome terralith:cave/underground_jungle` finds it at [1473, 5, 1415], `/locate biome terralith:alpine_highlands` at [545, 69, -569], `/locate biome #c:is_lush` reports `terralith:cave/underground_jungle`, and a Vein Miner pack's tick-driven chain mining still works. ## Screenshots Not available: this machine's offscreen renderer draws a blank window, so no in-game capture was taken. The change is verified through the headless client's command output above. 🤖 Generated with ZCode ## Create New World, the data pack screen and the feature packs The Create World flow now does what vanilla's screens do around it: - **Preparing step.** `WorldOpenFlows`/`CreateWorldScreen.openCreateWorldScreen` queues a `GenericMessageScreen` with `createWorld.preparing` and loads the world generation context before the create screen opens. Horizon opened the screen at once and read the generator data only when the world did. The Create New World button now shows that message (centred, in its 12-pixel black box) while `Game` reads the generator data on a worker, and the screen opens when it is done — so pressing Create does not read it again. Changing the data packs re-runs it (`CreateWorldScreen`'s second `queueLoadScreen`), keeping what the player typed. - **Dropped packs ask first.** `PackSelectionScreen.onFilesDrop` shows a `ConfirmScreen` (`pack.dropConfirm` as its title, the file names as its message) and only then detects which entries are packs, copies those and lists the rest in an `AlertScreen` (`pack.dropRejected.title`/`.message`). The dialog is a screen of its own — menu background, centred layout, 150-wide buttons — and No/Escape dismisses it. - **A feature pack is one whose `pack.mcmeta` declares `features`.** `FeatureFlags.isExperimental` tests the flags a pack asks for, and `ServerPacksSource` takes every folder under `data/minecraft/datapacks`. Both the Experiments screen and the create screen's default disabled set used to name `minecart_improvements`, `redstone_experiments` and `trade_rebalance` or guess from the id; they read the pack's own flags now, so a pack a later version ships is picked up and a world pack with a plain id is not mistaken for one. Self-check for these commits: ``` rustfmt: pass clippy -p horizon-client -p horizon-client-render --lib --bins -D warnings: pass horizon-client lib: 626 passed horizon-client-render lib: 496 passed horizon-world lib: 181 passed ``` Still open, on its own branch: the flags themselves (minecart speed, the redstone rules, the rebalanced trades) change nothing yet, and a world does not record its `enabled_features`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11: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#5282
No description provided.