From 46e502430e1a4f6031f77f76c339ac3176a40f03 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 25 Aug 2014 13:01:39 +0200 Subject: [PATCH] Added teleport flag to MovePlayerPacket, improves player movement --- src/pocketmine/Player.php | 1 + src/pocketmine/network/protocol/MovePlayerPacket.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index dfb7b9064..6d2cab176 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2323,6 +2323,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $pk->bodyYaw = $this->yaw; $pk->pitch = $this->pitch; $pk->yaw = $this->yaw; + $pk->teleport = true; $this->directDataPacket($pk); } } diff --git a/src/pocketmine/network/protocol/MovePlayerPacket.php b/src/pocketmine/network/protocol/MovePlayerPacket.php index e5a318553..2f465baf7 100644 --- a/src/pocketmine/network/protocol/MovePlayerPacket.php +++ b/src/pocketmine/network/protocol/MovePlayerPacket.php @@ -30,6 +30,7 @@ class MovePlayerPacket extends DataPacket{ public $yaw; public $pitch; public $bodyYaw; + public $teleport = false; public function pid(){ return Info::MOVE_PLAYER_PACKET; @@ -43,6 +44,8 @@ class MovePlayerPacket extends DataPacket{ $this->yaw = $this->getFloat(); $this->pitch = $this->getFloat(); $this->bodyYaw = $this->getFloat(); + $flags = $this->getByte(); + $this->teleport = (($flags & 0x80) > 0); } public function encode(){ @@ -54,6 +57,7 @@ class MovePlayerPacket extends DataPacket{ $this->putFloat($this->yaw); $this->putFloat($this->pitch); $this->putFloat($this->bodyYaw); + $this->putByte($this->teleport == true ? 0x80 : 0x00); } } \ No newline at end of file