diff --git a/src/pocketmine/network/protocol/ChangeDimensionPacket.php b/src/pocketmine/network/protocol/ChangeDimensionPacket.php index 2ce2a03c3..da2308b66 100644 --- a/src/pocketmine/network/protocol/ChangeDimensionPacket.php +++ b/src/pocketmine/network/protocol/ChangeDimensionPacket.php @@ -44,7 +44,7 @@ class ChangeDimensionPacket extends DataPacket{ $this->reset(); $this->putVarInt($this->dimension); $this->putVector3f($this->x, $this->y, $this->z); - $this->putByte($this->unknown); + $this->putBool($this->unknown); } } \ No newline at end of file diff --git a/src/pocketmine/network/protocol/CraftingDataPacket.php b/src/pocketmine/network/protocol/CraftingDataPacket.php index d670b701c..edbec89a4 100644 --- a/src/pocketmine/network/protocol/CraftingDataPacket.php +++ b/src/pocketmine/network/protocol/CraftingDataPacket.php @@ -163,7 +163,7 @@ class CraftingDataPacket extends DataPacket{ $writer->reset(); } - $this->putByte($this->cleanRecipes ? 1 : 0); + $this->putBool($this->cleanRecipes); } } diff --git a/src/pocketmine/network/protocol/DisconnectPacket.php b/src/pocketmine/network/protocol/DisconnectPacket.php index 1b1a5d40a..456267c9f 100644 --- a/src/pocketmine/network/protocol/DisconnectPacket.php +++ b/src/pocketmine/network/protocol/DisconnectPacket.php @@ -27,14 +27,17 @@ namespace pocketmine\network\protocol; class DisconnectPacket extends DataPacket{ const NETWORK_ID = Info::DISCONNECT_PACKET; + public $hideDisconnectionScreen = false; public $message; public function decode(){ + $this->hideDisconnectionScreen = $this->getBool(); $this->message = $this->getString(); } public function encode(){ $this->reset(); + $this->putBool($this->hideDisconnectionScreen); $this->putString($this->message); } diff --git a/src/pocketmine/network/protocol/LevelSoundEventPacket.php b/src/pocketmine/network/protocol/LevelSoundEventPacket.php index 5a7c7787e..410908493 100644 --- a/src/pocketmine/network/protocol/LevelSoundEventPacket.php +++ b/src/pocketmine/network/protocol/LevelSoundEventPacket.php @@ -44,6 +44,6 @@ class LevelSoundEventPacket extends DataPacket{ $this->putVector3f($this->x, $this->y, $this->z); $this->putVarInt($this->volume); $this->putVarInt($this->pitch); - $this->putByte($this->unknownBool); + $this->putBool($this->unknownBool); } } \ No newline at end of file diff --git a/src/pocketmine/network/protocol/MobEffectPacket.php b/src/pocketmine/network/protocol/MobEffectPacket.php index 80fa0fa1f..e7e608e68 100644 --- a/src/pocketmine/network/protocol/MobEffectPacket.php +++ b/src/pocketmine/network/protocol/MobEffectPacket.php @@ -48,7 +48,7 @@ class MobEffectPacket extends DataPacket{ $this->putByte($this->eventId); $this->putVarInt($this->effectId); $this->putVarInt($this->amplifier); - $this->putByte($this->particles); + $this->putBool($this->particles); $this->putVarInt($this->duration); } diff --git a/src/pocketmine/network/protocol/MovePlayerPacket.php b/src/pocketmine/network/protocol/MovePlayerPacket.php index b3dd65496..3c8e0f2ec 100644 --- a/src/pocketmine/network/protocol/MovePlayerPacket.php +++ b/src/pocketmine/network/protocol/MovePlayerPacket.php @@ -53,7 +53,7 @@ class MovePlayerPacket extends DataPacket{ $this->yaw = $this->getLFloat(); $this->bodyYaw = $this->getLFloat(); $this->mode = $this->getByte(); - $this->onGround = $this->getByte() > 0; + $this->onGround = $this->getBool(); } public function encode(){ @@ -64,7 +64,7 @@ class MovePlayerPacket extends DataPacket{ $this->putLFloat($this->yaw); $this->putLFloat($this->bodyYaw); //TODO $this->putByte($this->mode); - $this->putByte($this->onGround > 0); + $this->putBool($this->onGround); } } diff --git a/src/pocketmine/network/protocol/PlayerInputPacket.php b/src/pocketmine/network/protocol/PlayerInputPacket.php index 90913ef77..6ae9edd33 100644 --- a/src/pocketmine/network/protocol/PlayerInputPacket.php +++ b/src/pocketmine/network/protocol/PlayerInputPacket.php @@ -35,8 +35,8 @@ class PlayerInputPacket extends DataPacket{ public function decode(){ $this->motionX = $this->getLFloat(); $this->motionY = $this->getLFloat(); - $this->unknownBool1 = $this->getByte(); - $this->unknownBool2 = $this->getByte(); + $this->unknownBool1 = $this->getBool(); + $this->unknownBool2 = $this->getBool(); } public function encode(){ diff --git a/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php b/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php index 6f969565a..8f029c455 100644 --- a/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php +++ b/src/pocketmine/network/protocol/ResourcePacksInfoPacket.php @@ -40,7 +40,7 @@ class ResourcePacksInfoPacket extends DataPacket{ public function encode(){ $this->reset(); - $this->putByte($this->mustAccept); + $this->putBool($this->mustAccept); $this->putShort(count($this->behaviourPackEntries)); foreach($this->behaviourPackEntries as $entry){ $this->putString($entry->getPackId()); diff --git a/src/pocketmine/network/protocol/SetCommandsEnabledPacket.php b/src/pocketmine/network/protocol/SetCommandsEnabledPacket.php index ad9a92672..7510f75d7 100644 --- a/src/pocketmine/network/protocol/SetCommandsEnabledPacket.php +++ b/src/pocketmine/network/protocol/SetCommandsEnabledPacket.php @@ -35,7 +35,7 @@ class SetCommandsEnabledPacket extends DataPacket{ public function encode(){ $this->reset(); - $this->putByte($this->enabled); + $this->putBool($this->enabled); } } \ No newline at end of file diff --git a/src/pocketmine/network/protocol/SetSpawnPositionPacket.php b/src/pocketmine/network/protocol/SetSpawnPositionPacket.php index a220671e0..45a6d803b 100644 --- a/src/pocketmine/network/protocol/SetSpawnPositionPacket.php +++ b/src/pocketmine/network/protocol/SetSpawnPositionPacket.php @@ -31,6 +31,7 @@ class SetSpawnPositionPacket extends DataPacket{ public $x; public $y; public $z; + public $unknownBool; public function decode(){ @@ -40,6 +41,7 @@ class SetSpawnPositionPacket extends DataPacket{ $this->reset(); $this->putVarInt($this->unknown); $this->putBlockCoords($this->x, $this->y, $this->z); + $this->putBool($this->unknownBool); } } diff --git a/src/pocketmine/network/protocol/SetTimePacket.php b/src/pocketmine/network/protocol/SetTimePacket.php index 5ea5bf205..baf4869de 100644 --- a/src/pocketmine/network/protocol/SetTimePacket.php +++ b/src/pocketmine/network/protocol/SetTimePacket.php @@ -36,7 +36,7 @@ class SetTimePacket extends DataPacket{ public function encode(){ $this->reset(); $this->putVarInt($this->time); - $this->putByte((int) $this->started); + $this->putBool($this->started); } } diff --git a/src/pocketmine/network/protocol/StartGamePacket.php b/src/pocketmine/network/protocol/StartGamePacket.php index 939b91a19..0081d2815 100644 --- a/src/pocketmine/network/protocol/StartGamePacket.php +++ b/src/pocketmine/network/protocol/StartGamePacket.php @@ -67,13 +67,13 @@ class StartGamePacket extends DataPacket{ $this->putVarInt($this->gamemode); $this->putVarInt($this->difficulty); $this->putBlockCoords($this->spawnX, $this->spawnY, $this->spawnZ); - $this->putByte($this->hasAchievementsDisabled); + $this->putBool($this->hasAchievementsDisabled); $this->putVarInt($this->dayCycleStopTime); - $this->putByte($this->eduMode); + $this->putBool($this->eduMode); $this->putLFloat($this->rainLevel); $this->putLFloat($this->lightningLevel); - $this->putByte($this->commandsEnabled); - $this->putByte($this->isTexturePacksRequired); + $this->putBool($this->commandsEnabled); + $this->putBool($this->isTexturePacksRequired); $this->putString($this->unknown); $this->putString($this->worldName); } diff --git a/src/pocketmine/utils/BinaryStream.php b/src/pocketmine/utils/BinaryStream.php index 3896a4a4c..8323b615b 100644 --- a/src/pocketmine/utils/BinaryStream.php +++ b/src/pocketmine/utils/BinaryStream.php @@ -70,6 +70,14 @@ class BinaryStream extends \stdClass{ $this->buffer .= $str; } + public function getBool() : bool{ + return (bool) $this->getByte(); + } + + public function putBool($v){ + $this->putByte((bool) $v); + } + public function getLong(){ return Binary::readLong($this->get(8)); }