Fix #323: lay pose renders at world bottom on Folia - #325
Open
RICE0707 wants to merge 3 commits into
Open
Conversation
* What went wrong:
Configuration cache state could not be cached: field `classpath` of task `:v1_21_11:compileJava` of type `org.gradle.api.tasks.compile.JavaCompile`: error writing value of type 'org.gradle.api.internal.artifacts.configurations.DefaultResolvableConfiguration'
> Could not resolve all files for configuration ':v1_21_11:compileClasspath'.
> Could not find net.kyori:adventure-text-serializer-ansi:.
Required by:
project ':v1_21_11' > io.papermc.paper:dev-bundle:1.21.11-R0.1-SNAPSHOT:20260511.115010-91
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Folia, when a player uses
/lay, viewers see the laying model snapped tothe bottom of the world (
Y = minHeight) instead of at the seat (#323).Not reproducible on Paper — this only occurs on Folia.
Root cause
The laying model is a packet-only fake NPC (a
ServerPlayerthat is neveradded to the world), so its position on each viewer's client is determined
entirely by the packets GSit sends — and after the initial spawn bundle, the old
code never re-sends a position packet.
The
/laytrick works like this:SLEEPINGpose with its sleep position pointing atthat bed, so the client snaps the sleeping entity down to
Y = minHeight.pull the NPC back up to the seat.
This is a timing-sensitive correction: the snap-to-bed is a client-side reaction
to the sleep metadata, and the teleport-back is a single, one-shot fix.
teleport reliably lands as the final position, so the model stays at the seat.
looser relative timing. The single in-bundle teleport can lose the race
against the client applying the sleeping state, and because nothing re-sends a
position afterwards, the NPC is left stuck at world bottom.
The fix already ships in every module from
v1_21_2onward: after the spawnbundle, the teleport is re-sent on the next 1 and 2 ticks through the
entity scheduler (guarded by
height < 1), which reliably wins the race andrestores the seat position on Folia. The double, cross-tick re-send is what
makes it robust against the timing race.
Modules
v1_19_4throughv1_21— every Folia-capable version predatingv1_21_2— never received this correction, so they reproduce the bug. (Foliaonly exists from 1.19.4+, so older modules cannot run on Folia and are not
affected.)
Fix
Backport the exact
v1_21_2correction to the affected Folia-capable modules:v1_19_4,v1_20,v1_20_2,v1_20_3,v1_20_5,v1_21Each gains a
heightfield (using that module's own positioning basis) and thedelayed
teleportNpcPacketre-send inaddViewerPlayer, identical to thealready-shipped
v1_21_2implementation.Fixes #323