From 7f70c87a38bcaa27ae062a5a54bb0306738e2259 Mon Sep 17 00:00:00 2001 From: yefengeeeeeeeeeee <403749250@qq.com> Date: Sun, 16 Mar 2025 13:06:14 +0800 Subject: [PATCH] MovePlayerPacket fixed --- src/Player.php | 2 +- src/network/protocol/packet/MovePlayerPacket.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Player.php b/src/Player.php index c510b5a9..3385af26 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1360,7 +1360,7 @@ class Player{ $len += strlen($move->buffer) + 1; ++$packets; $moveSent = true; - }else if($e->headYaw != $e->lastHeadYaw){ + }else if($this->PROTOCOL > ProtocolInfo12::CURRENT_PROTOCOL_12 && $e->headYaw != $e->lastHeadYaw){ $headyaw = new RotateHeadPacket(); $headyaw->eid = $e->eid; $headyaw->yaw = $e->headYaw; diff --git a/src/network/protocol/packet/MovePlayerPacket.php b/src/network/protocol/packet/MovePlayerPacket.php index 5d806a15..229f2bdf 100644 --- a/src/network/protocol/packet/MovePlayerPacket.php +++ b/src/network/protocol/packet/MovePlayerPacket.php @@ -23,7 +23,9 @@ class MovePlayerPacket extends RakNetDataPacket{ $this->z = $this->getFloat(); $this->yaw = $this->getFloat(); $this->pitch = $this->getFloat(); - $this->bodyYaw = $this->getFloat(); + if($this->PROTOCOL > 13){ + $this->bodyYaw = $this->getFloat(); + } } public function encode(){ @@ -34,7 +36,9 @@ class MovePlayerPacket extends RakNetDataPacket{ $this->putFloat($this->z); $this->putFloat($this->yaw); $this->putFloat($this->pitch); - $this->putFloat($this->bodyYaw); + if($this->PROTOCOL > 13){ + $this->putFloat($this->bodyYaw); + } } } \ No newline at end of file