PocketMine-MP 5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
Loading...
Searching...
No Matches
CameraFovInstruction.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
17use pmmp\encoding\Byte;
18use pmmp\encoding\ByteBufferReader;
19use pmmp\encoding\ByteBufferWriter;
20use pmmp\encoding\LE;
22
24
28 public function __construct(
29 private float $fieldOfView,
30 private float $easeTime,
31 private int $easeType,
32 private bool $clear,
33 ){}
34
35 public function getFieldOfView() : float{ return $this->fieldOfView; }
36
37 public function getEaseTime() : float{ return $this->easeTime; }
38
42 public function getEaseType() : int{ return $this->easeType; }
43
44 public function getClear() : bool{ return $this->clear; }
45
46 public static function read(ByteBufferReader $in) : self{
47 $fieldOfView = LE::readFloat($in);
48 $easeTime = LE::readFloat($in);
49 $easeType = Byte::readUnsigned($in);
50 $clear = CommonTypes::getBool($in);
51 return new self(
52 $fieldOfView,
53 $easeTime,
54 $easeType,
55 $clear
56 );
57 }
58
59 public function write(ByteBufferWriter $out) : void{
60 LE::writeFloat($out, $this->fieldOfView);
61 LE::writeFloat($out, $this->easeTime);
62 Byte::writeUnsigned($out, $this->easeType);
63 CommonTypes::putBool($out, $this->clear);
64 }
65}
__construct(private float $fieldOfView, private float $easeTime, private int $easeType, private bool $clear,)