[PR #5061] [MERGED] Native mods: follow-ups from the reviews of the block entity and screen hooks #6034

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5061
Author: @Sylviromi
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: native-mod-review-followups


📝 Commits (6)

  • a82bb75 Native mods: follow-ups from the reviews of the block entity and screen hooks
  • 223fc6b Native mods: a mod screen only for the menu its block opens
  • b43e2d1 Native mods: ask the block's container for its menu when a screen opens
  • f3831f7 Consume remote menu click targets
  • c1eb169 Native mods: using an entity forgets the last clicked block
  • d76b3b7 Native mods: a mod screen over a hopper or dispenser menu keeps its layout

📊 Changes

5 files changed (+48 additions, -8 deletions)

View changed files

📝 crates/horizon-client-render/src/hud.rs (+3 -1)
📝 crates/horizon-client/src/game/machines.rs (+4 -0)
📝 crates/horizon-client/src/game/mods.rs (+6 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+28 -4)
📝 crates/horizon-client/src/game/remote.rs (+7 -3)

📄 Description

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

Fixes #5056. The four points left open when #3996–#4289 merged, credited to their reviewers:

  • Mod screen only for the menu its block opens (arismoko on #4106/#4289): open_native_screen opens the mod's screen only when the menu being opened is the one the clicked block's container declares (native_block_entity_container). A chest menu opened later by a command or another mod no longer gets the last clicked machine's screen; clicks and tooltips go through the same spot. (key == target, as suggested, never holds for a mod block: holds knows only vanilla block entities, so it shut every mod screen; the in-game test caught that. The window's world has no mod containers, so the hook is asked on open.)
  • native_screen_tooltip over an empty slot (arismoko on #4289): it now stands back only when the hovered slot has an item, as its doc says, so a mod can show what an input takes.
  • No block entity on a template without one (reservedbytes, DUzzL on #3996): new_block_entity drops the hook's result with a warning when the block's facts say block_entity: false (they're the template's). Before, breaking such a block left the block entity in the save.
  • A GUI texture that doesn't decode is logged (reservedbytes on #4106), with its path, instead of skipped silently.

Hooks unchanged: no new hook, no API bump. The warning lives in game/mods.rs since native_hooks.rs takes no macros (hook_points_stay_hookable).

Tested in the game (offscreen through horizon-ctl, single player) with a native mod whose machine has its own screen on a furnace menu: the screen opens on use, its power and auto-output buttons reach the block entity (native_menu_button), and the machine's output reaches a chest. Not tested yet: a stone-based mod block and an empty-slot tooltip in the game, a dedicated server.

pr_ready (tools/pr_ready.py --quick, against origin/main at 13ce6bcc6, 6 min 40 s)

Check Result
Scope ✅ 4 files, +25 −5
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed
rustfmt ✅
clippy ✅
tests: horizon-client, horizon-client-render ✅ 2047 passed
doc tests ✅
Parity ➖ not run (--quick)

🤖 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/5061 **Author:** [@Sylviromi](https://github.com/Sylviromi) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `native-mod-review-followups` --- ### 📝 Commits (6) - [`a82bb75`](https://github.com/horizon-rust/horizon/commit/a82bb75544cc59926c3f32914f27ce2e60fd2752) Native mods: follow-ups from the reviews of the block entity and screen hooks - [`223fc6b`](https://github.com/horizon-rust/horizon/commit/223fc6b6b6c2e390257b3c9bafc51ee586844f4f) Native mods: a mod screen only for the menu its block opens - [`b43e2d1`](https://github.com/horizon-rust/horizon/commit/b43e2d14930a4e0d9a494779a22c1deaae2b64c2) Native mods: ask the block's container for its menu when a screen opens - [`f3831f7`](https://github.com/horizon-rust/horizon/commit/f3831f70385ef77d7cd2583a685540bfa30dfa41) Consume remote menu click targets - [`c1eb169`](https://github.com/horizon-rust/horizon/commit/c1eb16913a47be4162f067fa43cf9ec76d4a9e72) Native mods: using an entity forgets the last clicked block - [`d76b3b7`](https://github.com/horizon-rust/horizon/commit/d76b3b73436456dc0e70d7839e69de3143f91c57) Native mods: a mod screen over a hopper or dispenser menu keeps its layout ### 📊 Changes **5 files changed** (+48 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/hud.rs` (+3 -1) 📝 `crates/horizon-client/src/game/machines.rs` (+4 -0) 📝 `crates/horizon-client/src/game/mods.rs` (+6 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+28 -4) 📝 `crates/horizon-client/src/game/remote.rs` (+7 -3) </details> ### 📄 Description > 🤖 Opened by Sylviromi's AI agent (Claude Code, Claude Opus 5.5), not by Sylviromi personally. Fixes #5056. The four points left open when #3996–#4289 merged, credited to their reviewers: - **Mod screen only for the menu its block opens** (arismoko on #4106/#4289): `open_native_screen` opens the mod's screen only when the menu being opened is the one the clicked block's container declares (`native_block_entity_container`). A chest menu opened later by a command or another mod no longer gets the last clicked machine's screen; clicks and tooltips go through the same spot. (`key == target`, as suggested, never holds for a mod block: `holds` knows only vanilla block entities, so it shut every mod screen; the in-game test caught that. The window's world has no mod containers, so the hook is asked on open.) - **`native_screen_tooltip` over an empty slot** (arismoko on #4289): it now stands back only when the hovered slot has an item, as its doc says, so a mod can show what an input takes. - **No block entity on a template without one** (reservedbytes, DUzzL on #3996): `new_block_entity` drops the hook's result with a warning when the block's facts say `block_entity: false` (they're the template's). Before, breaking such a block left the block entity in the save. - **A GUI texture that doesn't decode is logged** (reservedbytes on #4106), with its path, instead of skipped silently. Hooks unchanged: no new hook, no API bump. The warning lives in `game/mods.rs` since `native_hooks.rs` takes no macros (`hook_points_stay_hookable`). Tested in the game (offscreen through `horizon-ctl`, single player) with a native mod whose machine has its own screen on a furnace menu: the screen opens on use, its power and auto-output buttons reach the block entity (`native_menu_button`), and the machine's output reaches a chest. Not tested yet: a stone-based mod block and an empty-slot tooltip in the game, a dedicated server. **pr_ready** (`tools/pr_ready.py --quick`, against origin/main at 13ce6bcc6, 6 min 40 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +25 −5 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client, horizon-client-render | ✅ 2047 passed | | doc tests | ✅ | | Parity | ➖ not run (--quick) | 🤖 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:16:46 +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#6034
No description provided.