[PR #2153] [MERGED] Make Piercing crossbow arrows pass through entities #4054

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

📋 Pull Request Information

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

Base: main ← Head: fix/crossbow-piercing


📝 Commits (1)

  • 5d30776 Make Piercing crossbow arrows pass through entities

📊 Changes

3 files changed (+54 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/arrows.rs (+32 -3)
📝 crates/horizon-client/src/game/crossbow.rs (+16 -0)
📝 crates/horizon-client/src/projectiles.rs (+6 -5)

📄 Description

What and why

Piercing had no effect: an arrow from a Piercing crossbow stopped at the first mob like any other arrow. Now it goes through the mobs it hits:

  • The crossbow's projectile_piercing value (1 + level above the first, so the level) becomes the arrow's pierce level.
  • A piercing arrow keeps flying after it hurts something, instead of being spent. It skips entities it already went through.
  • Once it has gone through pierce level + 1 entities, the next entity it touches discards it without being hurt.
  • Sticking in a block ends piercing, as before.
  • Arrows with pierce level 0 take exactly the old path.

Pillagers (and any mob whose weapon has Piercing) already had the level read into the arrow bonus but never applied it; set_bonus now applies it, so their arrows pierce as well.

Known difference: when a piercing arrow hits a mob, the game hurts the mob and the arrow goes on from the hit point on the next tick. Vanilla keeps going within the same tick, so it can reach a second mob or the block one tick earlier.

Not covered: a shield-refused piercing arrow turns back and flies on from there, while vanilla also continues its original path to the block that path would have hit; the "killed by arrow" advancement list.

Vanilla reference

  • data/minecraft/enchantment/piercing.json (projectile_piercing) and EnchantmentHelper.getPiercingCount.
  • AbstractArrow constructor (sets the pierce level from the weapon), AbstractArrow.onHitEntity (adds to piercingIgnoreEntityIds, discards at size >= pierceLevel + 1, no discard after a successful hit when the pierce level is above 0, no stuck-arrow count), canHitEntity, stepMoveAndHit (continues after a non-deflected hit when the pierce level is above 0), onHitBlock (setPierceLevel(0), resetPiercedEntities).

Self-check

cargo check -p horizon-client passes.


🔄 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/2153 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/crossbow-piercing` --- ### 📝 Commits (1) - [`5d30776`](https://github.com/horizon-rust/horizon/commit/5d30776b07610197935f14ea820ecbd2d4b94a04) Make Piercing crossbow arrows pass through entities ### 📊 Changes **3 files changed** (+54 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/arrows.rs` (+32 -3) 📝 `crates/horizon-client/src/game/crossbow.rs` (+16 -0) 📝 `crates/horizon-client/src/projectiles.rs` (+6 -5) </details> ### 📄 Description ## What and why Piercing had no effect: an arrow from a Piercing crossbow stopped at the first mob like any other arrow. Now it goes through the mobs it hits: - The crossbow's `projectile_piercing` value (1 + level above the first, so the level) becomes the arrow's pierce level. - A piercing arrow keeps flying after it hurts something, instead of being spent. It skips entities it already went through. - Once it has gone through pierce level + 1 entities, the next entity it touches discards it without being hurt. - Sticking in a block ends piercing, as before. - Arrows with pierce level 0 take exactly the old path. Pillagers (and any mob whose weapon has Piercing) already had the level read into the arrow bonus but never applied it; `set_bonus` now applies it, so their arrows pierce as well. Known difference: when a piercing arrow hits a mob, the game hurts the mob and the arrow goes on from the hit point on the next tick. Vanilla keeps going within the same tick, so it can reach a second mob or the block one tick earlier. Not covered: a shield-refused piercing arrow turns back and flies on from there, while vanilla also continues its original path to the block that path would have hit; the "killed by arrow" advancement list. ## Vanilla reference - `data/minecraft/enchantment/piercing.json` (`projectile_piercing`) and `EnchantmentHelper.getPiercingCount`. - `AbstractArrow` constructor (sets the pierce level from the weapon), `AbstractArrow.onHitEntity` (adds to `piercingIgnoreEntityIds`, discards at `size >= pierceLevel + 1`, no discard after a successful hit when the pierce level is above 0, no stuck-arrow count), `canHitEntity`, `stepMoveAndHit` (continues after a non-deflected hit when the pierce level is above 0), `onHitBlock` (`setPierceLevel(0)`, `resetPiercedEntities`). ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:20 +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#4054
No description provided.