36 private float $totalTime,
37 private int $easeType,
39 private array $progressKeyFrames,
40 private array $rotationOptions,
41 private string $splineIdentifier,
42 private bool $loadFromJson
45 public function getTotalTime() : float{ return $this->totalTime; }
50 public function getEaseType() : int{ return $this->easeType; }
55 public function getCurve() : array{ return $this->curve; }
67 public function getSplineIdentifier() : string{ return $this->splineIdentifier; }
69 public function isLoadFromJson() : bool{ return $this->loadFromJson; }
71 public static function read(ByteBufferReader $in) : self{
72 $totalTime = LE::readFloat($in);
73 $easeType = Byte::readUnsigned($in);
76 $curveCount = VarInt::readUnsignedInt($in);
77 for($i = 0; $i < $curveCount; ++$i){
78 $curve[] = CommonTypes::getVector3($in);
81 $progressKeyFrames = [];
82 $progressKeyFrameCount = VarInt::readUnsignedInt($in);
83 for($i = 0; $i < $progressKeyFrameCount; ++$i){
84 $progressKeyFrames[] = CameraProgressOption::read($in);
87 $rotationOptions = [];
88 $rotationOptionCount = VarInt::readUnsignedInt($in);
89 for($i = 0; $i < $rotationOptionCount; ++$i){
90 $rotationOptions[] = CameraRotationOption::read($in);
93 $splineIdentifier = CommonTypes::getString($in);
94 $loadFromJson = CommonTypes::getBool($in);
96 return new self($totalTime, $easeType, $curve, $progressKeyFrames, $rotationOptions, $splineIdentifier, $loadFromJson);
99 public function write(ByteBufferWriter $out) : void{
100 LE::writeFloat($out, $this->totalTime);
101 Byte::writeUnsigned($out, $this->easeType);
103 VarInt::writeUnsignedInt($out, count($this->curve));
104 foreach($this->curve as $point){
105 CommonTypes::putVector3($out, $point);
108 VarInt::writeUnsignedInt($out, count($this->progressKeyFrames));
109 foreach($this->progressKeyFrames as $keyFrame){
110 $keyFrame->write($out);
113 VarInt::writeUnsignedInt($out, count($this->rotationOptions));
114 foreach($this->rotationOptions as $option){
115 $option->write($out);
118 CommonTypes::putString($out, $this->splineIdentifier);
119 CommonTypes::putBool($out, $this->loadFromJson);