[PR #7574] Fishing rod: cast direction uses Mth's sine table (straight down no longer launches up) #7684

Open
opened 2026-11-03 07:21:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7574
Author: @Joansitoh
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/7440-fishing-cast-down


📝 Commits (1)

  • 8b37eef Fishing rod: cast direction uses Mth's sine table (straight down no longer launches up)

📊 Changes

1 file changed (+34 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game/fishing.rs (+34 -10)

📄 Description

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

What

Casting a fishing rod straight down launched the bobber high into the sky. Game::use_fishing_rod computed the cast direction with libm cos/sin; at pitch 90 that gives xCos = +4.37e-8, so y clamped to +5 (up). The direction now comes from a small cast_direction(yaw, pitch) helper that uses Mth.sin/cos (the 65536-entry table, horizon_core::geometry::trig), with the same f32 angle math as Java. Pitch -90 was inverted the same way. The speed multiply and random draws are untouched.

Vanilla reference

FishingHook(Player, Level, int, int) (FishingHook.java L84-109): Vec3(-ySin, clamp(-(xSin/xCos), -5, 5), -yCos) with Mth.cos/sin. At pitch 90 the table gives xCos = -0.0, so y is -inf, clamped to -5 (down).

How tested

  • New unit tests in game/fishing.rs: pitch 90 -> y = -5, pitch -90 -> y = +5, pitch 0 -> 0, pitch 89.9 -> -5, and pitch 45 against an independently built sine table.
  • python3 tools/parity.py --fresh fishing_hook_entities: PASS (also PASS on unchanged upstream; one earlier run failed on a vanilla-side transcript where vanilla did not hook the stand, so that harness can flake).

pr_ready --quick (against upstream/main at ae3cbb0f1): Scope 1 file +34/−10, public tree, Python tests (614), rustfmt, clippy, tests horizon-client (700), doc tests, mod API all ✅.

Remaining affected harnesses: run by CI's parity job (52 affected).

Fixes #7440

Suggested label: none

🤖 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/7574 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7440-fishing-cast-down` --- ### 📝 Commits (1) - [`8b37eef`](https://github.com/horizon-rust/horizon/commit/8b37eef7dd42ac00c6bb4c16c94b1b9f42426ab4) Fishing rod: cast direction uses Mth's sine table (straight down no longer launches up) ### 📊 Changes **1 file changed** (+34 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/fishing.rs` (+34 -10) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. ## What Casting a fishing rod straight down launched the bobber high into the sky. `Game::use_fishing_rod` computed the cast direction with libm `cos`/`sin`; at pitch 90 that gives `xCos = +4.37e-8`, so y clamped to `+5` (up). The direction now comes from a small `cast_direction(yaw, pitch)` helper that uses `Mth.sin/cos` (the 65536-entry table, `horizon_core::geometry::trig`), with the same f32 angle math as Java. Pitch -90 was inverted the same way. The speed multiply and random draws are untouched. ## Vanilla reference `FishingHook(Player, Level, int, int)` (FishingHook.java L84-109): `Vec3(-ySin, clamp(-(xSin/xCos), -5, 5), -yCos)` with `Mth.cos/sin`. At pitch 90 the table gives `xCos = -0.0`, so y is `-inf`, clamped to `-5` (down). ## How tested - New unit tests in `game/fishing.rs`: pitch 90 -> y = -5, pitch -90 -> y = +5, pitch 0 -> 0, pitch 89.9 -> -5, and pitch 45 against an independently built sine table. - `python3 tools/parity.py --fresh fishing_hook_entities`: PASS (also PASS on unchanged upstream; one earlier run failed on a vanilla-side transcript where vanilla did not hook the stand, so that harness can flake). `pr_ready --quick` (against upstream/main at ae3cbb0f1): Scope 1 file +34/−10, public tree, Python tests (614), rustfmt, clippy, tests horizon-client (700), doc tests, mod API all ✅. Remaining affected harnesses: run by CI's parity job (52 affected). Fixes #7440 Suggested label: none 🤖 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>
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#7684
No description provided.