[PR #2731] [MERGED] Implement the spear's jab and the Lunge enchantment #4574

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

📋 Pull Request Information

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

Base: main ← Head: feat/spear-lunge


📝 Commits (3)

  • e314c2f Implement the spear's left-click jab and the Lunge enchantment
  • c4a3975 Merge main into feat/spear-lunge
  • fad711f Merge main into feat/spear-lunge

📊 Changes

6 files changed (+301 additions, -34 deletions)

View changed files

📝 crates/horizon-client/src/game/enchant_effects.rs (+100 -0)
📝 crates/horizon-client/src/game/hand.rs (+19 -4)
📝 crates/horizon-client/src/game/lan_actions.rs (+33 -0)
📝 crates/horizon-client/src/game/remote.rs (+29 -1)
📝 crates/horizon-client/src/game/spear.rs (+89 -19)
📝 crates/horizon-client/src/spear.rs (+31 -10)

📄 Description

Fixes #2701 (Lunge).

Builds on #2682 (spear use and charge), so the diff against main also shows that PR's commit until it merges. The changes of this PR are the last commit only.

What and why

Lunge did nothing, because it is triggered by the spear's left-click jab, and that jab did not exist: a left click with a spear still did an ordinary melee attack. This adds the jab and, with it, Lunge.

  • Jab: a left click with a spear sends ServerboundPlayerAction STAB. The server stabs every mob along the view (spear reach, known movement extends it, a block closer than the minimum reach takes the whole stab) for the attack damage scaled by the attack strength, with knockback, plays the hit sound if something was affected, and swings with the spear's STAB animation. The client swings, plays the jab sound and starts its charge again; it is blocked until the spear's minimum_attack_charge of 1 is reached (the server accepts it five ticks early, as vanilla).
  • Lunge: after the jab the post_piercing_attack effects of the weapon run, read from the enchantment data: 1 durability, 4 * level exhaustion, a horizontal dash of 0.458 * level along the view, and the level's sound. It is skipped when riding, gliding, in water, or (outside creative) below 7 food.
  • Both client paths are covered: the in-process server (PlayerAction 8 handled in lan_actions.rs, the dash sent to the player with SetEntityMotion like other pushes), and --in-frame (HandWorld's piercing_attack).

Vanilla reference

  • data/minecraft/enchantment/lunge.json (post_piercing_attack, requirements, apply_impulse, apply_exhaustion, change_item_damage, play_sound)
  • PiercingWeapon.attack, PiercingWeapon.makeSound and makeHitSound
  • Minecraft.startAttack, continueAttack, MultiPlayerGameMode.piercingAttack
  • ServerGamePacketListenerImpl.handlePlayerAction (STAB), Player.cannotAttackWithItem
  • Player.stabAttack, LivingEntity.postPiercingAttack, EnchantmentHelper.doPostPiercingAttackEffects
  • ApplyEntityImpulse, ApplyExhaustion, ChangeItemDamage, PlaySoundEffect
  • Item.Properties.spear (attack duration, attack_animation, minimum_attack_charge)

Self-check

  • cargo clippy -p horizon-client --all-targets -- -D warnings is clean and the changed files are rustfmt'ed. I did not build or run the game, so none of this has been tried in game.
  • Not done: the jab only hits mobs (as the charge in #2682 does), not other players, item frames, boats and the like; the STAB swing is drawn with the existing swing animation, as the first and third person STAB poses do not exist yet; a datapack enchantment with post_piercing_attack would get Lunge's requirements, not its own.
  • Attack cooldowns and the attack indicator that the issue also mentions are not touched (#2657 covers attack speed effects).

🔄 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/2731 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/spear-lunge` --- ### 📝 Commits (3) - [`e314c2f`](https://github.com/horizon-rust/horizon/commit/e314c2fa81e3e2c76958611c473bccb1497585ea) Implement the spear's left-click jab and the Lunge enchantment - [`c4a3975`](https://github.com/horizon-rust/horizon/commit/c4a39757a1ca585a93e8dd976aa1d83956401646) Merge main into feat/spear-lunge - [`fad711f`](https://github.com/horizon-rust/horizon/commit/fad711f55f99800aac0123c828c56189a954c377) Merge main into feat/spear-lunge ### 📊 Changes **6 files changed** (+301 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/enchant_effects.rs` (+100 -0) 📝 `crates/horizon-client/src/game/hand.rs` (+19 -4) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+33 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+29 -1) 📝 `crates/horizon-client/src/game/spear.rs` (+89 -19) 📝 `crates/horizon-client/src/spear.rs` (+31 -10) </details> ### 📄 Description Fixes #2701 (Lunge). Builds on #2682 (spear use and charge), so the diff against `main` also shows that PR's commit until it merges. The changes of this PR are the last commit only. ## What and why Lunge did nothing, because it is triggered by the spear's left-click jab, and that jab did not exist: a left click with a spear still did an ordinary melee attack. This adds the jab and, with it, Lunge. - Jab: a left click with a spear sends `ServerboundPlayerAction` STAB. The server stabs every mob along the view (spear reach, `known movement` extends it, a block closer than the minimum reach takes the whole stab) for the attack damage scaled by the attack strength, with knockback, plays the hit sound if something was affected, and swings with the spear's STAB animation. The client swings, plays the jab sound and starts its charge again; it is blocked until the spear's `minimum_attack_charge` of 1 is reached (the server accepts it five ticks early, as vanilla). - Lunge: after the jab the `post_piercing_attack` effects of the weapon run, read from the enchantment data: 1 durability, `4 * level` exhaustion, a horizontal dash of `0.458 * level` along the view, and the level's sound. It is skipped when riding, gliding, in water, or (outside creative) below 7 food. - Both client paths are covered: the in-process server (`PlayerAction` 8 handled in `lan_actions.rs`, the dash sent to the player with `SetEntityMotion` like other pushes), and `--in-frame` (`HandWorld`'s `piercing_attack`). ## Vanilla reference - `data/minecraft/enchantment/lunge.json` (`post_piercing_attack`, requirements, `apply_impulse`, `apply_exhaustion`, `change_item_damage`, `play_sound`) - `PiercingWeapon.attack`, `PiercingWeapon.makeSound` and `makeHitSound` - `Minecraft.startAttack`, `continueAttack`, `MultiPlayerGameMode.piercingAttack` - `ServerGamePacketListenerImpl.handlePlayerAction` (STAB), `Player.cannotAttackWithItem` - `Player.stabAttack`, `LivingEntity.postPiercingAttack`, `EnchantmentHelper.doPostPiercingAttackEffects` - `ApplyEntityImpulse`, `ApplyExhaustion`, `ChangeItemDamage`, `PlaySoundEffect` - `Item.Properties.spear` (attack duration, `attack_animation`, `minimum_attack_charge`) ## Self-check - `cargo clippy -p horizon-client --all-targets -- -D warnings` is clean and the changed files are rustfmt'ed. I did not build or run the game, so none of this has been tried in game. - Not done: the jab only hits mobs (as the charge in #2682 does), not other players, item frames, boats and the like; the STAB swing is drawn with the existing swing animation, as the first and third person STAB poses do not exist yet; a datapack enchantment with `post_piercing_attack` would get Lunge's requirements, not its own. - Attack cooldowns and the attack indicator that the issue also mentions are not touched (#2657 covers attack speed effects). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:18:09 +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#4574
No description provided.