Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing field ViewOffset to CameraSetInstruction #264

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(...));
}
}