diff --git a/src/LevelChunkPacket.php b/src/LevelChunkPacket.php index d2824b41..cb3dec89 100644 --- a/src/LevelChunkPacket.php +++ b/src/LevelChunkPacket.php @@ -91,7 +91,9 @@ public function getExtraPayload() : string{ protected function decodePayload(PacketSerializer $in) : void{ $this->chunkPosition = ChunkPosition::read($in); - $this->dimensionId = $in->getVarInt(); + if($in->getProtocol() >= ProtocolInfo::PROTOCOL_649){ + $this->dimensionId = $in->getVarInt(); + } $subChunkCountButNotReally = $in->getUnsignedVarInt(); if($subChunkCountButNotReally === self::CLIENT_REQUEST_FULL_COLUMN_FAKE_COUNT){ @@ -121,7 +123,9 @@ protected function decodePayload(PacketSerializer $in) : void{ protected function encodePayload(PacketSerializer $out) : void{ $this->chunkPosition->write($out); - $out->putVarInt($this->dimensionId); + if($out->getProtocol() >= ProtocolInfo::PROTOCOL_649){ + $out->putVarInt($this->dimensionId); + } if($this->clientSubChunkRequestsEnabled){ if($this->subChunkCount === PHP_INT_MAX){ diff --git a/src/PlayerAuthInputPacket.php b/src/PlayerAuthInputPacket.php index 613f7089..80fb407e 100644 --- a/src/PlayerAuthInputPacket.php +++ b/src/PlayerAuthInputPacket.php @@ -250,8 +250,10 @@ protected function decodePayload(PacketSerializer $in) : void{ }; } } - if($this->hasFlag(PlayerAuthInputFlags::IN_CLIENT_PREDICTED_VEHICLE)){ - $this->clientPredictedVehicleActorUniqueId = $in->getActorUniqueId(); + if($in->getProtocol() >= ProtocolInfo::PROTOCOL_649){ + if($this->hasFlag(PlayerAuthInputFlags::IN_CLIENT_PREDICTED_VEHICLE)){ + $this->clientPredictedVehicleActorUniqueId = $in->getActorUniqueId(); + } } if($in->getProtocol() >= ProtocolInfo::PROTOCOL_575){ $this->analogMoveVecX = $in->getLFloat(); @@ -291,8 +293,10 @@ protected function encodePayload(PacketSerializer $out) : void{ $blockAction->write($out); } } - if($this->clientPredictedVehicleActorUniqueId !== null){ - $out->putActorUniqueId($this->clientPredictedVehicleActorUniqueId); + if($out->getProtocol() >= ProtocolInfo::PROTOCOL_649){ + if($this->clientPredictedVehicleActorUniqueId !== null){ + $out->putActorUniqueId($this->clientPredictedVehicleActorUniqueId); + } } if($out->getProtocol() >= ProtocolInfo::PROTOCOL_575){ $out->putLFloat($this->analogMoveVecX); diff --git a/src/PlayerListPacket.php b/src/PlayerListPacket.php index b622aa7e..48b7a516 100644 --- a/src/PlayerListPacket.php +++ b/src/PlayerListPacket.php @@ -69,7 +69,9 @@ protected function decodePayload(PacketSerializer $in) : void{ $entry->skinData = $in->getSkin(); $entry->isTeacher = $in->getBool(); $entry->isHost = $in->getBool(); - $entry->isSubClient = $in->getBool(); + if($in->getProtocol() >= ProtocolInfo::PROTOCOL_649){ + $entry->isSubClient = $in->getBool(); + } }else{ $entry->uuid = $in->getUUID(); } @@ -97,7 +99,9 @@ protected function encodePayload(PacketSerializer $out) : void{ $out->putSkin($entry->skinData); $out->putBool($entry->isTeacher); $out->putBool($entry->isHost); - $out->putBool($entry->isSubClient); + if($out->getProtocol() >= ProtocolInfo::PROTOCOL_649){ + $out->putBool($entry->isSubClient); + } }else{ $out->putUUID($entry->uuid); } diff --git a/src/ProtocolInfo.php b/src/ProtocolInfo.php index 5266ca9a..6e257103 100644 --- a/src/ProtocolInfo.php +++ b/src/ProtocolInfo.php @@ -40,6 +40,7 @@ private function __construct(){ public const BASE_VERSION = '1.18.0'; + public const PROTOCOL_649 = 649; // 1.20.60 public const PROTOCOL_630 = 630; // 1.20.50 public const PROTOCOL_622 = 622; // 1.20.40 public const PROTOCOL_618 = 618; // 1.20.30 @@ -61,6 +62,7 @@ private function __construct(){ public const PROTOCOL_475 = 475; // v1.18.0 public const COMPATIBLE_PROTOCOL = [ + self::PROTOCOL_649, self::PROTOCOL_630, self::PROTOCOL_622, self::PROTOCOL_618,