[PR #3300] [MERGED] Data packs: apply the world's packs to recipes, loot tables, advancements and tags #4896

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

📋 Pull Request Information

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

Base: main ← Head: fix/datapack-recipe-loot-tags


📝 Commits (6)

  • 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
  • a8e3ceb Merge main into this branch (wasm mod UI removed, item use slows sprint, crafted-recipe triggers, world presets)
  • a16097d Merge main into this branch (cushion placement checks, lan_bot sync test)
  • ada6692 Merge main into this branch (creative display slots)

📊 Changes

106 files changed (+1073 additions, -459 deletions)

View changed files

📝 crates/horizon-client-render/src/assets.rs (+3 -1)
📝 crates/horizon-client-render/src/brewing.rs (+35 -16)
📝 crates/horizon-client-render/src/datapack.rs (+46 -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_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 (+2 -1)
📝 crates/horizon-client/examples/probe/entity_death_loot_fixture.rs (+2 -2)
📝 crates/horizon-client/examples/probe/finalize_spawn_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)
📝 crates/horizon-client/examples/probe/menu_fixture.rs (+6 -4)
📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+2 -1)
📝 crates/horizon-client/examples/probe/natural_spawn_fixture.rs (+4 -3)
📝 crates/horizon-client/examples/probe/place_recipe_fixture.rs (+4 -3)
📝 crates/horizon-client/examples/probe/raid_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/recipe_book_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/recipe_book_render_fixture.rs (+3 -2)

...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 now change what the game plays with. Until now only
functions, function tags, predicates and item modifiers came out of
<world>/datapacks; recipes, loot tables, advancements and tags were read
from the prepared resource root only, so a community pack that edits a
recipe, a drop or a tag did nothing. They load at world open and on
/reload, the way ReloadableServerResources loads a server's, and worlds
without packs keep loading exactly as before.

Layering follows the pack stack:

  • A pack's recipe, loot table or advancement replaces the game's file for
    the same id — SimpleJsonResourceReloadListener.prepare hands out one
    resource per id, the resource stack's top.
  • Tag files join the game's entries in pack order, and a replace: true
    file drops what the lower sources put in — TagLoader.load walks the
    resource stack the same way; entries keep TagLoader.tryBuildTag's
    first-occurrence order through the nested # references.

Mechanically: datapack::DataStore collects the packs' recipe/,
loot_table/, advancement/ and tags/…/ files (DataStore.files; the
built-in pack is excluded, its files are the resource root's own, which the
tables read from disk). horizon_world::loot::PackOverlay carries them into
the loaders — Items (loot tables and the item/block/entity_type tags),
Recipes, StationData (smithing, stonecutting, brewing, the recipe book
index), advancements::Tree and LootData (structure-block containers).
The game keeps the pack tables in Game::world_tables, reads them through
Game::items/recipes/stations, and rebuilds them when the world opens
and on /reload; the advancement tree and the loot and LAN sync caches are
forgotten and rebuilt alongside, so /reload behaves like a server's.

The diff is large because the four tables are read at 236 sites through
shared resources: routing them through the world's tables touches every
consumer, and the loaders that parse each format (recipes, loot, tags,
advancements, the recipe book index) each take the overlay. It cannot ship
in parts — the datapack plumbing without the consumers would change nothing
a player could see.

Not covered yet (follow-ups): worldgen registries from packs, the
trade/banner/enchantment registry files, and the prepare-time behavior
bundles (mining facts stay with block-behaviours.json).

Vanilla reference

  • net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.prepare
    — one resource per id, the top of the stack (recipes, and the per-id
    tables).
  • net.minecraft.tags.TagLoader.load / tryBuildTag — resource stacks
    bottom-to-top, replace clearing lower packs, first-occurrence entry
    order, nested # resolution.
  • net.minecraft.server.ReloadableServerResources / MinecraftServer.reloadResources
    — the world's packs load at server start and on /reload.
  • net.minecraft.server.ServerAdvancementManager — advancements are a
    datapack registry in 26.3; per-entry top-pack-wins.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on DESKTOP-3050AHP, against upstream/main at 6d3489d30, 6 min 34 s)

Check Result
Scope ⚠️ 107 files, +1048 −454; 1498 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 401 run, FAILED (failures=2, errors=7, skipped=1) (1 min 49 s)
rustfmt ✅ (15 s)
clippy ✅ (1 min 5 s)
tests: horizon-client, horizon-items, horizon-world ❌ 1093 passed, 2 failed (2 min 15 s)
doc tests ✅ 0 passed (1 min 4 s)
content root tests ✅ 4 passed (1 s)
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses

The failures are pre-existing on this machine, verified against a pristine
upstream/main (git stash → same result → pop):

  • horizon-client lib: save::tests::session_lock_is_exclusive (OS reports
    the file locked) and crash::tests::stacks_start_at_the_panicking_frame
    (backtrace path format) — the two known Windows failures.
  • Python: the same failures=2, errors=7, skipped=1 (test_parity_reach,
    dedicated_server, test_port_harness, test_port_publish) on clean
    upstream/main.

Temporary tests for the layering semantics (override per id, tag replace

  • union, no-packs fallback) were written, passed and removed from this diff.

Screenshots

Not attached: this machine's offscreen renderer shows a blank window (noted
in the agent workflow). The player-visible change is data-driven — a world
pack replacing a recipe shows up in the recipe book and crafting, which
needs a real screen to capture.


