PocketMine-MP
5.21.2 git-09bf203267aca9b83a09640e17bfac0fc7b58ff8
Loading...
Searching...
No Matches
PlayerFogPacket.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
PlayerFogPacket
extends
DataPacket
implements
ClientboundPacket
{
21
public
const
NETWORK_ID = ProtocolInfo::PLAYER_FOG_PACKET;
22
27
private
array $fogLayers;
28
34
public
static
function
create
(array $fogLayers) : self{
35
$result = new self;
36
$result->fogLayers = $fogLayers;
37
return
$result;
38
}
39
44
public
function
getFogLayers
() : array{ return $this->fogLayers; }
45
46
protected
function
decodePayload
(
PacketSerializer
$in) : void{
47
$this->fogLayers = [];
48
for
($i = 0, $len = $in->
getUnsignedVarInt
(); $i < $len; ++$i){
49
$this->fogLayers[] = $in->
getString
();
50
}
51
}
52
53
protected
function
encodePayload
(
PacketSerializer
$out) : void{
54
$out->putUnsignedVarInt(count($this->fogLayers));
55
foreach
($this->fogLayers as $fogLayer){
56
$out->putString($fogLayer);
57
}
58
}
59
60
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
61
return $handler->handlePlayerFog($this);
62
}
63
}
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\PlayerFogPacket
Definition
PlayerFogPacket.php:20
pocketmine\network\mcpe\protocol\PlayerFogPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
PlayerFogPacket.php:53
pocketmine\network\mcpe\protocol\PlayerFogPacket\create
static create(array $fogLayers)
Definition
PlayerFogPacket.php:34
pocketmine\network\mcpe\protocol\PlayerFogPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
PlayerFogPacket.php:46
pocketmine\network\mcpe\protocol\PlayerFogPacket\handle
handle(PacketHandlerInterface $handler)
Definition
PlayerFogPacket.php:60
pocketmine\network\mcpe\protocol\PlayerFogPacket\getFogLayers
getFogLayers()
Definition
PlayerFogPacket.php:44
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\getUnsignedVarInt
getUnsignedVarInt()
Definition
BinaryStream.php:307
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
vendor
pocketmine
bedrock-protocol
src
PlayerFogPacket.php
Generated by
1.12.0