[PR #975] [MERGED] Loot: read every namespace's tables, so modded structures' chests are no longer empty #2956

Closed
opened 2026-11-02 16:00:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/mod-loot-tables


📝 Commits (1)

  • 6008be0 Loot: tables, modifiers, predicates, tags and recipes of every namespace

📊 Changes

2 files changed (+114 additions, -21 deletions)

View changed files

📝 crates/horizon-world/src/loot.rs (+109 -20)
📝 docs/modpacks.md (+5 -1)

📄 Description

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

What

Every chest in a carried mod's structure that names its own mod's loot table (MVS's mvs:houses_common, T&T's kaisyn:village/..., Repurposed Structures', CTOV's...) opened empty: LootData::load read only data/minecraft/. docs/modpacks.md already said loot reads every namespace, but it didn't.

  • LootData::load now reads loot tables, item modifiers, predicates, tags and recipes from every namespace under data/ (ns:path, namespaces in sorted order). A vanilla root has only minecraft, so vanilla reads exactly the same files. Enchantments stay vanilla's.
  • 1.21.1 mods write some integers as floats (T&T's "rolls": {"type": "minecraft:uniform", "min": 3.0, "max": 8.0}). Vanilla's int codecs read those through Number.intValue (3.0 is 3). Horizon's loot read them as 0 rolls. Int number providers, weights, qualities and count limits now read them as vanilla does.

Proof

  • loot_fill over ATM10's 42 carried mods, all 675 non-block loot tables in mod namespaces, seed 1: 534 tables fill a chest, against 0 before. The rest are entity, archaeology and conditional tables that need a context (killed by a player, a tool...).
  • T&T's kaisyn:village/village_swamp_house now gives wheat, beetroot seeds, slime balls and so on; before the namespace fix it was not found, and with the namespace fix alone it rolled 0 times.
  • Vanilla is unchanged: loot_fill over all 58 vanilla chest tables at seeds 1, 2 and 3 gives byte-identical output before and after (1,887 lines).
  • Test loot::namespace_tests::loads_every_namespace: a mod namespace's table and item tag load beside vanilla's, and float-written rolls and weights fill 3 items.

Self-check

cargo fmt --all --check                                      ok
cargo clippy -p horizon-world --all-targets -- -D warnings   ok
cargo test -p horizon-world --lib loot                       ok
loot_fill, every vanilla chest table, seeds 1-3              identical

Game-side parity harnesses: to be run on one integration commit with this wave's other game-side PRs (results will be added here).

Nothing needs Ludovic.

Integration run (game-side PRs together)

One commit merging this PR with #969, #974, #975, #981, #982, #983, #984, #988, #989 on main 0af3dd39:

cargo fmt --all -- --check                                                      ok
cargo clippy --workspace --all-targets -- -D warnings                           ok
cargo test -p horizon-world -p horizon-port-pack -p horizon-mods -p horizon-client   ok (0 failed)
tools/parity.py --changed origin/main                                           301 passed, 0 failed in 207.2 min (mob_ai and command_exec included)
vanilla structure-start oracle, chunks -64..63                                  150/150 (seed 1234), 134/134 (seed 2)

(#969's first CI parity run failed command_exec on /random reset * (11 vs 12 sequences); its rerun passed 780/780, so that was a flake. The rerun's mob_ai failure was its Java oracle crashing under load; mob_ai passes on the integration commit.)

🤖 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/975 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mod-loot-tables` --- ### 📝 Commits (1) - [`6008be0`](https://github.com/horizon-rust/horizon/commit/6008be0a68eca6e359ab7c7264fc083fffb56250) Loot: tables, modifiers, predicates, tags and recipes of every namespace ### 📊 Changes **2 files changed** (+114 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/loot.rs` (+109 -20) 📝 `docs/modpacks.md` (+5 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Every chest in a carried mod's structure that names its own mod's loot table (MVS's `mvs:houses_common`, T&T's `kaisyn:village/...`, Repurposed Structures', CTOV's...) opened **empty**: `LootData::load` read only `data/minecraft/`. docs/modpacks.md already said loot reads every namespace, but it didn't. - `LootData::load` now reads loot tables, item modifiers, predicates, tags and recipes from every namespace under `data/` (`ns:path`, namespaces in sorted order). A vanilla root has only `minecraft`, so vanilla reads exactly the same files. Enchantments stay vanilla's. - 1.21.1 mods write some integers as floats (T&T's `"rolls": {"type": "minecraft:uniform", "min": 3.0, "max": 8.0}`). Vanilla's int codecs read those through `Number.intValue` (3.0 is 3). Horizon's loot read them as 0 rolls. Int number providers, weights, qualities and count limits now read them as vanilla does. ## Proof - `loot_fill` over ATM10's 42 carried mods, all 675 non-block loot tables in mod namespaces, seed 1: **534 tables fill a chest, against 0 before**. The rest are entity, archaeology and conditional tables that need a context (killed by a player, a tool...). - T&T's `kaisyn:village/village_swamp_house` now gives wheat, beetroot seeds, slime balls and so on; before the namespace fix it was not found, and with the namespace fix alone it rolled 0 times. - Vanilla is unchanged: `loot_fill` over **all 58 vanilla chest tables at seeds 1, 2 and 3** gives byte-identical output before and after (1,887 lines). - Test `loot::namespace_tests::loads_every_namespace`: a mod namespace's table and item tag load beside vanilla's, and float-written rolls and weights fill 3 items. ## Self-check ``` cargo fmt --all --check ok cargo clippy -p horizon-world --all-targets -- -D warnings ok cargo test -p horizon-world --lib loot ok loot_fill, every vanilla chest table, seeds 1-3 identical ``` Game-side parity harnesses: to be run on one integration commit with this wave's other game-side PRs (results will be added here). Nothing needs Ludovic. ## Integration run (game-side PRs together) One commit merging this PR with #969, #974, #975, #981, #982, #983, #984, #988, #989 on main 0af3dd39: ``` cargo fmt --all -- --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-world -p horizon-port-pack -p horizon-mods -p horizon-client ok (0 failed) tools/parity.py --changed origin/main 301 passed, 0 failed in 207.2 min (mob_ai and command_exec included) vanilla structure-start oracle, chunks -64..63 150/150 (seed 1234), 134/134 (seed 2) ``` (#969's first CI parity run failed command_exec on `/random reset *` (11 vs 12 sequences); its rerun passed 780/780, so that was a flake. The rerun's mob_ai failure was its Java oracle crashing under load; mob_ai passes on the integration commit.) 🤖 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 16:00:25 +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#2956
No description provided.