From c96203b5284ca44d09a8b5c133ad58bb65429841 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 12 Oct 2018 17:08:22 +0100 Subject: [PATCH] Set immobile flag on player pre-spawn The client likes to fall involuntarily as soon as PLAYER_SPAWN PlayStatus is sent, which causes debug spam on the PM side and then movement reversions if falling far enough. This now prevents the client moving until the server knows the client has spawned. --- .../network/mcpe/handler/PreSpawnSessionHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pocketmine/network/mcpe/handler/PreSpawnSessionHandler.php b/src/pocketmine/network/mcpe/handler/PreSpawnSessionHandler.php index 69083f0147..66d8cf0b45 100644 --- a/src/pocketmine/network/mcpe/handler/PreSpawnSessionHandler.php +++ b/src/pocketmine/network/mcpe/handler/PreSpawnSessionHandler.php @@ -76,6 +76,8 @@ class PreSpawnSessionHandler extends SessionHandler{ $pk->worldName = $this->server->getMotd(); $this->session->sendDataPacket($pk); + $this->player->setImmobile(); //HACK: fix client-side falling pre-spawn + $this->player->getLevel()->sendTime($this->player); $this->player->sendAttributes(true); @@ -99,6 +101,8 @@ class PreSpawnSessionHandler extends SessionHandler{ } public function handleSetLocalPlayerAsInitialized(SetLocalPlayerAsInitializedPacket $packet) : bool{ + $this->player->setImmobile(false); //HACK: this is set to prevent client-side falling before spawn + $this->player->doFirstSpawn(); return true;