[PR #7221] [MERGED] Native mods: living entities healing, falling, jumping and drowning (LivingHeal, LivingFall, LivingJump, LivingDrown) #7421

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

📋 Pull Request Information

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

Base: main ← Head: v2/ses_01M6DYB8QYSC38EEXTNNJRQ8T4-body


📝 Commits (10+)

  • 0aec32b Add living heal native hook for player effects
  • 9a73f61 Wire living heal hook for wither skull owners
  • c53153e Add living fall hook to player landing
  • fee348a Wire living fall hook for mobs
  • 35a2de6 Add living jump hook for players
  • af2107e Wire living jump hook for mobs and mounts
  • f8e9931 Add living drown hook for players
  • 2e62498 Wire living drown hook for mobs
  • 4c16d77 Living hooks: register fall and jump targets, keep a canceled fall's block landing, share the drowning step
  • b72715e Route more living heals through native hook

📊 Changes

31 files changed (+529 additions, -49 deletions)

View changed files

📝 crates/horizon-client/src/breathing.rs (+54 -0)
📝 crates/horizon-client/src/entry.rs (+27 -0)
📝 crates/horizon-client/src/game/creatures.rs (+3 -3)
📝 crates/horizon-client/src/game/llamas.rs (+1 -1)
📝 crates/horizon-client/src/game/mounts.rs (+1 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+12 -0)
📝 crates/horizon-client/src/game/nautili.rs (+1 -1)
📝 crates/horizon-client/src/game/potions.rs (+20 -5)
📝 crates/horizon-client/src/game/wither.rs (+1 -1)
📝 crates/horizon-client/src/hunger.rs (+28 -11)
📝 crates/horizon-client/src/landing.rs (+33 -0)
📝 crates/horizon-client/src/menu.rs (+4 -0)
📝 crates/horizon-client/src/mobs.rs (+9 -1)
📝 crates/horizon-client/src/mobs/ai.rs (+6 -6)
📝 crates/horizon-client/src/mobs/allay.rs (+1 -1)
📝 crates/horizon-client/src/mobs/camel.rs (+1 -0)
📝 crates/horizon-client/src/mobs/equine.rs (+2 -1)
📝 crates/horizon-client/src/mobs/happy_ghast.rs (+1 -1)
📝 crates/horizon-client/src/mobs/living.rs (+23 -2)
📝 crates/horizon-client/src/mobs/llama.rs (+1 -1)

...and 11 more files

📄 Description

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

Adds four living-entity hooks: heal, fall, jump and drown. Each one fires where vanilla 26.3 posts its NeoForge counterpart.

Part of #4953.

Hook NeoForge 26.3 Side Contract
native_living_heal(entity, amount, cancel) LivingHealEvent both cancel, amount changeable
native_living_fall(entity, kind, distance, multiplier, cancel) LivingFallEvent both cancel, distance and multiplier changeable
native_living_jump(entity, kind) LivingEvent.LivingJumpEvent both listen
native_living_drown(entity, kind, is_drowning, damage_amount, bubble_count, cancel) LivingDrownEvent server cancel, drowning and damage changeable

What it does

  • Heal fires in LivingEntity.heal:

    • for the player: natural regeneration and food healing, and instant health;
    • for mobs: the new Mob::heal.

    Mobs used to add to health directly in a dozen places: regeneration, instant health (potion, splash, area cloud), witch healing, horse and llama regeneration, allay, happy ghast, wither, nautilus food and the wither skull kill. Those now call Mob::heal, which fires the hook, and like vanilla's heal it does nothing for a dead mob. Most of this PR's lines are those call sites.

  • Fall fires at the start of causeFallDamage, for the player and for mobs. A cancelled fall still lands on the block (Block.fallOn), with the distance before the mods changed it, as in vanilla.

    • Horses, donkeys, mules and llamas don't fire it. AbstractHorse.causeFallDamage overrides LivingEntity.causeFallDamage, where the event is posted, and doesn't call it.
  • Jump fires after jumpFromGround, for the player and for mobs. That includes the paths that jump their own way: rabbits, slimes and magma cubes, camel dashes, and ridden horses.

  • Drown fires in LivingEntity.baseTick once an entity that can't breathe has no air left, on the server only, for the player and for mobs. The defaults are vanilla's answers: drowning at -20 air, 2 damage and 8 bubbles. A mod may cancel, start or stop the drowning, or change the damage. bubble_count is read-only. The 8 bubbles come from vanilla's entity event 67, and no vanilla packet carries a different count, so a changed count could only be imitated.

  • Anticheat replays. A dedicated server replays a player's move on a throwaway copy to check it. Fall and jump are decided during the move, so the replay would ask the mods a second time. A flag set only while MotionWorld::replayed_tick runs skips those two hooks there, and the move the server keeps fires them once.

Overlap with #7005

#7005's player_jump covers the player's part of native_living_jump. Should the player-only hook stay alongside this one, or should one of them give way? Happy to fold either into the other.

Size

570 lines of code, over the 500 guideline. These are four hooks of one NeoForge family, and most of the lines are the heal call sites switching to Mob::heal.

Tests

  • cargo run -p xtask -- mod-api regenerated the API, and the hook table in menu.rs's tests gained the four hooks.
  • The native-hook stamp tests pass on this head.

Tested in game

The route was a throwaway branch of horizon-machine-sample's trait-API example. The latest run was on 31f835842d, which merged this branch with the item-expire branch, since merged as #7197, from before the latest merge of main. It didn't run this branch alone.

Single-player server thread:

Hook Result
Heal a cancelled instant heal kept health at 12; a doubled one took it from 12 to 20
Fall a cancelled 8-block fall kept health at 20; a doubled multiplier took it from 20 to 10
Jump fired
Drown a cancelled drowning kept health at 20 underwater

Dedicated server, with a connected client: a trace showed one callback for one player jump and one for one 8-block fall, both from the tick the server keeps, not from the replay. An earlier merge of the same branches also ran heal, fall, jump and drown on a dedicated server.

pr_ready

pr_ready (tools/pr_ready.py --quick --base fd57b867944179eb0c9d7bfe8e4f83653103f98a on 5cb5a44b1c95, against fd57b86794 at fd57b8679, 9 min 14 s)

Check Result
Scope ⚠️ 31 files, +529 −49; 570 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (43 s)
rustfmt ✅ (10 s)
clippy ✅ (28 s)
tests: horizon-client, horizon-client-lib ✅ 2117 passed (7 min 23 s)
doc tests ✅ 0 passed (3 s)
content root tests ➖ content root untouched
mod API up to date ✅ (23 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 375 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute and 363 more
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/7221 **Author:** [@arismoko](https://github.com/arismoko) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `v2/ses_01M6DYB8QYSC38EEXTNNJRQ8T4-body` --- ### 📝 Commits (10+) - [`0aec32b`](https://github.com/horizon-rust/horizon/commit/0aec32bd0507c740ea0e538f631d7d453e8864b6) Add living heal native hook for player effects - [`9a73f61`](https://github.com/horizon-rust/horizon/commit/9a73f6109bdcd164a53bfc3dec7d846de08b58ae) Wire living heal hook for wither skull owners - [`c53153e`](https://github.com/horizon-rust/horizon/commit/c53153e201be94dd9548b840a6315fd60af5dba8) Add living fall hook to player landing - [`fee348a`](https://github.com/horizon-rust/horizon/commit/fee348a1384c7745c2d8c461bcc43e63c70ebe76) Wire living fall hook for mobs - [`35a2de6`](https://github.com/horizon-rust/horizon/commit/35a2de6b0225f53222007f8f9fb94b43bfd9e8ba) Add living jump hook for players - [`af2107e`](https://github.com/horizon-rust/horizon/commit/af2107ee2fc147beed2d35273d34cccf9e68e2e9) Wire living jump hook for mobs and mounts - [`f8e9931`](https://github.com/horizon-rust/horizon/commit/f8e9931ceed751fc71e41ad71a9ecc733899b442) Add living drown hook for players - [`2e62498`](https://github.com/horizon-rust/horizon/commit/2e624980065480fc8133cbe0d97243df3f030b24) Wire living drown hook for mobs - [`4c16d77`](https://github.com/horizon-rust/horizon/commit/4c16d77c78d106d9fd6b81c1d6d5d5b2cdec4fbf) Living hooks: register fall and jump targets, keep a canceled fall's block landing, share the drowning step - [`b72715e`](https://github.com/horizon-rust/horizon/commit/b72715ee4f3a00a5653ced9004888e28240828b0) Route more living heals through native hook ### 📊 Changes **31 files changed** (+529 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/breathing.rs` (+54 -0) 📝 `crates/horizon-client/src/entry.rs` (+27 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+3 -3) 📝 `crates/horizon-client/src/game/llamas.rs` (+1 -1) 📝 `crates/horizon-client/src/game/mounts.rs` (+1 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+12 -0) 📝 `crates/horizon-client/src/game/nautili.rs` (+1 -1) 📝 `crates/horizon-client/src/game/potions.rs` (+20 -5) 📝 `crates/horizon-client/src/game/wither.rs` (+1 -1) 📝 `crates/horizon-client/src/hunger.rs` (+28 -11) 📝 `crates/horizon-client/src/landing.rs` (+33 -0) 📝 `crates/horizon-client/src/menu.rs` (+4 -0) 📝 `crates/horizon-client/src/mobs.rs` (+9 -1) 📝 `crates/horizon-client/src/mobs/ai.rs` (+6 -6) 📝 `crates/horizon-client/src/mobs/allay.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/camel.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/equine.rs` (+2 -1) 📝 `crates/horizon-client/src/mobs/happy_ghast.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/living.rs` (+23 -2) 📝 `crates/horizon-client/src/mobs/llama.rs` (+1 -1) _...and 11 more files_ </details> ### 📄 Description > 🤖 Opened by Aria's agent swarm, Dyna, not by Aria. Adds four living-entity hooks: heal, fall, jump and drown. Each one fires where vanilla 26.3 posts its NeoForge counterpart. Part of #4953. | Hook | NeoForge 26.3 | Side | Contract | | --- | --- | --- | --- | | `native_living_heal(entity, amount, cancel)` | `LivingHealEvent` | both | cancel, `amount` changeable | | `native_living_fall(entity, kind, distance, multiplier, cancel)` | `LivingFallEvent` | both | cancel, `distance` and `multiplier` changeable | | `native_living_jump(entity, kind)` | `LivingEvent.LivingJumpEvent` | both | listen | | `native_living_drown(entity, kind, is_drowning, damage_amount, bubble_count, cancel)` | `LivingDrownEvent` | server | cancel, drowning and damage changeable | ## What it does - **Heal** fires in `LivingEntity.heal`: - for the player: natural regeneration and food healing, and instant health; - for mobs: the new `Mob::heal`. Mobs used to add to `health` directly in a dozen places: regeneration, instant health (potion, splash, area cloud), witch healing, horse and llama regeneration, allay, happy ghast, wither, nautilus food and the wither skull kill. Those now call `Mob::heal`, which fires the hook, and like vanilla's `heal` it does nothing for a dead mob. Most of this PR's lines are those call sites. - **Fall** fires at the start of `causeFallDamage`, for the player and for mobs. A cancelled fall still lands on the block (`Block.fallOn`), with the distance before the mods changed it, as in vanilla. - Horses, donkeys, mules and llamas don't fire it. `AbstractHorse.causeFallDamage` overrides `LivingEntity.causeFallDamage`, where the event is posted, and doesn't call it. - **Jump** fires after `jumpFromGround`, for the player and for mobs. That includes the paths that jump their own way: rabbits, slimes and magma cubes, camel dashes, and ridden horses. - **Drown** fires in `LivingEntity.baseTick` once an entity that can't breathe has no air left, on the server only, for the player and for mobs. The defaults are vanilla's answers: drowning at -20 air, 2 damage and 8 bubbles. A mod may cancel, start or stop the drowning, or change the damage. `bubble_count` is read-only. The 8 bubbles come from vanilla's entity event 67, and no vanilla packet carries a different count, so a changed count could only be imitated. - **Anticheat replays.** A dedicated server replays a player's move on a throwaway copy to check it. Fall and jump are decided during the move, so the replay would ask the mods a second time. A flag set only while `MotionWorld::replayed_tick` runs skips those two hooks there, and the move the server keeps fires them once. ## Overlap with #7005 #7005's `player_jump` covers the player's part of `native_living_jump`. Should the player-only hook stay alongside this one, or should one of them give way? Happy to fold either into the other. ## Size 570 lines of code, over the 500 guideline. These are four hooks of one NeoForge family, and most of the lines are the heal call sites switching to `Mob::heal`. ## Tests - `cargo run -p xtask -- mod-api` regenerated the API, and the hook table in `menu.rs`'s tests gained the four hooks. - The native-hook stamp tests pass on this head. ## Tested in game The route was a throwaway branch of [horizon-machine-sample](https://github.com/arismoko/horizon-machine-sample)'s trait-API example. The latest run was on 31f835842d, which merged this branch with the item-expire branch, since merged as #7197, from before the latest merge of main. It didn't run this branch alone. **Single-player server thread:** | Hook | Result | | --- | --- | | Heal | a cancelled instant heal kept health at 12; a doubled one took it from 12 to 20 | | Fall | a cancelled 8-block fall kept health at 20; a doubled multiplier took it from 20 to 10 | | Jump | fired | | Drown | a cancelled drowning kept health at 20 underwater | **Dedicated server, with a connected client:** a trace showed one callback for one player jump and one for one 8-block fall, both from the tick the server keeps, not from the replay. An earlier merge of the same branches also ran heal, fall, jump and drown on a dedicated server. ## pr_ready **pr_ready** (`tools/pr_ready.py --quick --base fd57b867944179eb0c9d7bfe8e4f83653103f98a` on 5cb5a44b1c95, against fd57b867944179eb0c9d7bfe8e4f83653103f98a at fd57b8679, 9 min 14 s) | Check | Result | | --- | --- | | Scope | ⚠️ 31 files, +529 −49; 570 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (43 s) | | rustfmt | ✅ (10 s) | | clippy | ✅ (28 s) | | tests: horizon-client, horizon-client-lib | ✅ 2117 passed (7 min 23 s) | | doc tests | ✅ 0 passed (3 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (23 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 375 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute and 363 more | | 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:39:17 +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#7421
No description provided.