[PR #2966] [MERGED] Apply weapon knockback enchantments to arrows #4721

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2966
Author: @kacpherek
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix/arrow-weapon-knockback


📝 Commits (1)

  • 1db835f Apply arrow weapon knockback enchantments

📊 Changes

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

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+5 -0)
📝 crates/horizon-client/src/game.rs (+2 -0)
📝 crates/horizon-client/src/game/creatures.rs (+50 -1)
📝 crates/horizon-client/src/game/enchant_effects.rs (+2 -2)

📄 Description

What and why

A bow with Punch pushed the target with a fixed formula that ignored the weapon's actual enchantments, and the arrow forgot the bow after a save.

  • A player's arrow now keeps the weapon it was fired from (the weapon field), and it survives saving and loading.
  • On a hit that does damage, the knockback comes from the weapon's minecraft:knockback effects (Punch is one), evaluated with the victim, the shooter and the arrow as context, and still scaled by the target's knockback resistance. Arrows without a known weapon keep the old Punch value.
  • Power, Infinity and Flame are now read from the item in the hand that was used to shoot, not always the selected slot.

Vanilla reference

  • AbstractArrow.java:85-105,509-517,603-622: firedFromWeapon, its saving, and getKnockback on a hit.
  • EnchantmentHelper.java:216-219: modifyKnockback with the weapon.
  • data/minecraft/enchantment/punch.json: Punch as a knockback effect.

Self-check

clippy and fmt passed for horizon-client before the rebase onto current main, which was clean. Not run in game.


🔄 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/2966 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/arrow-weapon-knockback` --- ### 📝 Commits (1) - [`1db835f`](https://github.com/horizon-rust/horizon/commit/1db835fa0cc58f5c76494581bad5f8cda4d85018) Apply arrow weapon knockback enchantments ### 📊 Changes **4 files changed** (+59 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+5 -0) 📝 `crates/horizon-client/src/game.rs` (+2 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+50 -1) 📝 `crates/horizon-client/src/game/enchant_effects.rs` (+2 -2) </details> ### 📄 Description ## What and why A bow with Punch pushed the target with a fixed formula that ignored the weapon's actual enchantments, and the arrow forgot the bow after a save. - A player's arrow now keeps the weapon it was fired from (the `weapon` field), and it survives saving and loading. - On a hit that does damage, the knockback comes from the weapon's `minecraft:knockback` effects (Punch is one), evaluated with the victim, the shooter and the arrow as context, and still scaled by the target's knockback resistance. Arrows without a known weapon keep the old Punch value. - Power, Infinity and Flame are now read from the item in the hand that was used to shoot, not always the selected slot. ## Vanilla reference - `AbstractArrow.java:85-105,509-517,603-622`: `firedFromWeapon`, its saving, and `getKnockback` on a hit. - `EnchantmentHelper.java:216-219`: `modifyKnockback` with the weapon. - `data/minecraft/enchantment/punch.json`: Punch as a knockback effect. ## Self-check clippy and fmt passed for horizon-client before the rebase onto current main, which was clean. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:27 +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#4721
No description provided.