🔄 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/3300 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/datapack-recipe-loot-tags` --- ### 📝 Commits (6) - [`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 - [`a8e3ceb`](https://github.com/horizon-rust/horizon/commit/a8e3cebc5f0b44581be1258f72ad04b94f3277bc) Merge main into this branch (wasm mod UI removed, item use slows sprint, crafted-recipe triggers, world presets) - [`a16097d`](https://github.com/horizon-rust/horizon/commit/a16097dd9696adbd3699fe692f840cbdb4a8935b) Merge main into this branch (cushion placement checks, lan_bot sync test) - [`ada6692`](https://github.com/horizon-rust/horizon/commit/ada669266fc419525d276510fbe8dad6e57a14fa) Merge main into this branch (creative display slots) ### 📊 Changes **106 files changed** (+1073 additions, -459 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/assets.rs` (+3 -1) 📝 `crates/horizon-client-render/src/brewing.rs` (+35 -16) 📝 `crates/horizon-client-render/src/datapack.rs` (+46 -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_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` (+2 -1) 📝 `crates/horizon-client/examples/probe/entity_death_loot_fixture.rs` (+2 -2) 📝 `crates/horizon-client/examples/probe/finalize_spawn_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) 📝 `crates/horizon-client/examples/probe/menu_fixture.rs` (+6 -4) 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/natural_spawn_fixture.rs` (+4 -3) 📝 `crates/horizon-client/examples/probe/place_recipe_fixture.rs` (+4 -3) 📝 `crates/horizon-client/examples/probe/raid_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/recipe_book_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/recipe_book_render_fixture.rs` (+3 -2) _...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 now change what the game plays with. Until now only functions, function tags, predicates and item modifiers came out of `<world>/datapacks`; recipes, loot tables, advancements and tags were read from the prepared resource root only, so a community pack that edits a recipe, a drop or a tag did nothing. They load at world open and on `/reload`, the way `ReloadableServerResources` loads a server's, and worlds without packs keep loading exactly as before. Layering follows the pack stack: - A pack's recipe, loot table or advancement **replaces** the game's file for the same id — `SimpleJsonResourceReloadListener.prepare` hands out one resource per id, the resource stack's top. - Tag files **join** the game's entries in pack order, and a `replace: true` file drops what the lower sources put in — `TagLoader.load` walks the resource stack the same way; entries keep `TagLoader.tryBuildTag`'s first-occurrence order through the nested `#` references. Mechanically: `datapack::DataStore` collects the packs' `recipe/`, `loot_table/`, `advancement/` and `tags/…/` files (`DataStore.files`; the built-in pack is excluded, its files are the resource root's own, which the tables read from disk). `horizon_world::loot::PackOverlay` carries them into the loaders — `Items` (loot tables and the item/block/entity_type tags), `Recipes`, `StationData` (smithing, stonecutting, brewing, the recipe book index), `advancements::Tree` and `LootData` (structure-block containers). The game keeps the pack tables in `Game::world_tables`, reads them through `Game::items`/`recipes`/`stations`, and rebuilds them when the world opens and on `/reload`; the advancement tree and the loot and LAN sync caches are forgotten and rebuilt alongside, so `/reload` behaves like a server's. The diff is large because the four tables are read at 236 sites through shared resources: routing them through the world's tables touches every consumer, and the loaders that parse each format (recipes, loot, tags, advancements, the recipe book index) each take the overlay. It cannot ship in parts — the datapack plumbing without the consumers would change nothing a player could see. Not covered yet (follow-ups): worldgen registries from packs, the trade/banner/enchantment registry files, and the prepare-time behavior bundles (mining facts stay with `block-behaviours.json`). ## Vanilla reference - `net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener.prepare` — one resource per id, the top of the stack (recipes, and the per-id tables). - `net.minecraft.tags.TagLoader.load` / `tryBuildTag` — resource stacks bottom-to-top, `replace` clearing lower packs, first-occurrence entry order, nested `#` resolution. - `net.minecraft.server.ReloadableServerResources` / `MinecraftServer.reloadResources` — the world's packs load at server start and on `/reload`. - `net.minecraft.server.ServerAdvancementManager` — advancements are a datapack registry in 26.3; per-entry top-pack-wins. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on DESKTOP-3050AHP, against upstream/main at 6d3489d30, 6 min 34 s) | Check | Result | | --- | --- | | Scope | ⚠️ 107 files, +1048 −454; 1498 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 401 run, FAILED (failures=2, errors=7, skipped=1) (1 min 49 s) | | rustfmt | ✅ (15 s) | | clippy | ✅ (1 min 5 s) | | tests: horizon-client, horizon-items, horizon-world | ❌ 1093 passed, 2 failed (2 min 15 s) | | doc tests | ✅ 0 passed (1 min 4 s) | | content root tests | ✅ 4 passed (1 s) | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | The failures are pre-existing on this machine, verified against a pristine `upstream/main` (git stash → same result → pop): - `horizon-client` lib: `save::tests::session_lock_is_exclusive` (OS reports the file locked) and `crash::tests::stacks_start_at_the_panicking_frame` (backtrace path format) — the two known Windows failures. - Python: the same `failures=2, errors=7, skipped=1` (`test_parity_reach`, `dedicated_server`, `test_port_harness`, `test_port_publish`) on clean `upstream/main`. Temporary tests for the layering semantics (override per id, tag `replace` + union, no-packs fallback) were written, passed and removed from this diff. ## Screenshots Not attached: this machine's offscreen renderer shows a blank window (noted in the agent workflow). The player-visible change is data-driven — a world pack replacing a recipe shows up in the recipe book and crafting, which needs a real screen to capture. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:44 +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#4896
No description provided.