Skip to content

Commit

Permalink
chore: fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasGrether committed Aug 13, 2024
1 parent 27a0a6c commit ff3bdfb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/CorrectPlayerMovePredictionPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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());
}
Expand Down

0 comments on commit ff3bdfb

Please sign in to comment.