From 8793ebab45d2ab68cc25c834e4834e233281e0cb Mon Sep 17 00:00:00 2001 From: Elysio Martins <77900181+Refaltor77@users.noreply.github.com> Date: Sat, 14 Oct 2023 20:55:42 +0200 Subject: [PATCH] Fix CameraSetInstruction missing fields (#198) --- src/types/camera/CameraSetInstruction.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/types/camera/CameraSetInstruction.php b/src/types/camera/CameraSetInstruction.php index 6fd9ab6c..91922b00 100644 --- a/src/types/camera/CameraSetInstruction.php +++ b/src/types/camera/CameraSetInstruction.php @@ -20,12 +20,16 @@ final class CameraSetInstruction{ public function __construct( + private int $preset, private ?CameraSetInstructionEase $ease, private ?Vector3 $cameraPosition, private ?CameraSetInstructionRotation $rotation, - private ?Vector3 $facingPosition + private ?Vector3 $facingPosition, + private ?bool $default ){} + public function getPreset() : int{ return $this->preset; } + public function getEase() : ?CameraSetInstructionEase{ return $this->ease; } public function getCameraPosition() : ?Vector3{ return $this->cameraPosition; } @@ -34,24 +38,32 @@ public function getRotation() : ?CameraSetInstructionRotation{ return $this->rot public function getFacingPosition() : ?Vector3{ return $this->facingPosition; } + public function getDefault() : ?bool{ return $this->default; } + public static function read(PacketSerializer $in) : self{ + $preset = $in->getLInt(); $ease = $in->readOptional(fn() => CameraSetInstructionEase::read($in)); $cameraPosition = $in->readOptional(fn() => $in->getVector3()); $rotation = $in->readOptional(fn() => CameraSetInstructionRotation::read($in)); $facingPosition = $in->readOptional(fn() => $in->getVector3()); + $default = $in->readOptional(fn() => $in->getBool()); return new self( + $preset, $ease, $cameraPosition, $rotation, - $facingPosition + $facingPosition, + $default ); } public function write(PacketSerializer $out) : void{ + $out->putLInt($this->preset); $out->writeOptional($this->ease, fn(CameraSetInstructionEase $v) => $v->write($out)); $out->writeOptional($this->cameraPosition, fn(Vector3 $v) => $out->putVector3($v)); $out->writeOptional($this->rotation, fn(CameraSetInstructionRotation $v) => $v->write($out)); $out->writeOptional($this->facingPosition, fn(Vector3 $v) => $out->putVector3($v)); + $out->writeOptional($this->default, fn(bool $v) => $out->putBool($v)); } }