[PR #5976] [MERGED] feat(mods): computed world field-of-view hook #6590

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5976
Author: @Xmilon
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @levzzz5154

Base: main ← Head: native/viewport-fov


📝 Commits (1)

  • 5c8fbc0 feat(mods): expose computed world field of view

📊 Changes

4 files changed (+80 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/fov.rs (+8 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+6 -0)
➕ tests/test_compute_fov_hook.py (+54 -0)
➕ tools/native-hook-fragments/compute_fov.json (+12 -0)

📄 Description

🤖 Opened by Xmilon's AI agent (Codex), not by Xmilon personally.

What and why

Fixes #5969; part of #4953's camera/ViewportEvent additions. native_compute_fov(partial, camera, degrees) lets native mods adjust the computed world FOV, including widening it. It runs after the existing settings, ordinary effects and zoom calculation, before projection/Nausea. The world view and its near-plane block overlay use the same result; hand/HUD FOV and the title panorama retain their separate paths.

Nonfinite values or values outside 1..=179 degrees fall back to the original computed FOV. The hook is an in/out value, not cancellable. It may run for more than one camera calculation per frame.

Kind

  • feature: something new for players

Vanilla reference

Read the player's own pinned 26.3 Camera.calculateFov and Camera.calculateHudFov bytecode with javap. The existing Horizon calculation remains intact. Public counterpart: ViewportEvent.ComputeFov. No vanilla game files are included.

Other projects' code

None. Public javadoc for the event contract only.

Self-check

  • Client Clippy --lib --bins --tests -D warnings passed.
  • Regression test compiled and executed the actual FOV method with a fake mod: unchanged, narrower, wider, boundaries, zero, negative, 180, NaN and infinity; argument forwarding and post-zoom value checked.
  • All four fragment-tool tests, touched-file rustfmt, diff and public-tree checks passed.
  • API fragment only, no catalog/API number edits.
  • No in-game/screenshot check. Client-only calculation; no server simulation changes. CI pending.

🤖 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/5976 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `native/viewport-fov` --- ### 📝 Commits (1) - [`5c8fbc0`](https://github.com/horizon-rust/horizon/commit/5c8fbc0c3e5f4b5f381b12cc4b4d7fa0b883f503) feat(mods): expose computed world field of view ### 📊 Changes **4 files changed** (+80 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/fov.rs` (+8 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+6 -0) ➕ `tests/test_compute_fov_hook.py` (+54 -0) ➕ `tools/native-hook-fragments/compute_fov.json` (+12 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Codex), not by Xmilon personally. ## What and why Fixes #5969; part of #4953's camera/ViewportEvent additions. `native_compute_fov(partial, camera, degrees)` lets native mods adjust the computed world FOV, including widening it. It runs after the existing settings, ordinary effects and zoom calculation, before projection/Nausea. The world view and its near-plane block overlay use the same result; hand/HUD FOV and the title panorama retain their separate paths. Nonfinite values or values outside 1..=179 degrees fall back to the original computed FOV. The hook is an in/out value, not cancellable. It may run for more than one camera calculation per frame. ## Kind - [x] feature: something new for players ## Vanilla reference Read the player's own pinned 26.3 Camera.calculateFov and Camera.calculateHudFov bytecode with javap. The existing Horizon calculation remains intact. Public counterpart: [ViewportEvent.ComputeFov](https://aldak0.ru/javadoc/26.3.x/net/neoforged/neoforge/client/event/ViewportEvent.ComputeFov.html). No vanilla game files are included. ## Other projects' code None. Public javadoc for the event contract only. ## Self-check - Client Clippy --lib --bins --tests -D warnings passed. - Regression test compiled and executed the actual FOV method with a fake mod: unchanged, narrower, wider, boundaries, zero, negative, 180, NaN and infinity; argument forwarding and post-zoom value checked. - All four fragment-tool tests, touched-file rustfmt, diff and public-tree checks passed. - API fragment only, no catalog/API number edits. - No in-game/screenshot check. Client-only calculation; no server simulation changes. CI pending. 🤖 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:23:29 +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#6590
No description provided.