[PR #6247] [MERGED] fix(mods): lay a content block's states out in vanilla's order (follow-up to #6165) #6741

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6247
Author: @Xmilon
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: native/content-state-vanilla-order


📝 Commits (5)

  • 576fb98 fix(mods): refuse a declared state property that sorts before the template's
  • dc1597e Join the state-order error's two lines with a continuation
  • 29c9854 fix(mods): lay a content block's states out in vanilla's order
  • 7cf0bce Merge remote-tracking branch 'origin/native/content-state-order' into native/content-state-vanilla-order
  • b40d434 fix(mods): pass the property lookup by value

📊 Changes

3 files changed (+234 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/mod_content.rs (+136 -18)
📝 crates/horizon-client/src/mod_content_tests.rs (+92 -0)
📝 docs/mods.md (+6 -2)

📄 Description

🤖 Opened by Xmilon's AI agent (Claude Code, Claude Opus 5.5), not by Xmilon personally.

Note

Follow-up to #6165, stacked on its branch: the first commits here are #6165's and Ludovic's fix to its message, so this diff against main shows them too. Merge #6165 first, then this PR is only 29c9854e6 (the layout) and the merge that removes #6165's refusal. Against #6165's branch the diff is 3 files, +234 −57.

What and why

Follow-up to #6165, for #6139 (option 1 of its "What would fix it"): instead of refusing a declared state property that sorts before one of the template's, build the rows the way vanilla does.

A content block's states were its template's states times the declared combinations, the template's properties varying slowest. StateTable::new reads a state table as vanilla's StateDefinition does: every property sorted by name, the first name slowest. So bites (declared) on minecraft:carved_pumpkin (facing) stopped the game at load.

Now the states of a block are laid out in that order, over the template's and the declared properties together (state_order, one mixed-radix walk over the sorted names). Each property keeps its own value order: the template's as vanilla has it, a declared one with its default first, as before.

  • One lookup: Rename.rows maps (template state, declared combination) to the state's row. It replaces the template offset * fanout arithmetic in Rename::id (so the default state and every renamed id), in the collision-shape fan-out and in the cached shapes. The expansion of named definitions and model states already walks the rows in registry order from the same layout.
  • Ids do not move for blocks that already worked: with every declared name after the template's, the layout is the template's states times the combinations, as before (block_states_are_laid_out_in_vanilla_order pins that, and the bites/facing, interleaved and empty cases).
  • A template whose own properties do not multiply out to its states (only a hand-made test fixture) keeps the old layout.
  • #6165's refusal is gone, with its test; content_block_state_properties_follow_vanilla_name_order builds the alpha-before-axis block and checks the rows (alpha slowest) and the default id.
  • docs/mods.md describes the layout.

Kind

  • bug: a crash or a breakage

Vanilla reference

StateDefinition (properties sorted by name, the first name slowest).

Other projects' code

none

Self-check

  • cargo test -p horizon-client --lib mod_content --include-ignored: 51 passed, including the full content-root tests against the prepared game resources (274 s), which build real block tables and collision shapes.
  • rustfmt and the public-tree check pass.
  • tools/pr_ready.py not run on this branch (clippy is long on a cold cache); CI runs it.
  • Not tested in game, and not run against a real carved_pumpkin + bites mod: the new test uses the fake minecraft:test template (axis) with alpha.

🤖 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/6247 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `native/content-state-vanilla-order` --- ### 📝 Commits (5) - [`576fb98`](https://github.com/horizon-rust/horizon/commit/576fb98696a7526482ba7b5bf4ca1c60009a936c) fix(mods): refuse a declared state property that sorts before the template's - [`dc1597e`](https://github.com/horizon-rust/horizon/commit/dc1597e1165e2ad0db4d8cb37a9a8d47dc31899b) Join the state-order error's two lines with a continuation - [`29c9854`](https://github.com/horizon-rust/horizon/commit/29c9854e60fac2218a3ad668b58d0eed97487481) fix(mods): lay a content block's states out in vanilla's order - [`7cf0bce`](https://github.com/horizon-rust/horizon/commit/7cf0bceb8b496d588bb20a2696f83f53062155b5) Merge remote-tracking branch 'origin/native/content-state-order' into native/content-state-vanilla-order - [`b40d434`](https://github.com/horizon-rust/horizon/commit/b40d434d4b1dd549d930b0081d19c8f94c210ea9) fix(mods): pass the property lookup by value ### 📊 Changes **3 files changed** (+234 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mod_content.rs` (+136 -18) 📝 `crates/horizon-client/src/mod_content_tests.rs` (+92 -0) 📝 `docs/mods.md` (+6 -2) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Claude Code, Claude Opus 5.5), not by Xmilon personally. > [!NOTE] > Follow-up to #6165, stacked on its branch: the first commits here are #6165's and Ludovic's fix to its message, so this diff against `main` shows them too. Merge #6165 first, then this PR is only `29c9854e6` (the layout) and the merge that removes #6165's refusal. Against #6165's branch the diff is 3 files, +234 −57. ## What and why Follow-up to #6165, for #6139 (option 1 of its "What would fix it"): instead of refusing a declared state property that sorts before one of the template's, build the rows the way vanilla does. A content block's states were its template's states times the declared combinations, the template's properties varying slowest. `StateTable::new` reads a state table as vanilla's `StateDefinition` does: every property sorted by name, the first name slowest. So `bites` (declared) on `minecraft:carved_pumpkin` (`facing`) stopped the game at load. Now the states of a block are laid out in that order, over the template's and the declared properties together (`state_order`, one mixed-radix walk over the sorted names). Each property keeps its own value order: the template's as vanilla has it, a declared one with its default first, as before. - **One lookup:** `Rename.rows` maps (template state, declared combination) to the state's row. It replaces the `template offset * fanout` arithmetic in `Rename::id` (so the default state and every renamed id), in the collision-shape fan-out and in the cached shapes. The expansion of named definitions and model states already walks the rows in registry order from the same layout. - **Ids do not move** for blocks that already worked: with every declared name after the template's, the layout is the template's states times the combinations, as before (`block_states_are_laid_out_in_vanilla_order` pins that, and the `bites`/`facing`, interleaved and empty cases). - A template whose own properties do not multiply out to its states (only a hand-made test fixture) keeps the old layout. - #6165's refusal is gone, with its test; `content_block_state_properties_follow_vanilla_name_order` builds the `alpha`-before-`axis` block and checks the rows (`alpha` slowest) and the default id. - `docs/mods.md` describes the layout. ## Kind - [x] bug: a crash or a breakage ## Vanilla reference `StateDefinition` (properties sorted by name, the first name slowest). ## Other projects' code none ## Self-check - `cargo test -p horizon-client --lib mod_content --include-ignored`: 51 passed, including the full content-root tests against the prepared game resources (274 s), which build real block tables and collision shapes. - rustfmt and the public-tree check pass. - `tools/pr_ready.py` not run on this branch (clippy is long on a cold cache); CI runs it. - Not tested in game, and not run against a real `carved_pumpkin` + `bites` mod: the new test uses the fake `minecraft:test` template (`axis`) with `alpha`. 🤖 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-03 06:25:59 +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#6741
No description provided.