PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
CameraAimAssistPresetsPacket.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
13
declare(strict_types=1);
14
15
namespace
pocketmine\network\mcpe\protocol;
16
17
use
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
;
18
use
pocketmine\network\mcpe\protocol\types\camera\CameraAimAssistCategories
;
19
use
pocketmine\network\mcpe\protocol\types\camera\CameraAimAssistPreset
;
20
use
function
count;
21
22
class
CameraAimAssistPresetsPacket
extends
DataPacket
implements
ClientboundPacket
{
23
public
const
NETWORK_ID = ProtocolInfo::CAMERA_AIM_ASSIST_PRESETS_PACKET;
24
26
private
array $categories;
28
private
array $presets;
29
35
public
static
function
create
(array $categories, array $presets) : self{
36
$result = new self;
37
$result->categories = $categories;
38
$result->presets = $presets;
39
return
$result;
40
}
41
45
public
function
getCategories
() : array{ return $this->categories; }
46
50
public
function
getPresets
() : array{ return $this->presets; }
51
52
protected
function
decodePayload
(
PacketSerializer
$in) : void{
53
$this->categories = [];
54
for
($i = 0, $count = $in->
getUnsignedVarInt
(); $i < $count; ++$i){
55
$this->categories[] = CameraAimAssistCategories::read($in);
56
}
57
58
$this->presets = [];
59
for
($i = 0, $count = $in->
getUnsignedVarInt
(); $i < $count; ++$i){
60
$this->presets[] = CameraAimAssistPreset::read($in);
61
}
62
}
63
64
protected
function
encodePayload
(
PacketSerializer
$out) : void{
65
$out->putUnsignedVarInt(count($this->categories));
66
foreach
($this->categories as $category){
67
$category->write($out);
68
}
69
70
$out->
putUnsignedVarInt
(count($this->presets));
71
foreach
($this->presets as $preset){
72
$preset->write($out);
73
}
74
}
75
76
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
77
return $handler->handleCameraAimAssistPresets($this);
78
}
79
}
pocketmine\network\mcpe\protocol\CameraAimAssistPresetsPacket
Definition
CameraAimAssistPresetsPacket.php:22
pocketmine\network\mcpe\protocol\CameraAimAssistPresetsPacket\create
static create(array $categories, array $presets)
Definition
CameraAimAssistPresetsPacket.php:35
pocketmine\network\mcpe\protocol\CameraAimAssistPresetsPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
CameraAimAssistPresetsPacket.php:52
pocketmine\network\mcpe\protocol\CameraAimAssistPresetsPacket\handle
handle(PacketHandlerInterface $handler)
Definition
CameraAimAssistPresetsPacket.php:76
pocketmine\network\mcpe\protocol\CameraAimAssistPresetsPacket\getPresets
getPresets()
Definition
CameraAimAssistPresetsPacket.php:50
pocketmine\network\mcpe\protocol\CameraAimAssistPresetsPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
CameraAimAssistPresetsPacket.php:64
pocketmine\network\mcpe\protocol\CameraAimAssistPresetsPacket\getCategories
getCategories()
Definition
CameraAimAssistPresetsPacket.php:45
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\types\camera\CameraAimAssistCategories
Definition
CameraAimAssistCategories.php:20
pocketmine\network\mcpe\protocol\types\camera\CameraAimAssistPreset
Definition
CameraAimAssistPreset.php:20
pocketmine\utils\BinaryStream\getUnsignedVarInt
getUnsignedVarInt()
Definition
BinaryStream.php:307
pocketmine\utils\BinaryStream\putUnsignedVarInt
putUnsignedVarInt(int $v)
Definition
BinaryStream.php:314
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
vendor
pocketmine
bedrock-protocol
src
CameraAimAssistPresetsPacket.php
Generated by
1.12.0