PocketMine-MP
5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
ResourcePackClientResponsePacket.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
function
count;
19
20
class
ResourcePackClientResponsePacket
extends
DataPacket
implements
ServerboundPacket
{
21
public
const
NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CLIENT_RESPONSE_PACKET;
22
23
public
const
STATUS_REFUSED = 1;
24
public
const
STATUS_SEND_PACKS = 2;
25
public
const
STATUS_HAVE_ALL_PACKS = 3;
26
public
const
STATUS_COMPLETED = 4;
27
28
public
int
$status;
30
public
array $packIds = [];
31
36
public
static
function
create
(
int
$status, array $packIds) : self{
37
$result = new self;
38
$result->status = $status;
39
$result->packIds = $packIds;
40
return
$result;
41
}
42
43
protected
function
decodePayload
(
PacketSerializer
$in) : void{
44
$this->status = $in->getByte();
45
$entryCount = $in->
getLShort
();
46
$this->packIds = [];
47
while
($entryCount-- > 0){
48
$this->packIds[] = $in->
getString
();
49
}
50
}
51
52
protected
function
encodePayload
(
PacketSerializer
$out) : void{
53
$out->putByte($this->status);
54
$out->putLShort(count($this->packIds));
55
foreach
($this->packIds as $id){
56
$out->putString($id);
57
}
58
}
59
60
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
61
return $handler->handleResourcePackClientResponse($this);
62
}
63
}
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket
Definition
ResourcePackClientResponsePacket.php:20
pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
ResourcePackClientResponsePacket.php:52
pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket\handle
handle(PacketHandlerInterface $handler)
Definition
ResourcePackClientResponsePacket.php:60
pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
ResourcePackClientResponsePacket.php:43
pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket\create
static create(int $status, array $packIds)
Definition
ResourcePackClientResponsePacket.php:36
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getString
getString()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:83
pocketmine\utils\BinaryStream\getLShort
getLShort()
Definition
BinaryStream.php:149
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
pocketmine\network\mcpe\protocol\ServerboundPacket
Definition
ServerboundPacket.php:17
vendor
pocketmine
bedrock-protocol
src
ResourcePackClientResponsePacket.php
Generated by
1.12.0