PocketMine-MP 5.23.3 git-976fc63567edab7a6fb6aeae739f43cf9fe57de4
Loading...
Searching...
No Matches
CameraAimAssistCategories.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
18use function count;
19
21
25 public function __construct(
26 private string $identifier,
27 private array $categories
28 ){}
29
30 public function getIdentifier() : string{ return $this->identifier; }
31
35 public function getCategories() : array{ return $this->categories; }
36
37 public static function read(PacketSerializer $in) : self{
38 $identifier = $in->getString();
39
40 $categories = [];
41 for($i = 0, $len = $in->getUnsignedVarInt(); $i < $len; ++$i){
42 $categories[] = CameraAimAssistCategory::read($in);
43 }
44
45 return new self(
46 $identifier,
47 $categories
48 );
49 }
50
51 public function write(PacketSerializer $out) : void{
52 $out->putString($this->identifier);
53 $out->putUnsignedVarInt(count($this->categories));
54 foreach($this->categories as $category){
55 $category->write($out);
56 }
57 }
58}
__construct(private string $identifier, private array $categories)