[PR #4040] [MERGED] Turn the player when a server sends PlayerLookAt #5373

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

📋 Pull Request Information

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

Base: main ← Head: fix/remote-look-at


📝 Commits (1)

  • 396ba2e Turn the player when a server sends PlayerLookAt

📊 Changes

2 files changed (+120 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+78 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+42 -2)

📄 Description

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

What and why

Part of #3518 (row ClientPacketListener.handleLookAt).

ClientboundPlayerLookAtPacket was decoded as an unknown packet and dropped, so on a server /teleport <player> ... facing <pos|entity> and /rotate <player> facing ... never turned the camera. This decodes the packet (PlayerLookAt, with its optional entity target) and ports handleLookAt: Entity.lookAt from the player's feet or eyes towards the packet's entity (its feet or eyes) when the client tracks it, else towards the packet's point, using Mth.atan2 and Mth.wrapDegrees like vanilla.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

ClientboundPlayerLookAtPacket (read/write), ClientPacketListener.handleLookAt, ClientboundPlayerLookAtPacket.getPosition, Entity.lookAt, EntityAnchorArgument.Anchor.apply. No harness: a protocol round-trip test for both packet forms and a unit test for the rotation. Not checked in game against a vanilla server, and written without the decompiled sources at hand, so a reviewer comparing against them is welcome.

Self-check

pr_ready (tools/pr_ready.py --quick on vm, against origin/main at 518ecfb51, 2 min 9 s)

Check Result
Scope ✅ 2 files, +120 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 475 passed (35 s)
rustfmt ✅ (6 s)
tests: horizon-client, horizon-protocol ✅ 995 passed (1 min 1 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 ➖ not run (--quick): CI's parity job picks the affected harnesses

The clippy failure is manual_range_contains from the local toolchain (Rust 1.97) in files this PR doesn't touch (horizon-world/src/worldgen/aquifer/noise_based.rs, game/dragon.rs). With that lint allowed, cargo clippy -p horizon-client -p horizon-protocol --lib --bins --tests -- -D warnings is clean.

🤖 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/4040 **Author:** [@phexuss](https://github.com/phexuss) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/remote-look-at` --- ### 📝 Commits (1) - [`396ba2e`](https://github.com/horizon-rust/horizon/commit/396ba2e5e750bc3e2ad338485c90f485d5d21821) Turn the player when a server sends PlayerLookAt ### 📊 Changes **2 files changed** (+120 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+78 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+42 -2) </details> ### 📄 Description > 🤖 Opened by phexuss's AI agent (Claude Code, Claude Opus 5.5), not by phexuss personally. ## What and why Part of #3518 (row `ClientPacketListener.handleLookAt`). `ClientboundPlayerLookAtPacket` was decoded as an unknown packet and dropped, so on a server `/teleport <player> ... facing <pos|entity>` and `/rotate <player> facing ...` never turned the camera. This decodes the packet (`PlayerLookAt`, with its optional entity target) and ports `handleLookAt`: `Entity.lookAt` from the player's feet or eyes towards the packet's entity (its feet or eyes) when the client tracks it, else towards the packet's point, using `Mth.atan2` and `Mth.wrapDegrees` like vanilla. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `ClientboundPlayerLookAtPacket` (read/write), `ClientPacketListener.handleLookAt`, `ClientboundPlayerLookAtPacket.getPosition`, `Entity.lookAt`, `EntityAnchorArgument.Anchor.apply`. No harness: a protocol round-trip test for both packet forms and a unit test for the rotation. Not checked in game against a vanilla server, and written without the decompiled sources at hand, so a reviewer comparing against them is welcome. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on vm, against origin/main at 518ecfb51, 2 min 9 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +120 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 475 passed (35 s) | | rustfmt | ✅ (6 s) | | tests: horizon-client, horizon-protocol | ✅ 995 passed (1 min 1 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | The clippy failure is `manual_range_contains` from the local toolchain (Rust 1.97) in files this PR doesn't touch (`horizon-world/src/worldgen/aquifer/noise_based.rs`, `game/dragon.rs`). With that lint allowed, `cargo clippy -p horizon-client -p horizon-protocol --lib --bins --tests -- -D warnings` is clean. 🤖 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:12:08 +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#5373
No description provided.