Nukkit
Nukkit copied to clipboard
Player Teleport/Movement Bug
Expected Behavior
Teleporting a player to a location with yaw & pitch values passed in will set the player's yaw & pitch to the defined values no matter what.
Actual Behavior
If you teleport a player to a location whilst they are moving such as falling, the yaw & pitch will be incorrect at their teleport location (x, y, & z coordinates are correct).
Steps to Reproduce
Teleport a player to a location whilst they are moving such as falling using code below. If the player isn't moving the yaw & pitch will be correct at the teleport location.
public void teleportToSpawn(Player player) {
player.teleport(new Location(
0, // X-Coordinate
50, // Y-Coordinate
0, // Z-Coordinate
90, // Yaw
0)); // Pitch
}
Debug information
- Debug link: Didn't work, got error running command. You can view error here.
- Timings link (if relevant): N/A
Checklist:
- [] I included a
/debugpaste
link - [X] I made sure there aren't duplicates of this report (Use Search)
- [X] I made sure I am using an up-to-date version of Nukkit
- [X] I Made sure the bug/error is not caused by a plugin
I'm using the latest version of Nukkit at the time of this issue opened, commit 90cd601
of the master
branch.
If you want to test this easily, you can fly high up in air, drop & whilst falling say something random in chat to run the method to teleport you, you can change the x
, y
or z
values in the teleportToSpawn
method so that there is a block under your feet when you teleport.
@EventHandler
public void onPlayerChat(PlayerChatEvent event) {
teleportToSpawn(event.getPlayer());
}
public void teleportToSpawn(Player player) {
player.teleport(new Location(
0, // X-Coordinate
50, // Y-Coordinate
0, // Z-Coordinate
90, // Yaw
0)); // Pitch
}
Not sure but this issue from Pocketmine may be possibly related or not.
https://github.com/pmmp/PocketMine-MP/issues/821