[PR #4782] [MERGED] Hash block predicates and inline trim, instrument and banner pattern holders in container clicks #5846

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4782
Author: @levzzz5154
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: parity/K2-hash-3


📝 Commits (1)

  • d3fd453 Hash block predicates and direct trim, instrument and banner pattern holders

📊 Changes

2 files changed (+202 additions, -15 deletions)

View changed files

📝 crates/horizon-protocol/src/item/hash/gameplay.rs (+66 -14)
📝 crates/horizon-protocol/src/item/hash/raw.rs (+136 -1)

📄 Description

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

Part of #3518

What and why

Fifth PR on the hashed container-click components (#4738, #4742, #4764, #4772). It hashes the last components Horizon keeps as stream bytes whose codec form vanilla can build: block predicates and inline (direct) holders.

Rows

  • HashedPatchMap.create: also hashes can_place_on / can_break (AdventureModePredicate: blocks, state with exact and ranged matchers, and exact components; one predicate is written as itself, as compactListCodec does), and trim, instrument, banner_patterns and provides_trim_material holding an inline (direct) holder, which hash as the holder's DIRECT_CODEC record (TrimMaterial, TrimPattern, Instrument, BannerPattern). References keep their typed form from #4742.
  • HashedStack.create: the container-click stack carries them.

What stays unhashed (the row stays partial)

  • Block predicates with an nbt (a lenient SNBT string) or partial predicates.
  • Books with filtered text: Horizon drops the filtered variants on read (a server only sends them with chat filtering), so the hash cannot match.
  • An id with no registry name.
  • Never hashable, as vanilla's own client would throw: creative_slot_lock, map_post_processing, additional_trade_cost (no persistent codec), and a direct painting/variant or jukebox_playable (RegistryFixedCodec cannot encode a direct holder).

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

TypedDataComponent.encodeValue, HashedPatchMap.create, AdventureModePredicate, BlockPredicate, StatePropertiesPredicate, DataComponentExactPredicate, ArmorTrim, TrimMaterial, TrimPattern, Instrument, BannerPatternLayers, BannerPattern and RegistryFileCodec.

Tests

cargo test -p horizon-protocol --lib item::: 10 more cases in components_read_past_hash_as_vanilla_does / gameplay_components_hash_as_vanilla_does, with stream bytes and hashes printed by vanilla 26.3 itself (throwaway Java driver on the real jars, as in the earlier PRs). fmt and clippy -D warnings on horizon-protocol.

🤖 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/4782 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/K2-hash-3` --- ### 📝 Commits (1) - [`d3fd453`](https://github.com/horizon-rust/horizon/commit/d3fd453cfabd4e25897f71bdc23e0647eaccca8a) Hash block predicates and direct trim, instrument and banner pattern holders ### 📊 Changes **2 files changed** (+202 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-protocol/src/item/hash/gameplay.rs` (+66 -14) 📝 `crates/horizon-protocol/src/item/hash/raw.rs` (+136 -1) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3518 ## What and why Fifth PR on the hashed container-click components (#4738, #4742, #4764, #4772). It hashes the last components Horizon keeps as stream bytes whose codec form vanilla can build: block predicates and inline (direct) holders. ## Rows - `HashedPatchMap.create`: also hashes `can_place_on` / `can_break` (`AdventureModePredicate`: `blocks`, `state` with exact and ranged matchers, and exact `components`; one predicate is written as itself, as `compactListCodec` does), and `trim`, `instrument`, `banner_patterns` and `provides_trim_material` holding an inline (direct) holder, which hash as the holder's `DIRECT_CODEC` record (`TrimMaterial`, `TrimPattern`, `Instrument`, `BannerPattern`). References keep their typed form from #4742. - `HashedStack.create`: the container-click stack carries them. ## What stays unhashed (the row stays partial) - Block predicates with an `nbt` (a lenient SNBT string) or partial `predicates`. - Books with filtered text: Horizon drops the filtered variants on read (a server only sends them with chat filtering), so the hash cannot match. - An id with no registry name. - Never hashable, as vanilla's own client would throw: `creative_slot_lock`, `map_post_processing`, `additional_trade_cost` (no persistent codec), and a direct `painting/variant` or `jukebox_playable` (`RegistryFixedCodec` cannot encode a direct holder). ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `TypedDataComponent.encodeValue`, `HashedPatchMap.create`, `AdventureModePredicate`, `BlockPredicate`, `StatePropertiesPredicate`, `DataComponentExactPredicate`, `ArmorTrim`, `TrimMaterial`, `TrimPattern`, `Instrument`, `BannerPatternLayers`, `BannerPattern` and `RegistryFileCodec`. ## Tests `cargo test -p horizon-protocol --lib item::`: 10 more cases in `components_read_past_hash_as_vanilla_does` / `gameplay_components_hash_as_vanilla_does`, with stream bytes and hashes printed by vanilla 26.3 itself (throwaway Java driver on the real jars, as in the earlier PRs). `fmt` and `clippy -D warnings` on `horizon-protocol`. 🤖 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 05:15:24 +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#5846
No description provided.