PocketMine-MP
5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
ClientCacheBlobStatusPacket.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
ClientCacheBlobStatusPacket
extends
DataPacket
implements
ServerboundPacket
{
21
public
const
NETWORK_ID = ProtocolInfo::CLIENT_CACHE_BLOB_STATUS_PACKET;
22
24
private
array $hitHashes = [];
26
private
array $missHashes = [];
27
33
public
static
function
create
(array $hitHashes, array $missHashes) : self{
34
$result = new self;
35
$result->hitHashes = $hitHashes;
36
$result->missHashes = $missHashes;
37
return
$result;
38
}
39
43
public
function
getHitHashes
() : array{
44
return $this->hitHashes;
45
}
46
50
public
function
getMissHashes
() : array{
51
return $this->missHashes;
52
}
53
54
protected
function
decodePayload
(
PacketSerializer
$in) : void{
55
$missCount = $in->getUnsignedVarInt();
56
$hitCount = $in->
getUnsignedVarInt
();
57
for
($i = 0; $i < $missCount; ++$i){
58
$this->missHashes[] = $in->
getLLong
();
59
}
60
for
($i = 0; $i < $hitCount; ++$i){
61
$this->hitHashes[] = $in->
getLLong
();
62
}
63
}
64
65
protected
function
encodePayload
(
PacketSerializer
$out) : void{
66
$out->putUnsignedVarInt(count($this->missHashes));
67
$out->
putUnsignedVarInt
(count($this->hitHashes));
68
foreach
($this->missHashes as $hash){
69
$out->putLLong($hash);
70
}
71
foreach
($this->hitHashes as $hash){
72
$out->putLLong($hash);
73
}
74
}
75
76
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
77
return $handler->handleClientCacheBlobStatus($this);
78
}
79
}
pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket
Definition
ClientCacheBlobStatusPacket.php:20
pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket\create
static create(array $hitHashes, array $missHashes)
Definition
ClientCacheBlobStatusPacket.php:33
pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket\handle
handle(PacketHandlerInterface $handler)
Definition
ClientCacheBlobStatusPacket.php:76
pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
ClientCacheBlobStatusPacket.php:65
pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket\getHitHashes
getHitHashes()
Definition
ClientCacheBlobStatusPacket.php:43
pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
ClientCacheBlobStatusPacket.php:54
pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket\getMissHashes
getMissHashes()
Definition
ClientCacheBlobStatusPacket.php:50
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\utils\BinaryStream\getUnsignedVarInt
getUnsignedVarInt()
Definition
BinaryStream.php:307
pocketmine\utils\BinaryStream\getLLong
getLLong()
Definition
BinaryStream.php:293
pocketmine\utils\BinaryStream\putUnsignedVarInt
putUnsignedVarInt(int $v)
Definition
BinaryStream.php:314
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
pocketmine\network\mcpe\protocol\ServerboundPacket
Definition
ServerboundPacket.php:17
vendor
pocketmine
bedrock-protocol
src
ClientCacheBlobStatusPacket.php
Generated by
1.12.0