From ff3bdfb607691b9aac32888434edffc0e4e92297 Mon Sep 17 00:00:00 2001 From: Tobias Grether Date: Tue, 13 Aug 2024 15:56:10 +0200 Subject: [PATCH] chore: fix codestyle --- src/CorrectPlayerMovePredictionPacket.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CorrectPlayerMovePredictionPacket.php b/src/CorrectPlayerMovePredictionPacket.php index 0fd2f787..aa6c42e8 100644 --- a/src/CorrectPlayerMovePredictionPacket.php +++ b/src/CorrectPlayerMovePredictionPacket.php @@ -59,7 +59,7 @@ public function getTick() : int{ return $this->tick; } public function getPredictionType() : int{ return $this->predictionType; } - public function getVehicleRotation() : ?Vector2{ return $this->vehicleRotation; } + public function getVehicleRotation() : ?Vector2{ return $this->vehicleRotation; } protected function decodePayload(PacketSerializer $in) : void{ $this->predictionType = $in->getByte(); @@ -76,7 +76,11 @@ protected function encodePayload(PacketSerializer $out) : void{ $out->putByte($this->predictionType); $out->putVector3($this->position); $out->putVector3($this->delta); - if($this->predictionType === self::PREDICTION_TYPE_VEHICLE && $this->vehicleRotation != null) { + if($this->predictionType === self::PREDICTION_TYPE_VEHICLE) { + if($this->vehicleRotation == null) { // this should never be the case + throw new \InvalidArgumentException("CorrectPlayerMovePredictionPackets with type VEHICLE require a vehicleRotation to be provided"); + } + $out->putFloat($this->vehicleRotation->getX()); $out->putFloat($this->vehicleRotation->getY()); }