CloudburstMC / Nukkit

Cloudburst Nukkit - Nuclear-Powered Minecraft: Bedrock Edition Server Software
https://cloudburstmc.org
GNU General Public License v3.0
1.22k stars 419 forks source link

Player Teleport/Movement Bug #1815

Open Poswn opened 3 years ago

Poswn commented 3 years ago

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

Checklist:

Poswn commented 3 years ago

I'm using the latest version of Nukkit at the time of this issue opened, commit 90cd601 of the master branch.

Poswn commented 3 years ago

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
}
Poswn commented 3 years ago

Not sure but this issue from Pocketmine may be possibly related or not. https://github.com/pmmp/PocketMine-MP/issues/821