Skip to content

fix: hide ysm head in first person on 26.1 without breaking mod captures - #659

Open
brokestar233 wants to merge 1 commit into
tr7zw:mainfrom
Meow404club:main
Open

fix: hide ysm head in first person on 26.1 without breaking mod captures#659
brokestar233 wants to merge 1 commit into
tr7zw:mainfrom
Meow404club:main

Conversation

@brokestar233

Copy link
Copy Markdown

Problem

When playing with Yes Steve Model on 1.21.9+ (26.1.x), the
YSM player model keeps its head rendered in first person, so the camera sits inside the head.
On 1.20.1 the head hiding worked fine.

Root cause

YSM is compatible through FirstPersonAPI#isRenderingPlayer(). On 1.20.1 the flag is raised
around FirstPerson's synchronous player render, which is exactly when YSM evaluates its
animation, so the head gets hidden.

On 1.21.9+ the render pipeline is split into state extraction and submission, and YSM 2.6.5
now builds its render data at extraction time and defers the animation evaluation (including
the head visibility write) to the submit of that state. FirstPerson only raised the flag
around its own extraction, so:

  • the deferred evaluation ran with the flag already down → the head stayed visible
  • YSM's own re-extraction of the local player (end of the level extract) force-evaluated the
    animation with the flag down and memoized that result, since evaluation results are cached
    per render data

Fix

Two narrow windows around EntityRenderDispatcher, enabled for >= 26.1:

  1. Extraction window — while the camera entity's render state is extracted and the mod is
    active, widen isRenderingPlayer() via a separate flag (cameraEntityExtract) instead of
    the regular one. YSM then attaches its first person context on every extraction of the
    local player (including its own re-extractions) and re-evaluates head visibility on each
    submit.
  2. Submit window — only the render state FirstPerson extracted itself (marked via the
    existing isCameraEntity state flag) raises the regular flag during its submit. That is
    the one evaluation that must hide the head for the actual frame render.

Because evaluations triggered by other mods run with the flag down, YSM's hide block
explicitly resets the head state — so RealCamera bindings, its model view screen and GUI
captures keep rendering the full model. Accordingly:

  • LivingEntityRendererMixin and the helmet removal in PlayerMixin now use the un-widened
    flag (isRenderingPlayerRaw()), so only states extracted by FirstPerson are marked
  • all new injections use require = 0 / expect = 0 and are preprocessor-gated to
    >= 26.1, leaving 1.20.1 and every other version untouched

Testing

  • MC 26.1.2 + NeoForge 26.1.2.105 + YSM 2.6.5: head is hidden in first person again
  • MC 26.1.2 + NeoForge + YSM + RealCamera: camera binding works, binding screen shows the
    full model, body render unaffected
  • MC 26.1.2 + NeoForge + RealCamera (no YSM): no regression
  • Build verified for 26.1-neoforge, 26.1-fabric; 1.20.1-fabric, 1.21.11-fabric and
    26.2-fabric compile with the new code fully preprocessed out / behavior unchanged

PS:This PR was generated with the help of AI and requires careful review.

Ysm builds its render data from render states and checks
FirstPersonAPI#isRenderingPlayer while evaluating its animation, which on
26.1 happens lazily during the submit of the state instead of during the
synchronous render. The flag was only raised around firstperson's own
extraction, so the evaluation always ran with it down and the ysm head
stayed visible.

- widen the flag while the camera entity render state is extracted
  (without marking those states), so ysm attaches its first person
  context on every extraction, including its own re-extractions
- keep a submit window only for the state firstperson extracted itself;
  that evaluation runs with the flag up and bakes the model headless
  for the frame render, while evaluations triggered by other mods run
  with it down, explicitly resetting the head state and keeping their
  captures intact (realcamera bindings, model view screen, guis)
- drive the render state marker and helmet removal via the un-widened
  flag so only states extracted by firstperson are affected

Signed-off-by: brokestar233 <3765589194@qq.com>
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: ee98b519-9780-4232-bc59-3b1a3be60bdd

📥 Commits

Reviewing files that changed from the base of the PR and between 8460fa5 and ccd5df8.

📒 Files selected for processing (4)
  • src/main/java/dev/tr7zw/firstperson/FirstPersonModelCore.java
  • src/main/java/dev/tr7zw/firstperson/mixins/LivingEntityRendererMixin.java
  • src/main/java/dev/tr7zw/firstperson/mixins/PlayerMixin.java
  • src/main/java/dev/tr7zw/firstperson/mixins/RenderDispatcherMixin.java

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

The change adds separate camera-extraction and raw-rendering state checks. Minecraft 26.1 render hooks track camera entities during extraction and submission. Related mixins use the raw state for camera marking and item hiding.

Changes

Camera entity render-state handling

Layer / File(s) Summary
Render-state flag contract
src/main/java/dev/tr7zw/firstperson/FirstPersonModelCore.java
Adds cameraEntityExtract, widens isRenderingPlayer() during extraction, and adds isRenderingPlayerRaw() for the original state.
Render extraction and submission flow
src/main/java/dev/tr7zw/firstperson/mixins/RenderDispatcherMixin.java
Updates the compatibility guard to Minecraft 26.1 and adds hooks for camera-entity extraction, submission, and state reset.
Raw-state consumers
src/main/java/dev/tr7zw/firstperson/mixins/LivingEntityRendererMixin.java, src/main/java/dev/tr7zw/firstperson/mixins/PlayerMixin.java
Uses isRenderingPlayerRaw() when marking extracted camera states and hiding player head or hand items.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to ccd5d

This change restores first-person YSM head rendering on Minecraft 26.1.x while limiting head and item hiding to FirstPerson-controlled states, preserving mod and GUI captures. No actionable merge-blocking risk is identified.

Suggested reviewers: tr7zw

Sequence Diagram(s)

sequenceDiagram
  participant RenderDispatcherMixin
  participant FirstPersonModelCore
  participant CameraRenderState
  RenderDispatcherMixin->>FirstPersonModelCore: Enable cameraEntityExtract during extraction
  RenderDispatcherMixin->>CameraRenderState: Detect camera-entity render state
  RenderDispatcherMixin->>FirstPersonModelCore: Enable player rendering during submission
  RenderDispatcherMixin->>FirstPersonModelCore: Reset extraction and rendering state
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main fix: hiding the YSM head in first person on Minecraft 26.1 while preserving mod captures.
Description check ✅ Passed The description directly explains the YSM head-rendering problem, the 26.1 render-state timing issue, the implementation, compatibility limits, and test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant