[PR #7583] Native mods: living_incoming_damage gets the attacker, weapon and hit geometry (one hook) #7694

Open
opened 2026-11-03 07:22:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7583
Author: @Xmilon
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: native/damage-host


📝 Commits (10+)

  • f9878f7 WIP: preserve knockback v1 and add attacker-aware v2
  • fcae9b7 feat(mods): add host-aware weapon damage hook v2
  • d589852 fix(mods): read the acting player entity id
  • a4da920 Complete attacker-aware knockback v2 and regression coverage
  • df19991 Merge upstream/main
  • 1434fb3 Merge upstream/main
  • f7ec51c Format fireworks.rs
  • ed0f651 Native mods: no macro in the hook points (hook_points_stay_hookable)
  • 9441881 Native mods: living_knockback_v2 hands over the attacker's held items; clippy allow for the macro-free armor stand test
  • 964c882 Merge upstream/main

📊 Changes

12 files changed (+513 additions, -15 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+23 -3)
📝 crates/horizon-client/src/game/fireworks.rs (+5 -0)
📝 crates/horizon-client/src/game/lan_pvp.rs (+6 -0)
📝 crates/horizon-client/src/game/mace.rs (+23 -4)
📝 crates/horizon-client/src/game/native_hooks.rs (+107 -1)
📝 crates/horizon-client/src/game/spear.rs (+1 -0)
📝 crates/horizon-client/src/health.rs (+67 -5)
📝 crates/horizon-client/src/mod_api/generated.rs (+36 -1)
📝 docs/native-mods.md (+13 -1)
➕ tests/test_living_knockback_hook.py (+142 -0)
📝 xtask/src/mod_api.rs (+89 -0)

📄 Description

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

Closes #7487.

Depends on #7582 (the attack scope that records who attacks and what they hold); until that merges, this PR also shows its commits.

One hook, not two. living_incoming_damage (API 50) now gets attacker, weapon (a player's selected stack, a mob's main hand, with its enchantment levels), source_position, and a mob victim's victim_position and victim_view, so an enchantment can tell a blow from behind and change amount. It fires for every hit as before, and the extra data is there wherever the game knows it (positions are none for a player or the dragon as victim). The earlier living_incoming_damage_v2, its fragment and the mace-only dispatch are gone. With no mod loaded the bridge returns first, so nothing is computed.

Breaking, on purpose: the function gains arguments, so a mixin injection naming native_living_incoming_damage as a raw target must take them. No Host: the game is in the middle of the hit, so a mod reads the world from a tick hook; the host-aware v2 gave that up when folded.

Local: cargo clippy -p horizon-client --lib --tests -- -D warnings, cargo test -p xtask and the stamp tests pass; xtask mod-api --check clean. Not run in game since the fold.

Written by an AI agent (Claude Code, Claude Sonnet 5.5) for Xmilon


🔄 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/7583 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `native/damage-host` --- ### 📝 Commits (10+) - [`f9878f7`](https://github.com/horizon-rust/horizon/commit/f9878f7046bb4227de53169afda122f3bc8a6d6d) WIP: preserve knockback v1 and add attacker-aware v2 - [`fcae9b7`](https://github.com/horizon-rust/horizon/commit/fcae9b7c434d2a753aff1143f0f236c2f8ac9db5) feat(mods): add host-aware weapon damage hook v2 - [`d589852`](https://github.com/horizon-rust/horizon/commit/d589852c195aead36e61692e4aaee47982a2fc36) fix(mods): read the acting player entity id - [`a4da920`](https://github.com/horizon-rust/horizon/commit/a4da92003c5abd07183508a978ecaf9cb970ba18) Complete attacker-aware knockback v2 and regression coverage - [`df19991`](https://github.com/horizon-rust/horizon/commit/df19991b9fc40dc95679d3f67c2066430d0db123) Merge upstream/main - [`1434fb3`](https://github.com/horizon-rust/horizon/commit/1434fb3cc37aa841893fd4998029918c02430499) Merge upstream/main - [`f7ec51c`](https://github.com/horizon-rust/horizon/commit/f7ec51cff3d37a96b4428d78070ea6521fb4acc5) Format fireworks.rs - [`ed0f651`](https://github.com/horizon-rust/horizon/commit/ed0f651c6acbb3ef29a02bb01ef5e7e8569eab07) Native mods: no macro in the hook points (hook_points_stay_hookable) - [`9441881`](https://github.com/horizon-rust/horizon/commit/9441881bd8f7471e995726fdb93c20b7db9c0a9e) Native mods: living_knockback_v2 hands over the attacker's held items; clippy allow for the macro-free armor stand test - [`964c882`](https://github.com/horizon-rust/horizon/commit/964c882608a8bd23e1aae37dfc521e5aae261900) Merge upstream/main ### 📊 Changes **12 files changed** (+513 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+23 -3) 📝 `crates/horizon-client/src/game/fireworks.rs` (+5 -0) 📝 `crates/horizon-client/src/game/lan_pvp.rs` (+6 -0) 📝 `crates/horizon-client/src/game/mace.rs` (+23 -4) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+107 -1) 📝 `crates/horizon-client/src/game/spear.rs` (+1 -0) 📝 `crates/horizon-client/src/health.rs` (+67 -5) 📝 `crates/horizon-client/src/mod_api/generated.rs` (+36 -1) 📝 `docs/native-mods.md` (+13 -1) ➕ `tests/test_living_knockback_hook.py` (+142 -0) 📝 `xtask/src/mod_api.rs` (+89 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Claude Code, Claude Sonnet 5.5), not by Xmilon personally. Closes #7487. **Depends on #7582** (the attack scope that records who attacks and what they hold); until that merges, this PR also shows its commits. One hook, not two. `living_incoming_damage` (API 50) now gets `attacker`, `weapon` (a player's selected stack, a mob's main hand, with its enchantment levels), `source_position`, and a mob victim's `victim_position` and `victim_view`, so an enchantment can tell a blow from behind and change `amount`. It fires for every hit as before, and the extra data is there wherever the game knows it (positions are none for a player or the dragon as victim). The earlier `living_incoming_damage_v2`, its fragment and the mace-only dispatch are gone. With no mod loaded the bridge returns first, so nothing is computed. **Breaking, on purpose:** the function gains arguments, so a mixin injection naming `native_living_incoming_damage` as a raw target must take them. **No `Host`:** the game is in the middle of the hit, so a mod reads the world from a tick hook; the host-aware v2 gave that up when folded. Local: `cargo clippy -p horizon-client --lib --tests -- -D warnings`, `cargo test -p xtask` and the stamp tests pass; `xtask mod-api --check` clean. Not run in game since the fold. Written by an AI agent (Claude Code, Claude Sonnet 5.5) for Xmilon --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7694
No description provided.