[PR #5117] [MERGED] Resolve enchantment-dependent component item models #6085

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5117
Author: @oskal675-design
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/mace-pack-models


📝 Commits (1)

  • c6c043e Resolve enchantment-dependent component item models

📊 Changes

4 files changed (+238 additions, -15 deletions)

View changed files

📝 crates/horizon-assets/src/item_model.rs (+10 -10)
➕ crates/horizon-assets/src/item_model/component_predicate.rs (+177 -0)
📝 crates/horizon-client/src/game/item_draw.rs (+3 -0)
📝 tools/test_item_model_parity.py (+48 -5)

📄 Description

🤖 Opened by oskal675-design's AI agent (Codex, GPT-6.1), not by oskal675-design personally.

What and why

Fixes #4867. Mace Enchant Indicator 2.0.2 makes the mace invisible because Horizon expects an object in a component condition's predicate field. Vanilla uses a predicate identifier and a separate value. The valid item definition is silently dropped. Component predicate evaluation also currently defaults to false.

Decode the native discriminator/value form and evaluate enchantments and stored_enchantments against the stack's resolved components. Preserve conjunction between predicate entries, alternatives within an enchantment selector, inclusive/exact levels, component presence and empty-list behavior. Resolve enchantment tags through the game's loaded enchantment registry and reject reversed bounds. Other predicate types retain the existing host hook.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Pinned 26.3 bytecode: ComponentMatches.MAP_CODEC, DataComponentPredicate.singleCodec, DataComponentPredicate.Single.wrapCodec, EnchantmentsPredicate.matches, EnchantmentPredicate.containedIn / matchesEnchantment, MinMaxBounds.Ints.matches and MinMaxBounds.Bounds.validateSwappedBoundsInCodec.

Extended tools/test_item_model_parity.py with original component-condition definitions, nested/composite models, stored enchantments, ID alternatives, level bounds, component removal and malformed codec inputs. The existing oracle runs the actual client codec, model baking and item model resolver.

  • Full run: 214,901 resolved stacks match; 1,799 definitions checked. The 5,355 inputs rejected by vanilla are counted separately, not claimed as matching rendered cases.
  • Focused run: 7,866 resolved stacks match (--component-conditions).
  • Rust regressions cover the host's tag membership and the native matcher distinction between an unnamed predicate and a named enchantment at level zero. Vanilla rejects zero in the component JSON codec; that low-level matcher case is tested separately.
  • port_ledger.py check --base origin/main: no stale citations or new call gaps.

Other projects' code

None read or copied. The original resource pack, licensed All Rights Reserved, was run unmodified as a black box. No pack model JSON or source was inspected; all new fixtures were written from the pinned vanilla codecs.

Self-check

Built and drove the actual client on its integrated-server path, with fresh scratch homes. Before: the pack makes an ordinary or Density mace invisible. After: ordinary, Density, Breach and Wind Burst I/II/III render, including the inventory icon. The test waits for the client inventory and asserts each Wind Burst level before capturing it.

The self-check ran in a private network namespace with project-local scratch storage mounted at /tmp, avoiding this host's existing TEST-NET proxy and repository-local temp-path test failures. The full item-model harness above ran separately; --quick below skips the broader affected harness set.

pr_ready (tools/pr_ready.py --quick on omarchy, against origin/main at 3c68c05d0, 3 min 38 s)

Check Result
Scope ✅ 4 files, +238 −15
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (25 s)
rustfmt ✅ (6 s)
clippy ✅ (16 s)
tests: horizon-assets, horizon-client ✅ 1351 passed (2 min 9 s)
doc tests ✅ 0 passed (1 s)
content root tests ✅ 7 passed (38 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 314 affected, to run in CI (--quick): block_entity_render, block_removal, block_survival, block_tint, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen and 302 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Screenshots

Before — the pack is enabled and the selected mace is invisible:

Before

After — the ordinary mace is visible:

After

Density:

Density

Breach + Wind Burst III:

Wind Burst III

Screenshots are on a separate evidence branch in the fork. No resource-pack files, game files or prepared resources are part of this PR.

🤖 Generated with Codex.


🔄 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/5117 **Author:** [@oskal675-design](https://github.com/oskal675-design) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/mace-pack-models` --- ### 📝 Commits (1) - [`c6c043e`](https://github.com/horizon-rust/horizon/commit/c6c043e8b596db9823d270c41d671ba4492c576c) Resolve enchantment-dependent component item models ### 📊 Changes **4 files changed** (+238 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-assets/src/item_model.rs` (+10 -10) ➕ `crates/horizon-assets/src/item_model/component_predicate.rs` (+177 -0) 📝 `crates/horizon-client/src/game/item_draw.rs` (+3 -0) 📝 `tools/test_item_model_parity.py` (+48 -5) </details> ### 📄 Description > 🤖 Opened by oskal675-design's AI agent (Codex, GPT-6.1), not by oskal675-design personally. ## What and why Fixes #4867. Mace Enchant Indicator 2.0.2 makes the mace invisible because Horizon expects an object in a component condition's `predicate` field. Vanilla uses a predicate identifier and a separate `value`. The valid item definition is silently dropped. Component predicate evaluation also currently defaults to false. Decode the native discriminator/value form and evaluate `enchantments` and `stored_enchantments` against the stack's resolved components. Preserve conjunction between predicate entries, alternatives within an enchantment selector, inclusive/exact levels, component presence and empty-list behavior. Resolve enchantment tags through the game's loaded enchantment registry and reject reversed bounds. Other predicate types retain the existing host hook. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Pinned 26.3 bytecode: `ComponentMatches.MAP_CODEC`, `DataComponentPredicate.singleCodec`, `DataComponentPredicate.Single.wrapCodec`, `EnchantmentsPredicate.matches`, `EnchantmentPredicate.containedIn` / `matchesEnchantment`, `MinMaxBounds.Ints.matches` and `MinMaxBounds.Bounds.validateSwappedBoundsInCodec`. Extended `tools/test_item_model_parity.py` with original component-condition definitions, nested/composite models, stored enchantments, ID alternatives, level bounds, component removal and malformed codec inputs. The existing oracle runs the actual client codec, model baking and item model resolver. - Full run: **214,901 resolved stacks match; 1,799 definitions checked**. The 5,355 inputs rejected by vanilla are counted separately, not claimed as matching rendered cases. - Focused run: **7,866 resolved stacks match** (`--component-conditions`). - Rust regressions cover the host's tag membership and the native matcher distinction between an unnamed predicate and a named enchantment at level zero. Vanilla rejects zero in the component JSON codec; that low-level matcher case is tested separately. - `port_ledger.py check --base origin/main`: no stale citations or new call gaps. ## Other projects' code None read or copied. The [original resource pack](https://modrinth.com/resourcepack/mace-enchant-indicator/version/UVLiF3Og), licensed All Rights Reserved, was run unmodified as a black box. No pack model JSON or source was inspected; all new fixtures were written from the pinned vanilla codecs. ## Self-check Built and drove the actual client on its integrated-server path, with fresh scratch homes. Before: the pack makes an ordinary or Density mace invisible. After: ordinary, Density, Breach and Wind Burst I/II/III render, including the inventory icon. The test waits for the client inventory and asserts each Wind Burst level before capturing it. The self-check ran in a private network namespace with project-local scratch storage mounted at `/tmp`, avoiding this host's existing TEST-NET proxy and repository-local temp-path test failures. The full item-model harness above ran separately; `--quick` below skips the broader affected harness set. **pr_ready** (`tools/pr_ready.py --quick` on omarchy, against origin/main at 3c68c05d0, 3 min 38 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +238 −15 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (25 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (16 s) | | tests: horizon-assets, horizon-client | ✅ 1351 passed (2 min 9 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ✅ 7 passed (38 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 314 affected, to run in CI (--quick): block_entity_render, block_removal, block_survival, block_tint, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen and 302 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## Screenshots Before — the pack is enabled and the selected mace is invisible: ![Before](https://raw.githubusercontent.com/oskal675-design/horizon/a5be647f9b41b4bef172460f910ff3e28490f0e9/before.png) After — the ordinary mace is visible: ![After](https://raw.githubusercontent.com/oskal675-design/horizon/a5be647f9b41b4bef172460f910ff3e28490f0e9/after.png) Density: ![Density](https://raw.githubusercontent.com/oskal675-design/horizon/a5be647f9b41b4bef172460f910ff3e28490f0e9/density.png) Breach + Wind Burst III: ![Wind Burst III](https://raw.githubusercontent.com/oskal675-design/horizon/a5be647f9b41b4bef172460f910ff3e28490f0e9/wind-burst-3.png) Screenshots are on a separate evidence branch in the fork. No resource-pack files, game files or prepared resources are part of this PR. 🤖 Generated with [Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:31 +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#6085
No description provided.