PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
ResourcePackChunkDataPacket.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
19
class
ResourcePackChunkDataPacket
extends
DataPacket
implements
ClientboundPacket
{
20
public
const
NETWORK_ID = ProtocolInfo::RESOURCE_PACK_CHUNK_DATA_PACKET;
21
22
public
string
$packId;
23
public
int
$chunkIndex;
24
public
int
$offset;
25
public
string
$data;
26
30
public
static
function
create
(
string
$packId,
int
$chunkIndex,
int
$offset,
string
$data) : self{
31
$result = new self;
32
$result->packId = $packId;
33
$result->chunkIndex = $chunkIndex;
34
$result->offset = $offset;
35
$result->data = $data;
36
return
$result;
37
}
38
39
protected
function
decodePayload
(
PacketSerializer
$in) : void{
40
$this->packId = $in->getString();
41
$this->chunkIndex = $in->
getLInt
();
42
$this->offset = $in->
getLLong
();
43
$this->data = $in->
getString
();
44
}
45
46
protected
function
encodePayload
(
PacketSerializer
$out) : void{
47
$out->putString($this->packId);
48
$out->putLInt($this->chunkIndex);
49
$out->putLLong($this->offset);
50
$out->putString($this->data);
51
}
52
53
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
54
return $handler->handleResourcePackChunkData($this);
55
}
56
}
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket
Definition
ResourcePackChunkDataPacket.php:19
pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
ResourcePackChunkDataPacket.php:46
pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
ResourcePackChunkDataPacket.php:39
pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket\create
static create(string $packId, int $chunkIndex, int $offset, string $data)
Definition
ResourcePackChunkDataPacket.php:30
pocketmine\network\mcpe\protocol\ResourcePackChunkDataPacket\handle
handle(PacketHandlerInterface $handler)
Definition
ResourcePackChunkDataPacket.php:53
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\getLLong
getLLong()
Definition
BinaryStream.php:293
pocketmine\utils\BinaryStream\getLInt
getLInt()
Definition
BinaryStream.php:205
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
vendor
pocketmine
bedrock-protocol
src
ResourcePackChunkDataPacket.php
Generated by
1.12.0