[PR #7030] [MERGED] Native mods: ArrowLooseEvent hook (arrow_loose) #7283

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7030
Author: @Xmilon
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: native/arrow-loose


📝 Commits (3)

  • ced1b06 Add native arrow loose hook
  • af96b6e arrow_loose: take the bow stack from the caller and catalogue the hook as server-side
  • 828ddff Merge upstream main into native/arrow-loose

📊 Changes

5 files changed (+109 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+8 -9)
📝 crates/horizon-client/src/game/item_use.rs (+21 -2)
📝 crates/horizon-client/src/game/native_hooks.rs (+17 -0)
📝 crates/horizon-client/src/mod_api/generated.rs (+46 -0)
➕ tools/native-hook-fragments/arrow_loose.json (+17 -0)

📄 Description

🤖 Opened by Xmilon's AI agent (Codex, gpt-6.1-terra), not by Xmilon personally. Reviewed by Claude Code (Sonnet 5.5), which also opened this PR after Codex's connector got a 403.

What and why

Closes #6987. Part of #4953.

Adds the arrow_loose hook, NeoForge's ArrowLooseEvent: when a player releases a bow, a mod sees the bow stack, whether ammo exists and the charge in ticks held, and may change the charge or cancel the shot. A negative charge also prevents it.

It is distinct from two existing hooks: living_entity_use_item_stop skips the whole item release, and entity_shoot_bow fires after the arrow spawned with a read-only force. release_bow now asks item_use::bow_release_power (pure, unit-tested) for the power, so the old checks (power under 0.1, no ammo outside creative) are unchanged.

Kind

  • feature: something new for players

Vanilla reference

BowItem.releaseUsing, checked with tools/rea_vanilla.py against the pinned 26.3 client. The event contract comes from NeoForge's public documentation only.

Other projects' code

None.

Self-check

  • cargo run -p xtask -- mod-api, cargo fmt --all -- --check and git diff --check passed locally.
  • Added bow_release_respects_charge_cancel_and_ammo for the power helper. It has not been run locally: cold builds take too long on this machine, so verify on this PR is the check for build, clippy and tests. tools/pr_ready.py was not run locally for the same reason.
  • Not covered: the remote client's separate release path (a client of someone else's server), crossbows and ArrowNockEvent.

🤖 Generated with Codex


🔄 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/7030 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `native/arrow-loose` --- ### 📝 Commits (3) - [`ced1b06`](https://github.com/horizon-rust/horizon/commit/ced1b06fc60215510b67144d7dac0fb3e2f51114) Add native arrow loose hook - [`af96b6e`](https://github.com/horizon-rust/horizon/commit/af96b6e07c2f09331339a3d6adcc6ca644854319) arrow_loose: take the bow stack from the caller and catalogue the hook as server-side - [`828ddff`](https://github.com/horizon-rust/horizon/commit/828ddff14fdbfbbdc23a7f44f2034eacf5699cf8) Merge upstream main into native/arrow-loose ### 📊 Changes **5 files changed** (+109 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+8 -9) 📝 `crates/horizon-client/src/game/item_use.rs` (+21 -2) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+17 -0) 📝 `crates/horizon-client/src/mod_api/generated.rs` (+46 -0) ➕ `tools/native-hook-fragments/arrow_loose.json` (+17 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Codex, gpt-6.1-terra), not by Xmilon personally. Reviewed by Claude Code (Sonnet 5.5), which also opened this PR after Codex's connector got a 403. ## What and why Closes #6987. Part of #4953. Adds the `arrow_loose` hook, NeoForge's `ArrowLooseEvent`: when a player releases a bow, a mod sees the bow stack, whether ammo exists and the charge in ticks held, and may change the charge or cancel the shot. A negative charge also prevents it. It is distinct from two existing hooks: `living_entity_use_item_stop` skips the whole item release, and `entity_shoot_bow` fires after the arrow spawned with a read-only force. `release_bow` now asks `item_use::bow_release_power` (pure, unit-tested) for the power, so the old checks (power under 0.1, no ammo outside creative) are unchanged. ## Kind - [x] feature: something new for players ## Vanilla reference `BowItem.releaseUsing`, checked with `tools/rea_vanilla.py` against the pinned 26.3 client. The event contract comes from NeoForge's public documentation only. ## Other projects' code None. ## Self-check - `cargo run -p xtask -- mod-api`, `cargo fmt --all -- --check` and `git diff --check` passed locally. - Added `bow_release_respects_charge_cancel_and_ammo` for the power helper. It has not been run locally: cold builds take too long on this machine, so `verify` on this PR is the check for build, clippy and tests. `tools/pr_ready.py` was not run locally for the same reason. - Not covered: the remote client's separate release path (a client of someone else's server), crossbows and `ArrowNockEvent`. 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:37:05 +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#7283
No description provided.