[PR #3881] [MERGED] Third person: the player's head pitch follows the mouse between ticks #5272

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3881
Author: @TJKDev1
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: fix/own-head-pitch-follows-mouse


📝 Commits (10+)

  • 1a80673 Worldgen: structure mobs save the fields vanilla's chunk keeps
  • 52f0e38 Add the amplified, large-biome and single-biome world types
  • 22054ee Worldgen: chunk generation spawns its animals as vanilla, ticking or not
  • 729a224 Read the test registry without the explicit deref
  • 0104eea Format the world preset test
  • 815c09b Merge #2214 (world presets in the create-world screen)
  • bca77d1 Merge origin/main
  • d0b42fb Merge #2570
  • e5ebedd Merge #2585
  • bc5ec6f Structure mobs test: pass the world preset #2570 added to for_dimension

📊 Changes

234 files changed (+7463 additions, -1129 deletions)

View changed files

📝 README.md (+3 -0)
📝 crates/horizon-client-core/src/particle_type.rs (+12 -0)
📝 crates/horizon-client-render/src/assets.rs (+16 -2)
📝 crates/horizon-client-render/src/block_entity_render.rs (+12 -1)
📝 crates/horizon-client-render/src/brewing.rs (+35 -16)
📝 crates/horizon-client-render/src/chunk/block_entity.rs (+22 -0)
📝 crates/horizon-client-render/src/containers.rs (+8 -1)
📝 crates/horizon-client-render/src/datapack.rs (+46 -1)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
📝 crates/horizon-client-render/src/options_ui.rs (+99 -20)
📝 crates/horizon-client-render/src/particles.rs (+284 -3)
➕ crates/horizon-client-render/src/potent_sulfur.rs (+119 -0)
📝 crates/horizon-client-render/src/settings.rs (+7 -0)
📝 crates/horizon-client-render/src/signs.rs (+87 -4)
📝 crates/horizon-client-render/src/sprites.rs (+14 -0)
📝 crates/horizon-client-render/src/streaming.rs (+45 -3)
📝 crates/horizon-client-render/src/ui.rs (+15 -0)
📝 crates/horizon-client/examples/mod_port_probe.rs (+4 -3)
📝 crates/horizon-client/examples/probe/block_entity_anim_fixture.rs (+2 -1)
📝 crates/horizon-client/examples/probe/block_transform_fixture.rs (+2 -1)

...and 80 more files

📄 Description

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

Fixes #3844

In third person and in the inventory preview, the local player's head pitch eased in over a tick (previous_head_pitch → head_pitch, copied once a tick) while the camera followed the mouse every frame.

Vanilla followed

  • Entity.turn: the pitch delta goes to xRotO as well as xRot, each clamped to ±90. So Entity.getXRot(partialTick), which LivingEntityRenderer.extractRenderState reads, follows the mouse between ticks.
  • LivingEntity.tick / Player.aiStep: a change the tick makes itself, such as a sleeper's pitch going to 0, sets only xRot, so it still eases in.
  • ClientPacketListener.handleRotatePlayer: setOldRot, so the head snaps.
  • ClientPacketListener.handleMovePlayer → setValuesFromPositionPacket: PositionMoveRotation.calculateAbsolute is applied to the old rotation too (setOldPosAndRot). A relative pitch moves both ends; an absolute pitch snaps them.
  • AbstractBoat.onPassengerTurned ends every Entity.turn.

Change

  • Game::turn_player (perspective.rs) is the single Entity.turn for the player. Mouse, pad, arrow keys and the control turn all go through it. It moves both ends of the model's head pitch and applies the boat's 105° clamp. The clamp used to run only after a mouse turn, so pad and arrow-key turns in a boat could swing past it.
  • remote.rs snaps the model on PlayerRotation, and applies position_packet_pitch to both ends on PlayerPosition.
  • Tests:
    • own_head_pitch_follows_the_mouse_between_ticks: turn before and after the tick, a tick change easing in, the clamp, no model.
    • a_position_packet_moves_both_pitch_ends: relative, the clamp boundary, absolute.
    • Breaking the fix makes the first one fail.

pr_ready

pr_ready (tools/pr_ready.py on TJKPC, against origin/main at 668419b92, 2 min 10 s)

Check Result
Scope ✅ 5 files, +150 −44
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 423 passed (51 s)
rustfmt ✅ (7 s)
clippy ❌ failed (16 s)
tests: horizon-client ❌ 671 passed, 1 failed (50 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 361 affected, (1 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

None of the three ❌ come from this change:

  • clippy: manual_range_contains in horizon-world/src/worldgen/aquifer/noise_based.rs:466, plus the Windows-only dead_code on log_display in horizon-client-render/src/gfx.rs. Both are on main and in files this PR doesn't touch. With those two allowed, cargo clippy -p horizon-client --all-targets -- -D warnings is clean.
  • tests: the one failure is the axolotl NBT test (#3840, fixed in #3851). The horizon-client bin tests pass: 164 passed, 3 ignored.
  • Parity: the harness needs fcntl, which this Windows machine doesn't have.

🤖 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/3881 **Author:** [@TJKDev1](https://github.com/TJKDev1) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/own-head-pitch-follows-mouse` --- ### 📝 Commits (10+) - [`1a80673`](https://github.com/horizon-rust/horizon/commit/1a80673d50561657398e977cdd4618b1011a5c07) Worldgen: structure mobs save the fields vanilla's chunk keeps - [`52f0e38`](https://github.com/horizon-rust/horizon/commit/52f0e38d4157f13c1547ffebf85cc930bd914d3f) Add the amplified, large-biome and single-biome world types - [`22054ee`](https://github.com/horizon-rust/horizon/commit/22054eee9000528cec04c9c95c4885248f9a8112) Worldgen: chunk generation spawns its animals as vanilla, ticking or not - [`729a224`](https://github.com/horizon-rust/horizon/commit/729a224eefe003cf08f4b8496c6344b8bd992c99) Read the test registry without the explicit deref - [`0104eea`](https://github.com/horizon-rust/horizon/commit/0104eeaf33853c0ac6a3b56f4715c012408cc291) Format the world preset test - [`815c09b`](https://github.com/horizon-rust/horizon/commit/815c09b1f8d3a011b8f93273aa94a2c152c43ac9) Merge #2214 (world presets in the create-world screen) - [`bca77d1`](https://github.com/horizon-rust/horizon/commit/bca77d1ac4af96674a51b828d05e8247b59d4670) Merge origin/main - [`d0b42fb`](https://github.com/horizon-rust/horizon/commit/d0b42fb88e7b94341f13c8f45b09b3e9f5115613) Merge #2570 - [`e5ebedd`](https://github.com/horizon-rust/horizon/commit/e5ebeddb904c71fce6615b3b1c8de9d515a0a5eb) Merge #2585 - [`bc5ec6f`](https://github.com/horizon-rust/horizon/commit/bc5ec6fb462aa524ff26dfbdaf5a9e2e6fb3da17) Structure mobs test: pass the world preset #2570 added to for_dimension ### 📊 Changes **234 files changed** (+7463 additions, -1129 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -0) 📝 `crates/horizon-client-core/src/particle_type.rs` (+12 -0) 📝 `crates/horizon-client-render/src/assets.rs` (+16 -2) 📝 `crates/horizon-client-render/src/block_entity_render.rs` (+12 -1) 📝 `crates/horizon-client-render/src/brewing.rs` (+35 -16) 📝 `crates/horizon-client-render/src/chunk/block_entity.rs` (+22 -0) 📝 `crates/horizon-client-render/src/containers.rs` (+8 -1) 📝 `crates/horizon-client-render/src/datapack.rs` (+46 -1) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) 📝 `crates/horizon-client-render/src/options_ui.rs` (+99 -20) 📝 `crates/horizon-client-render/src/particles.rs` (+284 -3) ➕ `crates/horizon-client-render/src/potent_sulfur.rs` (+119 -0) 📝 `crates/horizon-client-render/src/settings.rs` (+7 -0) 📝 `crates/horizon-client-render/src/signs.rs` (+87 -4) 📝 `crates/horizon-client-render/src/sprites.rs` (+14 -0) 📝 `crates/horizon-client-render/src/streaming.rs` (+45 -3) 📝 `crates/horizon-client-render/src/ui.rs` (+15 -0) 📝 `crates/horizon-client/examples/mod_port_probe.rs` (+4 -3) 📝 `crates/horizon-client/examples/probe/block_entity_anim_fixture.rs` (+2 -1) 📝 `crates/horizon-client/examples/probe/block_transform_fixture.rs` (+2 -1) _...and 80 more files_ </details> ### 📄 Description > 🤖 Opened by TJKDev1's AI agent (Claude Code, Opus 5.5), not by TJKDev1 personally. Fixes #3844 In third person and in the inventory preview, the local player's head pitch eased in over a tick (`previous_head_pitch → head_pitch`, copied once a tick) while the camera followed the mouse every frame. ## Vanilla followed - `Entity.turn`: the pitch delta goes to `xRotO` as well as `xRot`, each clamped to ±90. So `Entity.getXRot(partialTick)`, which `LivingEntityRenderer.extractRenderState` reads, follows the mouse between ticks. - `LivingEntity.tick` / `Player.aiStep`: a change the tick makes itself, such as a sleeper's pitch going to 0, sets only `xRot`, so it still eases in. - `ClientPacketListener.handleRotatePlayer`: `setOldRot`, so the head snaps. - `ClientPacketListener.handleMovePlayer` → `setValuesFromPositionPacket`: `PositionMoveRotation.calculateAbsolute` is applied to the old rotation too (`setOldPosAndRot`). A relative pitch moves both ends; an absolute pitch snaps them. - `AbstractBoat.onPassengerTurned` ends every `Entity.turn`. ## Change - `Game::turn_player` (perspective.rs) is the single `Entity.turn` for the player. Mouse, pad, arrow keys and the control `turn` all go through it. It moves both ends of the model's head pitch and applies the boat's 105° clamp. The clamp used to run only after a mouse turn, so pad and arrow-key turns in a boat could swing past it. - remote.rs snaps the model on `PlayerRotation`, and applies `position_packet_pitch` to both ends on `PlayerPosition`. - Tests: - `own_head_pitch_follows_the_mouse_between_ticks`: turn before and after the tick, a tick change easing in, the clamp, no model. - `a_position_packet_moves_both_pitch_ends`: relative, the clamp boundary, absolute. - Breaking the fix makes the first one fail. ## pr_ready **pr_ready** (`tools/pr_ready.py` on TJKPC, against origin/main at 668419b92, 2 min 10 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +150 −44 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 423 passed (51 s) | | rustfmt | ✅ (7 s) | | clippy | ❌ failed (16 s) | | tests: horizon-client | ❌ 671 passed, 1 failed (50 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 361 affected, (1 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | None of the three ❌ come from this change: - **clippy:** `manual_range_contains` in `horizon-world/src/worldgen/aquifer/noise_based.rs:466`, plus the Windows-only `dead_code` on `log_display` in `horizon-client-render/src/gfx.rs`. Both are on main and in files this PR doesn't touch. With those two allowed, `cargo clippy -p horizon-client --all-targets -- -D warnings` is clean. - **tests:** the one failure is the axolotl NBT test (#3840, fixed in #3851). The `horizon-client` bin tests pass: 164 passed, 3 ignored. - **Parity:** the harness needs `fcntl`, which this Windows machine doesn't have. 🤖 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-03 05:11:25 +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#5272
No description provided.