[PR #5571] [MERGED] Native mods: screen_render_post, draw over the open screen (API next) #6360

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

📋 Pull Request Information

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

Base: main ← Head: screen-render-post


📝 Commits (7)

  • 3e5b8b3 Native mods: draw over the open screen
  • dfcc1eb Native mods: the screen hook's payload, and a view that does not allocate
  • dc6b189 Native mods: the screen view's rect is the drawn window; menu None when unknown
  • ccb1474 Native mods: a server's trading window gives the screen view its title
  • cfa8e57 Merge main into #5571 (both new tests)
  • 29761e3 Merge main into #5571 (the hook, then main's split-screen HUD)
  • 6ac25bb Merge remote-tracking branch 'origin/main' into n5571

📊 Changes

6 files changed (+291 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+154 -0)
📝 crates/horizon-client/src/game/mount_menu.rs (+10 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+102 -0)
📝 crates/horizon-client/src/game/remote.rs (+8 -2)
📝 crates/horizon-client/src/game/stations.rs (+9 -0)
➕ tools/native-hook-fragments/screen_render_post.json (+8 -0)

📄 Description

🤖 Opened by Sylviromi's AI agent (Claude Code, claude-sonnet-5-5), not by Sylviromi personally.

What and why

Part of #5543 (1 of 4: drawing; mouse, scroll and keys follow).

Adds the hook native_screen_render_post(&self, batch, screen: &NativeScreenView) (NeoForge's ScreenEvent.Render.Post): a native mod can draw over the open screen. It fires once per frame after the screen's drawing and tooltips (hud_layers), also on the Win and Options paths, and not while playing.

NativeScreenView { id, menu, title, rect, slots, mouse, partial_tick }:

  • id is one per Screen variant (Screen::id, test screen_ids_are_distinct_and_stable). Every container, station and mod window reports inventory and is told apart by menu (the server-opened menu type id), title and slots.
  • rect is the window the game draws (same container image; merchant and beacon are wider).
  • No allocation per frame: slot_count is checked against slots() in debug builds.

Never fires: the title screen, and prompts drawn after the screen (pack, link, dialog, code of conduct, books, signs). This is documented on the hook. The vanilla frame is unchanged without a mod. API number: next (pending fragment tools/native-hook-fragments/screen_render_post.json).

In-game proof: a test native mod hooked it and drew a bar along rect with its id. In game, the bar sat on the player inventory panel (id inventory, slots 46), on a chest window (id inventory, slots 63, menu generic_9x3), and across the whole window on the pause menu (id paused). The script computed PASS. No screenshots attached.

Note for maintainers, unrelated to this PR: on current main python3 tools/stamp_native_hooks.py stops with "invalid comment path: docs/native-mods.md". The already-merged tools/native-hook-fragments/server_tag_reads.json lists docs/native-mods.md in its "comments", which the tool rejects. Found during a local stamp dry run.

Label: feature

Kind

  • feature: something new for players (listed under New in the release notes)

Vanilla reference

NeoForge ScreenEvent.Render.Post. Horizon-only hook point; the vanilla frame is unchanged with no mod installed. No parity harness covers it.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on boilingpoint, against origin/main at d55bb43ab, 3 min 16 s)

Check Result
Scope ✅ 5 files, +283 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 510 passed (42 s)
rustfmt ✅ (9 s)
clippy ✅ (2 min 2 s)
tests: horizon-client ✅ 1577 passed (22 s)
doc tests ✅ 0 passed (1 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 (--quick): 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 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/5571 **Author:** [@Sylviromi](https://github.com/Sylviromi) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `screen-render-post` --- ### 📝 Commits (7) - [`3e5b8b3`](https://github.com/horizon-rust/horizon/commit/3e5b8b3eccd566086d799d137b79342b16f70486) Native mods: draw over the open screen - [`dfcc1eb`](https://github.com/horizon-rust/horizon/commit/dfcc1eb4dc204d6dcfc491b63706a25105647aef) Native mods: the screen hook's payload, and a view that does not allocate - [`dc6b189`](https://github.com/horizon-rust/horizon/commit/dc6b1897681452169d29edf6e233e1b1742c6098) Native mods: the screen view's rect is the drawn window; menu None when unknown - [`ccb1474`](https://github.com/horizon-rust/horizon/commit/ccb1474a03a06f1609578feaf9224f6f16a0fd69) Native mods: a server's trading window gives the screen view its title - [`cfa8e57`](https://github.com/horizon-rust/horizon/commit/cfa8e5712595cb837b6c76fe8b4e8aab11c2a77d) Merge main into #5571 (both new tests) - [`29761e3`](https://github.com/horizon-rust/horizon/commit/29761e3803fcffa3f67fb15192a540a7ebb398d4) Merge main into #5571 (the hook, then main's split-screen HUD) - [`6ac25bb`](https://github.com/horizon-rust/horizon/commit/6ac25bbc02635da1378651472e68dfb9cc59d204) Merge remote-tracking branch 'origin/main' into n5571 ### 📊 Changes **6 files changed** (+291 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+154 -0) 📝 `crates/horizon-client/src/game/mount_menu.rs` (+10 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+102 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+8 -2) 📝 `crates/horizon-client/src/game/stations.rs` (+9 -0) ➕ `tools/native-hook-fragments/screen_render_post.json` (+8 -0) </details> ### 📄 Description > 🤖 Opened by Sylviromi's AI agent (Claude Code, claude-sonnet-5-5), not by Sylviromi personally. ## What and why Part of #5543 (1 of 4: drawing; mouse, scroll and keys follow). Adds the hook `native_screen_render_post(&self, batch, screen: &NativeScreenView)` (NeoForge's `ScreenEvent.Render.Post`): a native mod can draw over the open screen. It fires once per frame after the screen's drawing and tooltips (`hud_layers`), also on the Win and Options paths, and not while playing. `NativeScreenView { id, menu, title, rect, slots, mouse, partial_tick }`: - `id` is one per `Screen` variant (`Screen::id`, test `screen_ids_are_distinct_and_stable`). Every container, station and mod window reports `inventory` and is told apart by `menu` (the server-opened menu type id), `title` and `slots`. - `rect` is the window the game draws (same container image; merchant and beacon are wider). - No allocation per frame: `slot_count` is checked against `slots()` in debug builds. Never fires: the title screen, and prompts drawn after the screen (pack, link, dialog, code of conduct, books, signs). This is documented on the hook. The vanilla frame is unchanged without a mod. API number: next (pending fragment `tools/native-hook-fragments/screen_render_post.json`). In-game proof: a test native mod hooked it and drew a bar along `rect` with its id. In game, the bar sat on the player inventory panel (id `inventory`, slots 46), on a chest window (id `inventory`, slots 63, menu `generic_9x3`), and across the whole window on the pause menu (id `paused`). The script computed PASS. No screenshots attached. Note for maintainers, unrelated to this PR: on current main `python3 tools/stamp_native_hooks.py` stops with "invalid comment path: docs/native-mods.md". The already-merged `tools/native-hook-fragments/server_tag_reads.json` lists `docs/native-mods.md` in its "comments", which the tool rejects. Found during a local stamp dry run. Label: feature ## Kind - [x] feature: something new for players (listed under New in the release notes) ## Vanilla reference NeoForge `ScreenEvent.Render.Post`. Horizon-only hook point; the vanilla frame is unchanged with no mod installed. No parity harness covers it. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on boilingpoint, against origin/main at d55bb43ab, 3 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +283 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 510 passed (42 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 min 2 s) | | tests: horizon-client | ✅ 1577 passed (22 s) | | doc tests | ✅ 0 passed (1 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 (--quick): 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 [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:19:12 +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#6360
No description provided.