Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfacing resets player velocity to 0 #1338

Open
LadyCailin opened this issue Dec 20, 2022 · 2 comments
Open

pfacing resets player velocity to 0 #1338

LadyCailin opened this issue Dec 20, 2022 · 2 comments
Labels
bug Things that don't work as designed discussion wanted There are still undetermined aspects of this issue, please comment!

Comments

@LadyCailin
Copy link
Member

As this is a commonly used function, this can be used to avoid fall damage when run just before landing. Player velocity should be looked up before the location set, then set back to that immediately afterwards. In the meantime, this can be worked around by doing this in code, but this shouldn't be necessary. Untested, but likely works with set_ploc as well, though perhaps this is not a problem.

Discussion wanted, as this is a breaking change.

@LadyCailin LadyCailin added bug Things that don't work as designed discussion wanted There are still undetermined aspects of this issue, please comment! labels Dec 20, 2022
@PseudoKnight
Copy link
Contributor

PseudoKnight commented Dec 20, 2022

pfacing() has always just been a teleport and behaved this way. Even re-applying the velocity will still result in jutter.

Technically the real solution is to use relative teleport flags. This was only possible via nms until it was added to Paper earlier this year in 1.19.

https://jd.papermc.io/paper/1.19/org/bukkit/entity/Player.html#teleport(org.bukkit.Location,org.bukkit.event.player.PlayerTeleportEvent.TeleportCause,boolean,boolean,io.papermc.paper.entity.RelativeTeleportFlag...)

@Pieter12345
Copy link
Contributor

Might it be possible to maintain velocity through the Bukkit API, then we should consider adding an optional keepVelocity or resetVelocity boolean parameter to pfacing(). This solution is possible without changing existing behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that don't work as designed discussion wanted There are still undetermined aspects of this issue, please comment!
Projects
None yet
Development

No branches or pull requests

3 participants