[PR #4362] [MERGED] Let a piglin holding a crossbow shoot instead of melee #5581

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4362
Author: @DUzzL
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/issue-4356-piglin-crossbow


📝 Commits (1)

  • 1a37932 Make crossbow piglins shoot instead of meleeing

📊 Changes

2 files changed (+39 additions, -6 deletions)

View changed files

📝 crates/horizon-client/src/mobs/piglin.rs (+33 -4)
📝 crates/horizon-client/src/mobs/spear_use.rs (+6 -2)

📄 Description

🤖 Opened by DUzzL's AI agent, not by DUzzL personally.

Fixes #4356

Cause: register_piglin in mobs/piglin.rs checked for a held crossbow when Mob::new registered the goals. That runs before the spawn weapon is equipped (in finalize.rs), so the crossbow goal was never added, and MeleeAttack was not blocked while a crossbow was held.

Change: the crossbow goal is always registered and only starts while a crossbow is held. The melee wrapper in mobs/spear_use.rs stays off while a crossbow is held. Melee and crossbow never run together. A piglin with a sword is unchanged; one that drops its crossbow goes back to melee. One unit test covers the held-crossbow case.

Tested: cargo fmt --check, cargo clippy -p horizon-client --all-targets -- -D warnings, and cargo test -p horizon-client --lib mobs:: (150 passed, 6 ignored) pass.

Not tested: no in-game run. The test checks goal registration and the melee gate only, not the goals ticking in a world. The rule that vanilla skips melee for a held projectile weapon is from memory; no vanilla source is in the repo. tools/pr_ready.py not run.


🔄 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/4362 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/issue-4356-piglin-crossbow` --- ### 📝 Commits (1) - [`1a37932`](https://github.com/horizon-rust/horizon/commit/1a37932efd0785c04563a18f55df79c30530154c) Make crossbow piglins shoot instead of meleeing ### 📊 Changes **2 files changed** (+39 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/piglin.rs` (+33 -4) 📝 `crates/horizon-client/src/mobs/spear_use.rs` (+6 -2) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent, not by DUzzL personally. Fixes #4356 **Cause:** `register_piglin` in `mobs/piglin.rs` checked for a held crossbow when `Mob::new` registered the goals. That runs before the spawn weapon is equipped (in `finalize.rs`), so the crossbow goal was never added, and `MeleeAttack` was not blocked while a crossbow was held. **Change:** the crossbow goal is always registered and only starts while a crossbow is held. The melee wrapper in `mobs/spear_use.rs` stays off while a crossbow is held. Melee and crossbow never run together. A piglin with a sword is unchanged; one that drops its crossbow goes back to melee. One unit test covers the held-crossbow case. **Tested:** `cargo fmt --check`, `cargo clippy -p horizon-client --all-targets -- -D warnings`, and `cargo test -p horizon-client --lib mobs::` (150 passed, 6 ignored) pass. **Not tested:** no in-game run. The test checks goal registration and the melee gate only, not the goals ticking in a world. The rule that vanilla skips melee for a held projectile weapon is from memory; no vanilla source is in the repo. `tools/pr_ready.py` not run. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:33 +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#5581
No description provided.