Skip to content

Commit

Permalink
Add missing field ViewOffset to CameraSetInstruction (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxyum authored Aug 15, 2024
1 parent a2f231b commit 73def0f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/types/camera/CameraSetInstruction.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace pocketmine\network\mcpe\protocol\types\camera;

use pocketmine\math\Vector2;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;

Expand All @@ -25,6 +26,7 @@ public function __construct(
private ?Vector3 $cameraPosition,
private ?CameraSetInstructionRotation $rotation,
private ?Vector3 $facingPosition,
private ?Vector2 $viewOffset,
private ?bool $default
){}

Expand All @@ -38,6 +40,8 @@ public function getRotation() : ?CameraSetInstructionRotation{ return $this->rot

public function getFacingPosition() : ?Vector3{ return $this->facingPosition; }

public function getViewOffset() : ?Vector2{ return $this->viewOffset; }

public function getDefault() : ?bool{ return $this->default; }

public static function read(PacketSerializer $in) : self{
Expand All @@ -46,6 +50,7 @@ public static function read(PacketSerializer $in) : self{
$cameraPosition = $in->readOptional($in->getVector3(...));
$rotation = $in->readOptional(fn() => CameraSetInstructionRotation::read($in));
$facingPosition = $in->readOptional($in->getVector3(...));
$viewOffset = $in->readOptional($in->getVector2(...));
$default = $in->readOptional($in->getBool(...));

return new self(
Expand All @@ -54,6 +59,7 @@ public static function read(PacketSerializer $in) : self{
$cameraPosition,
$rotation,
$facingPosition,
$viewOffset,
$default
);
}
Expand All @@ -64,6 +70,7 @@ public function write(PacketSerializer $out) : void{
$out->writeOptional($this->cameraPosition, $out->putVector3(...));
$out->writeOptional($this->rotation, fn(CameraSetInstructionRotation $v) => $v->write($out));
$out->writeOptional($this->facingPosition, $out->putVector3(...));
$out->writeOptional($this->viewOffset, $out->putVector2(...));
$out->writeOptional($this->default, $out->putBool(...));
}
}

0 comments on commit 73def0f

Please sign in to comment.