[PR #6581] [MERGED] Native mods: native_state_block names a state's block #6962

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

📋 Pull Request Information

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

Base: main ← Head: feat/native-state-block


📝 Commits (1)

  • 989eb8a Native mods: native_state_block names the block a state belongs to

📊 Changes

3 files changed (+21 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/native_block_entity_draw.rs (+5 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+10 -1)
➕ tools/native-hook-fragments/state_block.json (+6 -0)

📄 Description

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

Fixes #6564

native_state_for_placement is asked for every block placed and gets the block's default state, but no helper said which block a state belongs to. native_state_block(state) -> Option<&str> (BlockState.getBlock()'s name, registry.state(state)?.name) is added on GameLevel, where the hook runs, and on Game for the hooks that get a state in the world. The doc of native_state_for_placement points to it. A helper-only fragment (tools/native-hook-fragments/state_block.json) takes the API number.

No new test: it is one registry lookup, like native_block_state_property beside it. cargo test -p horizon-client --lib native_hooks, clippy.

🤖 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/6581 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/native-state-block` --- ### 📝 Commits (1) - [`989eb8a`](https://github.com/horizon-rust/horizon/commit/989eb8a0be1abcec414479f23cfedc98f17b3662) Native mods: native_state_block names the block a state belongs to ### 📊 Changes **3 files changed** (+21 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/native_block_entity_draw.rs` (+5 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+10 -1) ➕ `tools/native-hook-fragments/state_block.json` (+6 -0) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Fixes #6564 `native_state_for_placement` is asked for every block placed and gets the block's default state, but no helper said which block a state belongs to. `native_state_block(state) -> Option<&str>` (`BlockState.getBlock()`'s name, `registry.state(state)?.name`) is added on `GameLevel`, where the hook runs, and on `Game` for the hooks that get a state in the world. The doc of `native_state_for_placement` points to it. A helper-only fragment (`tools/native-hook-fragments/state_block.json`) takes the API number. No new test: it is one registry lookup, like `native_block_state_property` beside it. `cargo test -p horizon-client --lib native_hooks`, clippy. 🤖 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:30:22 +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#6962
No description provided.