Skip to content

Commit

Permalink
chore: re-add vehicle rotation validation in create function
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasGrether committed Aug 13, 2024
1 parent a76d552 commit aa1133f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/CorrectPlayerMovePredictionPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ class CorrectPlayerMovePredictionPacket extends DataPacket implements Clientboun
private int $predictionType;
private ?Vector2 $vehicleRotation;

/**
* @generate-create-func
*/
public static function create(Vector3 $position, Vector3 $delta, bool $onGround, int $tick, int $predictionType, ?Vector2 $vehicleRotation) : self{
$result = new self;
$result->position = $position;
$result->delta = $delta;
$result->onGround = $onGround;
$result->tick = $tick;
$result->predictionType = $predictionType;

if($predictionType === self::PREDICTION_TYPE_VEHICLE && $vehicleRotation == null) {
throw new \LogicException("CorrectPlayerMovePredictionPackets with type VEHICLE require a vehicleRotation to be provided");
}

$result->vehicleRotation = $vehicleRotation;
return $result;
}
Expand Down

0 comments on commit aa1133f

Please sign in to comment.