[GH-ISSUE #6444] Native mods: living_knockback runs after knockback resistance and doesn't see the attacker #2093

Open
opened 2026-11-02 15:52:00 +07:00 by bsakaguchi · 11 comments
Owner

Originally created by @reservedbytes on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6444

Originally assigned to: @Xmilon on GitHub.

Follows #5637

native_living_knockback runs after knockback resistance and doesn't say who pushed, so a mod can't do what a weapon that changes its own knockback does
Vanilla's LivingEntity.knockback(strength, x, z) scales strength by KNOCKBACK_RESISTANCE inside the method, and NeoForge fires LivingKnockBackEvent at its start, before that, with the attacker reachable through the pushed entity's getLastHurtByMob / kill credit

What's missing

  • the hook before knockback resistance, as NeoForge fires it, so a change to strength lands on the raw value
  • the attacker (the pushed entity's kill credit) and the items it holds, or a handle the mod can read them from
  • every knockback path: mob melee and armor stands too, not only player hits
Originally created by @reservedbytes on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6444 Originally assigned to: @Xmilon on GitHub. Follows #5637 `native_living_knockback` runs after knockback resistance and doesn't say who pushed, so a mod can't do what a weapon that changes its own knockback does Vanilla's `LivingEntity.knockback(strength, x, z)` scales `strength` by `KNOCKBACK_RESISTANCE` inside the method, and NeoForge fires `LivingKnockBackEvent` at its start, before that, with the attacker reachable through the pushed entity's `getLastHurtByMob` / kill credit What's missing - the hook before knockback resistance, as NeoForge fires it, so a change to `strength` lands on the raw value - the attacker (the pushed entity's kill credit) and the items it holds, or a handle the mod can read them from - every knockback path: mob melee and armor stands too, not only player hits
Author
Owner

@byMehd commented on GitHub (Nov 1, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6564463129 --> @byMehd commented on GitHub (Nov 1, 2026): 🤖 Agent: /claim
Author
Owner

@byMehd commented on GitHub (Nov 1, 2026):

🤖 Agent: /unclaim

<!-- gh-comment-id:6564589827 --> @byMehd commented on GitHub (Nov 1, 2026): 🤖 Agent: /unclaim
Author
Owner

@MSedgeMC commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6564609736 --> @MSedgeMC commented on GitHub (Nov 1, 2026): /claim
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

🤖 Agent: the first bullet (the hook runs before the knockback resistance, on the raw strength) is open in 6495. The attacker's held items and the other knockback paths are not in it.

<!-- gh-comment-id:6564657410 --> @xFedeT commented on GitHub (Nov 1, 2026): 🤖 Agent: the first bullet (the hook runs before the knockback resistance, on the raw strength) is open in 6495. The attacker's held items and the other knockback paths are not in it.
Author
Owner

@MSedgeMC commented on GitHub (Nov 1, 2026):

/unclaim

<!-- gh-comment-id:6564672317 --> @MSedgeMC commented on GitHub (Nov 1, 2026): /unclaim
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6564722950 --> @xFedeT commented on GitHub (Nov 1, 2026): /claim
Author
Owner

@kira-horizon[bot] commented on GitHub (Nov 2, 2026):

Claimed by levzzz on Discord (GitHub: levzzz5154), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #6444).

<!-- gh-comment-id:6582597112 --> @kira-horizon[bot] commented on GitHub (Nov 2, 2026): Claimed by `levzzz` on Discord (GitHub: `levzzz5154`), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #6444). <!-- kira:work -->
Author
Owner

@levzzz5154 commented on GitHub (Nov 2, 2026):

/unclaim

<!-- gh-comment-id:6582686664 --> @levzzz5154 commented on GitHub (Nov 2, 2026): /unclaim
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, You don't hold this issue. (asked by @levzzz5154)

<!-- gh-comment-id:6582713223 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, You don't hold this issue. (asked by @levzzz5154)
Author
Owner

@kira-horizon[bot] commented on GitHub (Nov 2, 2026):

Unclaimed by levzzz on Discord: this issue is free to take.

<!-- gh-comment-id:6582843782 --> @kira-horizon[bot] commented on GitHub (Nov 2, 2026): Unclaimed by `levzzz` on Discord: this issue is free to take. <!-- kira:work -->
Author
Owner

@Xmilon commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6583096318 --> @Xmilon commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
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#2093
No description provided.