[PR #6165] [MERGED] fix(mods): refuse a declared state property that sorts before the template's #6688

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

📋 Pull Request Information

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

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


📝 Commits (2)

  • 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

📊 Changes

2 files changed (+37 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/mod_content.rs (+19 -0)
📝 crates/horizon-client/src/mod_content_tests.rs (+18 -0)

📄 Description

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

What and why

Fixes #6139.

A content block that declares state_properties on a template with properties of its own stopped the game at load when a declared name sorted before one of the template's. Example: minecraft:carved_pumpkin (facing) with a declared bites: "registry state order differs from vanilla's state definition" (StateTable::new).

The block's states are its template's states times the declared combinations, so the template's properties always vary slowest. StateTable::new reads a table the way vanilla's StateDefinition does: sorted by name, the first name slowest. The two orders agree only when every declared name sorts after every template property name.

This takes the issue's second option: the plan refuses such a block when it is built, with the block's id and the property to rename, e.g. testmod:x: state property alpha sorts before axis, a property of minecraft:test: the game orders states by property name, so name it after axis. The mod's row on the Mods page says why, and the game starts.

Not done: building the rows in name order over both sets of properties (the issue's first option). The state-id mapping assumes template-slow order in several places (Rename::fanout, the fan-out of shapes, default states and named definitions), so that is a larger change. I can take it as a follow-up if maintainers want it.

Kind

  • bug: a crash or a breakage

Vanilla reference

StateDefinition (properties sorted by name, the first name slowest). Horizon-only content-mod format otherwise.

Other projects' code

none

Self-check

  • content_block_state_properties_are_validated has the new case (a declared alpha before the template's axis is refused with the id and the property); it and the two sibling content_block_state_properties_* tests pass.
  • rustfmt and the public-tree check pass.
  • tools/pr_ready.py not run locally (its clippy run is long on a cold cache); CI runs it.

🤖 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/6165 **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-order` --- ### 📝 Commits (2) - [`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 ### 📊 Changes **2 files changed** (+37 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mod_content.rs` (+19 -0) 📝 `crates/horizon-client/src/mod_content_tests.rs` (+18 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Claude Code, Claude Opus 5.5), not by Xmilon personally. ## What and why Fixes #6139. A content block that declares `state_properties` on a template with properties of its own stopped the game at load when a declared name sorted before one of the template's. Example: `minecraft:carved_pumpkin` (`facing`) with a declared `bites`: "registry state order differs from vanilla's state definition" (`StateTable::new`). The block's states are its template's states times the declared combinations, so the template's properties always vary slowest. `StateTable::new` reads a table the way vanilla's `StateDefinition` does: sorted by name, the first name slowest. The two orders agree only when every declared name sorts after every template property name. This takes the issue's second option: the plan refuses such a block when it is built, with the block's id and the property to rename, e.g. `testmod:x: state property alpha sorts before axis, a property of minecraft:test: the game orders states by property name, so name it after axis`. The mod's row on the Mods page says why, and the game starts. Not done: building the rows in name order over both sets of properties (the issue's first option). The state-id mapping assumes template-slow order in several places (`Rename::fanout`, the fan-out of shapes, default states and named definitions), so that is a larger change. I can take it as a follow-up if maintainers want it. ## Kind - [x] bug: a crash or a breakage ## Vanilla reference `StateDefinition` (properties sorted by name, the first name slowest). Horizon-only content-mod format otherwise. ## Other projects' code none ## Self-check - `content_block_state_properties_are_validated` has the new case (a declared `alpha` before the template's `axis` is refused with the id and the property); it and the two sibling `content_block_state_properties_*` tests pass. - rustfmt and the public-tree check pass. - `tools/pr_ready.py` not run locally (its clippy run is long on a cold cache); CI runs it. 🤖 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:24:57 +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#6688
No description provided.