[PR #6551] [MERGED] Native mods: a player's fishing rod, cast to reel-in, cancellable (native_player_fish, part of #5816) #6946

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

📋 Pull Request Information

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

Base: main ← Head: feat-player-fish-hook


📝 Commits (2)

  • 5cd3a00 Native mods: a player's fishing rod, cast to reel-in, cancellable (native_player_fish)
  • 1929509 Name Bukkit's PlayerFishEvent as native_player_fish's model

📊 Changes

4 files changed (+69 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/fishing.rs (+29 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+22 -0)
📝 docs/native-mods.md (+6 -0)
➕ tools/native-hook-fragments/native_player_fish.json (+12 -0)

📄 Description

🤖 Opened by Detimes' AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally.

What and why

Part of #5816 (hook points a survival server's native mods need). A mod could not hear or refuse a player casting, getting a bite on, catching with or reeling in a fishing rod.

  • New hook point native_player_fish(player, name, state, cancel) (fragment native_player_fish.json, docs paragraph); states: 0 cast, 1 bite, 2 catch, 3 reel in empty, 4 reel in a bobber hooked to an entity or item. Called from use_fishing_rod (cast and reel-in) and catching_fish (bite), fishing.rs, with the player's state swapped in.
  • cancel: a cancelled cast throws nothing, a cancelled bite resets the wait, a cancelled reel-in leaves the bobber out with no rod wear.
  • Nothing changes when no mod hooks it.

Kind

  • feature (new native hook point)

Vanilla reference

FishingHook / FishingRodItem.use; NeoForge ItemFishedEvent, Bukkit PlayerFishEvent.

Other projects' code

none. (Tested with a throwaway horizon-mixins bundle, not part of this PR.)

Proof on a real dedicated server

Engine from the batch branch this commit comes from, plus a throwaway bundle; a bare protocol client with a rod.

idle control (rod in hand)                  -> no hook line
cast, reel-in, bite                         -> state=0, state=3, state=1; the mod cancels state=1; the next bite goes through, then state=2 (rod wear via item_damaged amount=1)
cancelling state=0                          -> state=0 again: nothing was thrown
cancelled state=2                           -> followed by state=3: the bobber stayed out

Not covered: state 4 (a bare client cannot hook a mob), the LAN host as a player.

Self-check

pr_ready --quick --base upstream/main ran once on the whole branch that carries this and four other hook commits (11 files, +267 −3): Python tests 586 passed, rustfmt, clippy, horizon-client tests 1809 passed, doc tests pass; parity not run (--quick). This PR is that commit cherry-picked onto current main (4 files changed, 69 insertions(+)): cargo test -p horizon-client native_hooks passes (21 passed).


🔄 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/6551 **Author:** [@Detimes](https://github.com/Detimes) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat-player-fish-hook` --- ### 📝 Commits (2) - [`5cd3a00`](https://github.com/horizon-rust/horizon/commit/5cd3a002761944088c8d00c30439b162819dee2b) Native mods: a player's fishing rod, cast to reel-in, cancellable (native_player_fish) - [`1929509`](https://github.com/horizon-rust/horizon/commit/1929509dddfe9257c21c2a60b0dea4bef3818203) Name Bukkit's PlayerFishEvent as native_player_fish's model ### 📊 Changes **4 files changed** (+69 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/fishing.rs` (+29 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+22 -0) 📝 `docs/native-mods.md` (+6 -0) ➕ `tools/native-hook-fragments/native_player_fish.json` (+12 -0) </details> ### 📄 Description > 🤖 Opened by Detimes' AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally. ## What and why Part of #5816 (hook points a survival server's native mods need). A mod could not hear or refuse a player casting, getting a bite on, catching with or reeling in a fishing rod. - New hook point `native_player_fish(player, name, state, cancel)` (fragment `native_player_fish.json`, docs paragraph); states: 0 cast, 1 bite, 2 catch, 3 reel in empty, 4 reel in a bobber hooked to an entity or item. Called from `use_fishing_rod` (cast and reel-in) and `catching_fish` (bite), `fishing.rs`, with the player's state swapped in. - `cancel`: a cancelled cast throws nothing, a cancelled bite resets the wait, a cancelled reel-in leaves the bobber out with no rod wear. - Nothing changes when no mod hooks it. ## Kind - [x] feature (new native hook point) ## Vanilla reference `FishingHook` / `FishingRodItem.use`; NeoForge `ItemFishedEvent`, Bukkit `PlayerFishEvent`. ## Other projects' code none. (Tested with a throwaway horizon-mixins bundle, not part of this PR.) ## Proof on a real dedicated server Engine from the batch branch this commit comes from, plus a throwaway bundle; a bare protocol client with a rod. ``` idle control (rod in hand) -> no hook line cast, reel-in, bite -> state=0, state=3, state=1; the mod cancels state=1; the next bite goes through, then state=2 (rod wear via item_damaged amount=1) cancelling state=0 -> state=0 again: nothing was thrown cancelled state=2 -> followed by state=3: the bobber stayed out ``` Not covered: state 4 (a bare client cannot hook a mob), the LAN host as a player. ## Self-check `pr_ready --quick --base upstream/main` ran once on the whole branch that carries this and four other hook commits (11 files, +267 −3): Python tests 586 passed, rustfmt, clippy, `horizon-client` tests 1809 passed, doc tests pass; parity not run (`--quick`). This PR is that commit cherry-picked onto current main (4 files changed, 69 insertions(+)): `cargo test -p horizon-client native_hooks` passes (21 passed). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:29:59 +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#6946
No description provided.