PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
CameraFadeInstruction.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol\types\camera;
16
20
22
23 public function __construct(
24 private ?Time $time,
25 private ?Color $color,
26 ){}
27
28 public function getTime() : ?Time{ return $this->time; }
29
30 public function getColor() : ?Color{ return $this->color; }
31
32 public static function read(PacketSerializer $in) : self{
33 $time = $in->readOptional(fn() => Time::read($in));
34 $color = $in->readOptional(fn() => Color::read($in));
35 return new self(
36 $time,
37 $color
38 );
39 }
40
41 public function write(PacketSerializer $out) : void{
42 $out->writeOptional($this->time, fn(Time $v) => $v->write($out));
43 $out->writeOptional($this->color, fn(Color $v) => $v->write($out));
44 }
45}