[PR #5485] [MERGED] Allow server hooks to query block and item tags #6319

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

📋 Pull Request Information

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

Base: main ← Head: server-hook-tags


📝 Commits (2)

  • 3740c97 Allow server hooks to query tags
  • 0dc6e9e Preserve tick-context tag helpers

📊 Changes

5 files changed (+56 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+1 -1)
📝 crates/horizon-client/src/game/native_world_read.rs (+46 -7)
📝 docs/native-mods.md (+1 -1)
➕ tools/native-hook-fragments/server_tag_reads.json (+6 -0)

📄 Description

🤖 Opened by Aria's agent swarm, Dyna, not by Aria.

Fixes #5459.

Change

Add native_server_block_in_tag and native_server_item_in_tag for server-side hooks without a tick context. Reuse the immutable execution role to reject client calls. The server world lock is installed after its merged content tables are built; return TagsUnavailable before that point. The original API 28 helpers keep their signatures and tick-context check, then delegate to the new helpers. Loaded-block reads keep their existing tick-context gate.

Vanilla loads data packs and tags before the server starts; Horizon’s early startup hook fires sooner. This ordering gap is not changed here.

In-game proof

Built 0dc6e9e28 on arch with a throwaway branch of https://github.com/arismoko/horizon-machine-sample, the recommended end-to-end native-mod test route. On both the integrated server thread and a dedicated server, native_server_about_to_start returned TagsUnavailable for both new helpers. A server tick hook called both original helpers with its tick context and got true for oak logs. An item entity join hook called both new helpers:

Integrated server thread:
TAG_STARTUP block=Err(TagsUnavailable) item=Err(TagsUnavailable)
TAG_LEGACY block=Ok(true) item=Ok(true)
TAG_PROOF block=Ok(true) block_nonmember=Ok(false) block_missing=Ok(false) item=Ok(true) item_nonmember=Ok(false) item_missing=Ok(false)

Dedicated server:
TAG_STARTUP block=Err(TagsUnavailable) item=Err(TagsUnavailable)
TAG_LEGACY block=Ok(true) item=Ok(true)
TAG_PROOF block=Ok(true) block_nonmember=Ok(false) block_missing=Ok(false) item=Ok(true) item_nonmember=Ok(false) item_missing=Ok(false)

Checks

pr_ready (tools/pr_ready.py --base 13e02505624fb200a76c938b948dceb45e36ded6 on arch, against 13e0250562 at 13e025056, 1 min 26 s)

Check Result
Scope ✅ 5 files, +56 −10
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 508 passed (43 s)
rustfmt ✅ (8 s)
clippy ✅ (19 s)
tests: horizon-client ✅ 1566 passed (13 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Dyna.


🔄 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/5485 **Author:** [@arismoko](https://github.com/arismoko) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `server-hook-tags` --- ### 📝 Commits (2) - [`3740c97`](https://github.com/horizon-rust/horizon/commit/3740c979e4d4fe338f91189b14ce539cfee5c5be) Allow server hooks to query tags - [`0dc6e9e`](https://github.com/horizon-rust/horizon/commit/0dc6e9e28112cde7813a0829ab82ffc378f632a7) Preserve tick-context tag helpers ### 📊 Changes **5 files changed** (+56 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+1 -1) 📝 `crates/horizon-client/src/game/native_world_read.rs` (+46 -7) 📝 `docs/native-mods.md` (+1 -1) ➕ `tools/native-hook-fragments/server_tag_reads.json` (+6 -0) </details> ### 📄 Description > 🤖 Opened by Aria's agent swarm, Dyna, not by Aria. Fixes #5459. ## Change Add `native_server_block_in_tag` and `native_server_item_in_tag` for server-side hooks without a tick context. Reuse the immutable execution role to reject client calls. The server world lock is installed after its merged content tables are built; return `TagsUnavailable` before that point. The original API 28 helpers keep their signatures and tick-context check, then delegate to the new helpers. Loaded-block reads keep their existing tick-context gate. Vanilla loads data packs and tags before the server starts; Horizon’s early startup hook fires sooner. This ordering gap is not changed here. ## In-game proof Built `0dc6e9e28` on arch with a throwaway branch of https://github.com/arismoko/horizon-machine-sample, the recommended end-to-end native-mod test route. On both the integrated server thread and a dedicated server, `native_server_about_to_start` returned `TagsUnavailable` for both new helpers. A server tick hook called both original helpers with its tick context and got true for oak logs. An item entity join hook called both new helpers: ```text Integrated server thread: TAG_STARTUP block=Err(TagsUnavailable) item=Err(TagsUnavailable) TAG_LEGACY block=Ok(true) item=Ok(true) TAG_PROOF block=Ok(true) block_nonmember=Ok(false) block_missing=Ok(false) item=Ok(true) item_nonmember=Ok(false) item_missing=Ok(false) Dedicated server: TAG_STARTUP block=Err(TagsUnavailable) item=Err(TagsUnavailable) TAG_LEGACY block=Ok(true) item=Ok(true) TAG_PROOF block=Ok(true) block_nonmember=Ok(false) block_missing=Ok(false) item=Ok(true) item_nonmember=Ok(false) item_missing=Ok(false) ``` ## Checks **pr_ready** (`tools/pr_ready.py --base 13e02505624fb200a76c938b948dceb45e36ded6` on arch, against 13e02505624fb200a76c938b948dceb45e36ded6 at 13e025056, 1 min 26 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +56 −10 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 508 passed (43 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (19 s) | | tests: horizon-client | ✅ 1566 passed (13 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with Dyna. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:18:13 +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#6319
No description provided.