[PR #312] [MERGED] Crossbows load firework rockets from either hand; bows and crossbows take held arrows first #2480

Closed
opened 2026-11-02 15:56:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/offhand-crossbow-fireworks


📝 Commits (1)

  • ffd0297 Crossbows load firework rockets from either hand; bows and crossbows take held arrows first

📊 Changes

5 files changed (+133 additions, -43 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+11 -10)
📝 crates/horizon-client/src/game/crossbow.rs (+117 -29)
📝 crates/horizon-client/src/game/dispenser.rs (+1 -1)
📝 crates/horizon-client/src/game/fireworks.rs (+3 -2)
📝 crates/horizon-client/src/game/shield.rs (+1 -1)

📄 Description

Part of #276. Thanks to Cosmic (Online5277) for the report.

What

  • A crossbow now loads firework rockets held in either hand.
  • Bows and crossbows take held ammunition first, off hand then main hand, before the inventory.
  • A crossbow charged with rockets fires them as vanilla does.

Why

Player.getProjectile first asks ProjectileWeaponItem.getHeldProjectile, which checks the off hand and then the main hand with the weapon's held predicate (crossbow: arrows or fireworks; bow: arrows only). It falls back to the inventory with arrows only. Horizon looked only at inventory arrows.

How

  • game/crossbow.rs:
    • projectile_slot follows getProjectile.
    • Charged rockets are launched at the crossbow's angle (FireworkRocketEntity with shotAtAngle, from eye y − 0.15) at power 1.6 (getShootingPower).
    • Firing rockets costs 3 durability.
  • fireworks.rs: launch_dispensed_rocket is now launch_angled_rocket, shared by dispensers and crossbows.
  • game.rs: the bow uses the same lookup.

How tested

  • Unit test held_projectiles_come_before_the_inventory.
  • In game (Mac mini, offscreen): crossbow in the main hand, rockets in the off hand. It charges with a firework (charged_projectiles: firework_rocket) and fires it (screenshots fp-crossbow-charged-rocket.png, fp-crossbow-rocket-fired.png).
  • No parity harness covers getProjectile yet.
Self-check (Mac mini), all five branches of this batch rebased on origin/main 050b2038:
- cargo fmt --all --check: OK
- cargo clippy --workspace --all-targets -- -D warnings: OK on this branch alone, and on the integration of all five
- cargo test -p horizon-client (integration): 649 + 41 + 15 + 2 + 2 + 1 passed, 0 failed
- tools/parity.py --changed origin/main on the integration commit: 79 passed, 0 failed
  (including arrow, use_item_on, first_person, dispenser and mob_ai)
- tools/parity.py, run explicitly: player_hurt, blocking_rules, blocking_item_damage, item_use, item_use_start,
  item_use_lifecycle, living_hurt, damage_reduction, player_equipment, registered_player_combat,
  server_player_combat, server_player_damage: 12 passed, 0 failed

Screenshots: ~/code/horizon-parity/shots/offhand-276/ on the Mac mini.

Needs Ludovic

Nothing. Tipped and spectral arrows are still not bow ammunition (unchanged).

🤖 Generated with Claude Code


🔄 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/312 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/offhand-crossbow-fireworks` --- ### 📝 Commits (1) - [`ffd0297`](https://github.com/horizon-rust/horizon/commit/ffd0297dc421e499c7567e4602d91e5fe652a1b9) Crossbows load firework rockets from either hand; bows and crossbows take held arrows first ### 📊 Changes **5 files changed** (+133 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+11 -10) 📝 `crates/horizon-client/src/game/crossbow.rs` (+117 -29) 📝 `crates/horizon-client/src/game/dispenser.rs` (+1 -1) 📝 `crates/horizon-client/src/game/fireworks.rs` (+3 -2) 📝 `crates/horizon-client/src/game/shield.rs` (+1 -1) </details> ### 📄 Description Part of #276. Thanks to Cosmic (Online5277) for the report. ## What - A crossbow now loads firework rockets held in either hand. - Bows and crossbows take held ammunition first, off hand then main hand, before the inventory. - A crossbow charged with rockets fires them as vanilla does. ## Why `Player.getProjectile` first asks `ProjectileWeaponItem.getHeldProjectile`, which checks the off hand and then the main hand with the weapon's held predicate (crossbow: arrows or fireworks; bow: arrows only). It falls back to the inventory with arrows only. Horizon looked only at inventory arrows. ## How - `game/crossbow.rs`: - `projectile_slot` follows `getProjectile`. - Charged rockets are launched at the crossbow's angle (`FireworkRocketEntity` with `shotAtAngle`, from eye y − 0.15) at power 1.6 (`getShootingPower`). - Firing rockets costs 3 durability. - `fireworks.rs`: `launch_dispensed_rocket` is now `launch_angled_rocket`, shared by dispensers and crossbows. - `game.rs`: the bow uses the same lookup. ## How tested - Unit test `held_projectiles_come_before_the_inventory`. - In game (Mac mini, offscreen): crossbow in the main hand, rockets in the off hand. It charges with a firework (`charged_projectiles: firework_rocket`) and fires it (screenshots `fp-crossbow-charged-rocket.png`, `fp-crossbow-rocket-fired.png`). - No parity harness covers `getProjectile` yet. ``` Self-check (Mac mini), all five branches of this batch rebased on origin/main 050b2038: - cargo fmt --all --check: OK - cargo clippy --workspace --all-targets -- -D warnings: OK on this branch alone, and on the integration of all five - cargo test -p horizon-client (integration): 649 + 41 + 15 + 2 + 2 + 1 passed, 0 failed - tools/parity.py --changed origin/main on the integration commit: 79 passed, 0 failed (including arrow, use_item_on, first_person, dispenser and mob_ai) - tools/parity.py, run explicitly: player_hurt, blocking_rules, blocking_item_damage, item_use, item_use_start, item_use_lifecycle, living_hurt, damage_reduction, player_equipment, registered_player_combat, server_player_combat, server_player_damage: 12 passed, 0 failed ``` Screenshots: ~/code/horizon-parity/shots/offhand-276/ on the Mac mini. ## Needs Ludovic Nothing. Tipped and spectral arrows are still not bow ammunition (unchanged). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:32 +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#2480
No description provided.