diff --git a/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php b/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php index f9dcc3df2..a7a3acc9b 100644 --- a/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php +++ b/src/pocketmine/network/mcpe/protocol/CommandStepPacket.php @@ -42,7 +42,7 @@ class CommandStepPacket extends DataPacket{ $this->overload = $this->getString(); $this->uvarint1 = $this->getUnsignedVarInt(); $this->currentStep = $this->getUnsignedVarInt(); - $this->done = (bool) $this->getByte(); + $this->done = $this->getBool(); $this->clientId = $this->getUnsignedVarLong(); $this->inputJson = json_decode($this->getString()); $this->outputJson = $this->getString(); diff --git a/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php b/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php index e7c818d99..0a9ad2078 100644 --- a/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php +++ b/src/pocketmine/network/mcpe/protocol/MoveEntityPacket.php @@ -45,8 +45,8 @@ class MoveEntityPacket extends DataPacket{ $this->pitch = $this->getByte() * (360.0 / 256); $this->headYaw = $this->getByte() * (360.0 / 256); $this->yaw = $this->getByte() * (360.0 / 256); - $this->onGround = $this->getByte(); - $this->teleported = $this->getByte(); + $this->onGround = $this->getBool(); + $this->teleported = $this->getBool(); } public function encode(){ @@ -56,8 +56,8 @@ class MoveEntityPacket extends DataPacket{ $this->putByte($this->pitch / (360.0 / 256)); $this->putByte($this->headYaw / (360.0 / 256)); $this->putByte($this->yaw / (360.0 / 256)); - $this->putByte($this->onGround); - $this->putByte($this->teleported); + $this->putBool($this->onGround); + $this->putBool($this->teleported); } public function handle(NetworkSession $session) : bool{ diff --git a/src/pocketmine/utils/BinaryStream.php b/src/pocketmine/utils/BinaryStream.php index ebba43124..d864bd669 100644 --- a/src/pocketmine/utils/BinaryStream.php +++ b/src/pocketmine/utils/BinaryStream.php @@ -71,11 +71,11 @@ class BinaryStream extends \stdClass{ } public function getBool() : bool{ - return (bool) $this->getByte(); + return $this->get(1) !== "\x00"; } public function putBool($v){ - $this->putByte((bool) $v); + $this->buffer .= ($v ? "\x01" : "\x00"); } public function getLong(){