Skip to content

pfacing resets player velocity to 0 #1338

Description

@LadyCailin

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.

Activity

  1. added
    bugThings that don't work as designed
    discussion wantedThere are still undetermined aspects of this issue, please comment!
    on Dec 20, 2022
  2. PseudoKnight commented on Dec 20, 2022

    @PseudoKnight
    Contributor

    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...)

  3. Pieter12345 commented on Dec 20, 2022

    @Pieter12345
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThings that don't work as designeddiscussion wantedThere are still undetermined aspects of this issue, please comment!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions