[PR #7022] [MERGED] Draw no layers on a spectating player #7279

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

📋 Pull Request Information

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

Base: main ← Head: fix/6951-spectator-armor


📝 Commits (1)

  • 3f79ea0 Draw no layers on a spectating player (armour, held items, head item, cape, wings)

📊 Changes

4 files changed (+85 additions, -48 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+8 -4)
📝 crates/horizon-client/src/game/lan.rs (+26 -23)
📝 crates/horizon-client/src/game/perspective.rs (+43 -21)
📝 crates/horizon-client/src/mobs/render.rs (+8 -0)

📄 Description

🤖 Opened by DUzzL's AI agent (Claude Code), not by DUzzL himself.

Fixes #6951

What / why

A spectating player (local in third person, other players on a server, LAN guests) still drew its armour, held items, head item, cape, elytra, shoulder parrots, ears, stuck arrows and spin-attack layer next to the ghost head.

Vanilla draws no layers at all for a spectator. Added mobs::render::layers_shown(m) and applied it to the armour in render_visible and to every extra layer pass (local player, server players, LAN guests, mob blocks/held/head items, mod layers).

Vanilla reference

  • AvatarRenderer.shouldRenderLayers(AvatarRenderState) returns !state.isSpectator
  • LivingEntityRenderer.submit only runs layer.submit when shouldRenderLayers is true (the body is separately made translucent for spectator viewers)
  • ServerPlayer.updateInvisibilityStatus (spectator is always invisible), Entity.isInvisibleTo

Verification

  • Before: code read shows spectator path (player_model_geometry, creatures player loop, guest_model_geometry) draws armour and all layers. The extended unit test an_invisible_body_keeps_its_armour fails with the gate disabled (layers_shown true for a spectator) and passes with the fix.
  • After: cargo test -p horizon-client 2053 passed, clippy and rustfmt pass. Not run in the real game (no in-game run on this machine).
  • Python tests: 3 failures, not investigated; this PR touches no Python, mod API or native hooks, and the run was on Windows.
pr_ready

pr_ready (tools/pr_ready.py --quick --base upstream/main, against upstream/main at a04ae4067, 18 min 1 s)

Check Result
Scope pass, 4 files, +85 -48
Cargo.lock unchanged
Public tree pass
Python tests FAIL 610 run, 3 failures, 12 skipped (Windows run, not investigated)
rustfmt pass
clippy pass
tests: horizon-client, horizon-client-lib pass, 2053 passed
doc tests pass
mod API up to date pass
Parity 92 affected, to run in CI (--quick)
Label no label for a fix

🔄 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/7022 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6951-spectator-armor` --- ### 📝 Commits (1) - [`3f79ea0`](https://github.com/horizon-rust/horizon/commit/3f79ea0d00035ef556a52e320348cee1d2fb5f0e) Draw no layers on a spectating player (armour, held items, head item, cape, wings) ### 📊 Changes **4 files changed** (+85 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+8 -4) 📝 `crates/horizon-client/src/game/lan.rs` (+26 -23) 📝 `crates/horizon-client/src/game/perspective.rs` (+43 -21) 📝 `crates/horizon-client/src/mobs/render.rs` (+8 -0) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent (Claude Code), not by DUzzL himself. Fixes #6951 ## What / why A spectating player (local in third person, other players on a server, LAN guests) still drew its armour, held items, head item, cape, elytra, shoulder parrots, ears, stuck arrows and spin-attack layer next to the ghost head. Vanilla draws no layers at all for a spectator. Added `mobs::render::layers_shown(m)` and applied it to the armour in `render_visible` and to every extra layer pass (local player, server players, LAN guests, mob blocks/held/head items, mod layers). ## Vanilla reference - `AvatarRenderer.shouldRenderLayers(AvatarRenderState)` returns `!state.isSpectator` - `LivingEntityRenderer.submit` only runs `layer.submit` when `shouldRenderLayers` is true (the body is separately made translucent for spectator viewers) - `ServerPlayer.updateInvisibilityStatus` (spectator is always invisible), `Entity.isInvisibleTo` ## Verification - Before: code read shows spectator path (`player_model_geometry`, creatures player loop, `guest_model_geometry`) draws armour and all layers. The extended unit test `an_invisible_body_keeps_its_armour` fails with the gate disabled (`layers_shown` true for a spectator) and passes with the fix. - After: `cargo test -p horizon-client` 2053 passed, clippy and rustfmt pass. Not run in the real game (no in-game run on this machine). - Python tests: 3 failures, not investigated; this PR touches no Python, mod API or native hooks, and the run was on Windows. <details><summary>pr_ready</summary> **pr_ready** (`tools/pr_ready.py --quick --base upstream/main`, against upstream/main at a04ae4067, 18 min 1 s) | Check | Result | | --- | --- | | Scope | pass, 4 files, +85 -48 | | Cargo.lock | unchanged | | Public tree | pass | | Python tests | FAIL 610 run, 3 failures, 12 skipped (Windows run, not investigated) | | rustfmt | pass | | clippy | pass | | tests: horizon-client, horizon-client-lib | pass, 2053 passed | | doc tests | pass | | mod API up to date | pass | | Parity | 92 affected, to run in CI (--quick) | | Label | no label for a fix | </details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:37:01 +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#7279
No description provided.