[PR #4600] [MERGED] Native mods: the player-health HUD rows as a hook point #5722

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

📋 Pull Request Information

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

Base: main ← Head: feat/native-health-hud-hook


📝 Commits (3)

  • 83e8e0b Native mods: the player-health HUD rows as a hook point
  • 31054f5 Merge main into the branch; the hook point is API 21
  • 9a4eb4a Merge hr/main; renumber player-health HUD hook to API 27

📊 Changes

4 files changed (+40 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+11 -2)
📝 crates/horizon-client/src/game/native_hooks.rs (+19 -1)
📝 docs/native-mods.md (+5 -0)
📝 native-hooks.json (+5 -0)

📄 Description

🤖 Opened by JustKarkat's AI agent (ZCode)

What

API 14 adds one hook point, native_health_hud: once a frame the HUD draws the player-health rows
(HealthHud::layout), the hook hears the layout's inputs (HealthInputs) and the screen's GUI size, and a
mod that answers with draws replaces all the rows — armour, hearts, food, air and the heights above the
hotbar — for that frame. Nothing answered draws Horizon's own, unchanged.

pub(super) fn native_health_hud(
    &mut self,
    inputs: &horizon_client::hud_layout::HealthInputs,
    wi: i32,
    hi: i32,
    draws: &mut Option<Vec<horizon_client::hud_layout::GuiDraw>>,
) {}

The call site is the one health_hud.layout call in hud_layers; with no answer it is the same call as
before (the atlas borrow is re-taken after the hook, so the frame is byte-identical for mods that stay
silent). native-hooks.json and docs/native-mods.md carry the entry; NATIVE_HOOKS_API is 14.

Why

The colored hearts HUD mod (the game's coloredHearts extra, closed in #3455 with "a native mod would be a
good home") needs to replace the heart rows with its one tinted row. As a source mixin it cannot get there:
HealthHud::layout, hud_layers and the atlas packing all hold closures (and a ?), which horizon-mixins
0.6 refuses to inject into — every interior seam is rejected with E_UNSUPPORTED_CONTROL_FLOW. The hook
point is the piece the game must lend; the mod's bake (tinted heart sprites into the atlas via the
HudAtlas::slots seam) and its settings page hook fine on their own.

Testing

  • tools/pr_ready.py --quick green: 481 Python tests, rustfmt, clippy -D warnings (workspace), 1085
    horizon-client tests, doc tests.
  • catalog_matches_hook_points and hook_points_stay_hookable pass with the new point (795 lib tests).
  • The parity harnesses are CI's to pick; with no mod installed the hook answers None and the HUD path is
    the vanilla call.

Label: feature (players get a hook point; nothing player-facing changes on its own).


🔄 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/4600 **Author:** [@JustKarkat](https://github.com/JustKarkat) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `feat/native-health-hud-hook` --- ### 📝 Commits (3) - [`83e8e0b`](https://github.com/horizon-rust/horizon/commit/83e8e0ba1f9a88588e514e8d0f63d04efadda74f) Native mods: the player-health HUD rows as a hook point - [`31054f5`](https://github.com/horizon-rust/horizon/commit/31054f520e2258a71440f4e9ea1dd34a5cdca8e5) Merge main into the branch; the hook point is API 21 - [`9a4eb4a`](https://github.com/horizon-rust/horizon/commit/9a4eb4add890f0d3d501c3b2d669d4feb1947fc7) Merge hr/main; renumber player-health HUD hook to API 27 ### 📊 Changes **4 files changed** (+40 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+11 -2) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+19 -1) 📝 `docs/native-mods.md` (+5 -0) 📝 `native-hooks.json` (+5 -0) </details> ### 📄 Description > 🤖 Opened by JustKarkat's AI agent (ZCode) ## What API 14 adds one hook point, `native_health_hud`: once a frame the HUD draws the player-health rows (`HealthHud::layout`), the hook hears the layout's inputs (`HealthInputs`) and the screen's GUI size, and a mod that answers with draws replaces **all** the rows — armour, hearts, food, air and the heights above the hotbar — for that frame. Nothing answered draws Horizon's own, unchanged. ```rust pub(super) fn native_health_hud( &mut self, inputs: &horizon_client::hud_layout::HealthInputs, wi: i32, hi: i32, draws: &mut Option<Vec<horizon_client::hud_layout::GuiDraw>>, ) {} ``` The call site is the one `health_hud.layout` call in `hud_layers`; with no answer it is the same call as before (the atlas borrow is re-taken after the hook, so the frame is byte-identical for mods that stay silent). `native-hooks.json` and `docs/native-mods.md` carry the entry; `NATIVE_HOOKS_API` is 14. ## Why The colored hearts HUD mod (the game's `coloredHearts` extra, closed in #3455 with "a native mod would be a good home") needs to replace the heart rows with its one tinted row. As a source mixin it cannot get there: `HealthHud::layout`, `hud_layers` and the atlas packing all hold closures (and a `?`), which horizon-mixins 0.6 refuses to inject into — every interior seam is rejected with `E_UNSUPPORTED_CONTROL_FLOW`. The hook point is the piece the game must lend; the mod's bake (tinted heart sprites into the atlas via the `HudAtlas::slots` seam) and its settings page hook fine on their own. ## Testing - `tools/pr_ready.py --quick` green: 481 Python tests, rustfmt, clippy `-D warnings` (workspace), 1085 horizon-client tests, doc tests. - `catalog_matches_hook_points` and `hook_points_stay_hookable` pass with the new point (795 lib tests). - The parity harnesses are CI's to pick; with no mod installed the hook answers `None` and the HUD path is the vanilla call. Label: `feature` (players get a hook point; nothing player-facing changes on its own). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:33 +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#5722
No description provided.