Skip to content

Add Player#unsetFixedPose - #12853

Merged
NonSwag merged 3 commits into
PaperMC:mainfrom
hjk321:reset-pose
Aug 2, 2026
Merged

Add Player#unsetFixedPose#12853
NonSwag merged 3 commits into
PaperMC:mainfrom
hjk321:reset-pose

Conversation

@hjk321

@hjk321 hjk321 commented Jul 16, 2025

Copy link
Copy Markdown
Contributor

Paper adds the capability of setting a "fixed" pose that is not updated every tick like normal. In certain situations, a plugin might have set a fixed pose and now wishes to reset the pose to a "natural" state. Sure, we could just use setPose with the current pose and fixed=false, but you'd have to wait until the next tick for the pose to update, and sometimes you need to get information from the new pose now.

This commit adds a new method for the Player class that clears the fixed pose state and immediately determines the correct pose based on the player's current state. Relevant player data, such as eye height, is immediately updated as well.

A practical example for why this is useful: In my plugin, I have a fixed swimming pose on the server-side, but obviously this doesn't carry over to the client. When the player fires a bow or launches a projectile, this would be useful to clear the fixed pose, compare the eye heights, and adjust the location of the new projectile accordingly. There's probably several other use cases for this.

Effectively zero maintenance cost, as we're just wrapping a vanilla function that's unlikely to go anywhere. There's also no unanticipated side effects to this operation, since the API can already manipulate a player's pose ad-hoc. This just manipulates it more intelligently. I know poses are an Entity thing and not exclusive to players, but the vanilla code we hook into is specifically for players, and manipulation of non-player poses aren't as common as a use case. Therefore, I didn't think a more generic solution was warranted.

@hjk321
hjk321 requested a review from a team as a code owner July 16, 2025 16:26
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Jul 16, 2025
Comment thread paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch Outdated
@github-project-automation github-project-automation Bot moved this from Awaiting review to Changes required in Paper PR Queue Jul 19, 2025
In certain situations, a plugin might have set a fixed pose and now
wishes to reset the pose to a "natural" state. Sure, we could
just use setPose with the current pose and fixed=false, but
you'd have to wait until the next tick for the pose to update,
and sometimes you need to get information from the new pose *now*.

This commit adds a new method for the Player class that clears
the fixed pose state and immediately determines the correct
pose based on the player's current state. Relevant player data,
such as eye height, is immediately updated as well.

@lynxplay lynxplay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit iffy on the method name, resetting a pose seems potentially conflicting given the default pose of "standing" exists.

Maybe restoreVanillaPose() ? Something along those lines, idk maybe copilot has some ideas.

Code lgtm beyond that.

@Warriorrrr

Copy link
Copy Markdown
Member

Maybe something with recalculate/update in it, recalculateActualPose?

@Warriorrrr Warriorrrr added type: feature Request for a new Feature. status: input wanted Looking for community feedback on this issue. scope: api labels Aug 1, 2026
@Warriorrrr

Copy link
Copy Markdown
Member

Changed to unsetFixedPose as a suggested name from the contrib channel on discord

@Warriorrrr Warriorrrr changed the title Add resetPose to Player class Add Player#unsetFixedPose Aug 2, 2026
@papermc-projects papermc-projects Bot moved this from Changes required to Full approval in Paper PR Queue Aug 2, 2026
@NonSwag
NonSwag merged commit 0a99345 into PaperMC:main Aug 2, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from Full approval to Merged in Paper PR Queue Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: api status: input wanted Looking for community feedback on this issue. type: feature Request for a new Feature.

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

7 participants