PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
StructureTemplateDataRequestPacket.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\BlockPosition
;
19
use
pocketmine\network\mcpe\protocol\types\StructureSettings
;
20
21
class
StructureTemplateDataRequestPacket
extends
DataPacket
implements
ServerboundPacket
{
22
public
const
NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_REQUEST_PACKET;
23
24
public
const
TYPE_EXPORT_FROM_SAVE_MODE = 1;
25
public
const
TYPE_EXPORT_FROM_LOAD_MODE = 2;
26
public
const
TYPE_QUERY_SAVED_STRUCTURE = 3;
27
28
public
string
$structureTemplateName;
29
public
BlockPosition
$structureBlockPosition;
30
public
StructureSettings
$structureSettings;
31
public
int
$requestType;
32
36
public
static
function
create
(
string
$structureTemplateName,
BlockPosition
$structureBlockPosition,
StructureSettings
$structureSettings,
int
$requestType) : self{
37
$result = new self;
38
$result->structureTemplateName = $structureTemplateName;
39
$result->structureBlockPosition = $structureBlockPosition;
40
$result->structureSettings = $structureSettings;
41
$result->requestType = $requestType;
42
return
$result;
43
}
44
45
protected
function
decodePayload
(
PacketSerializer
$in) : void{
46
$this->structureTemplateName = $in->getString();
47
$this->structureBlockPosition = $in->
getBlockPosition
();
48
$this->structureSettings = $in->getStructureSettings();
49
$this->requestType = $in->
getByte
();
50
}
51
52
protected
function
encodePayload
(
PacketSerializer
$out) : void{
53
$out->putString($this->structureTemplateName);
54
$out->
putBlockPosition
($this->structureBlockPosition);
55
$out->putStructureSettings($this->structureSettings);
56
$out->putByte($this->requestType);
57
}
58
59
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
60
return $handler->handleStructureTemplateDataRequest($this);
61
}
62
}
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\StructureTemplateDataRequestPacket
Definition
StructureTemplateDataRequestPacket.php:21
pocketmine\network\mcpe\protocol\StructureTemplateDataRequestPacket\handle
handle(PacketHandlerInterface $handler)
Definition
StructureTemplateDataRequestPacket.php:59
pocketmine\network\mcpe\protocol\StructureTemplateDataRequestPacket\create
static create(string $structureTemplateName, BlockPosition $structureBlockPosition, StructureSettings $structureSettings, int $requestType)
Definition
StructureTemplateDataRequestPacket.php:36
pocketmine\network\mcpe\protocol\StructureTemplateDataRequestPacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
StructureTemplateDataRequestPacket.php:52
pocketmine\network\mcpe\protocol\StructureTemplateDataRequestPacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
StructureTemplateDataRequestPacket.php:45
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getBlockPosition
getBlockPosition()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:436
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\putBlockPosition
putBlockPosition(BlockPosition $blockPosition)
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:446
pocketmine\network\mcpe\protocol\types\BlockPosition
Definition
BlockPosition.php:19
pocketmine\network\mcpe\protocol\types\StructureSettings
Definition
StructureSettings.php:19
pocketmine\utils\BinaryStream\getByte
getByte()
Definition
BinaryStream.php:117
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
pocketmine\network\mcpe\protocol\ServerboundPacket
Definition
ServerboundPacket.php:17
vendor
pocketmine
bedrock-protocol
src
StructureTemplateDataRequestPacket.php
Generated by
1.12.0