PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
StructureBlockUpdatePacket.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\StructureEditorData
;
20
21
class
StructureBlockUpdatePacket
extends
DataPacket
implements
ServerboundPacket
{
22
public
const
NETWORK_ID = ProtocolInfo::STRUCTURE_BLOCK_UPDATE_PACKET;
23
24
public
BlockPosition
$blockPosition;
25
public
StructureEditorData
$structureEditorData;
26
public
bool
$isPowered;
27
public
bool
$waterlogged;
28
32
public
static
function
create
(
BlockPosition
$blockPosition,
StructureEditorData
$structureEditorData,
bool
$isPowered,
bool
$waterlogged) : self{
33
$result = new self;
34
$result->blockPosition = $blockPosition;
35
$result->structureEditorData = $structureEditorData;
36
$result->isPowered = $isPowered;
37
$result->waterlogged = $waterlogged;
38
return
$result;
39
}
40
41
protected
function
decodePayload
(
PacketSerializer
$in) : void{
42
$this->blockPosition = $in->getBlockPosition();
43
$this->structureEditorData = $in->getStructureEditorData();
44
$this->isPowered = $in->
getBool
();
45
$this->waterlogged = $in->
getBool
();
46
}
47
48
protected
function
encodePayload
(
PacketSerializer
$out) : void{
49
$out->putBlockPosition($this->blockPosition);
50
$out->putStructureEditorData($this->structureEditorData);
51
$out->putBool($this->isPowered);
52
$out->putBool($this->waterlogged);
53
}
54
55
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
56
return $handler->handleStructureBlockUpdate($this);
57
}
58
}
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket
Definition
StructureBlockUpdatePacket.php:21
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
StructureBlockUpdatePacket.php:41
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
StructureBlockUpdatePacket.php:48
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\handle
handle(PacketHandlerInterface $handler)
Definition
StructureBlockUpdatePacket.php:55
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\create
static create(BlockPosition $blockPosition, StructureEditorData $structureEditorData, bool $isPowered, bool $waterlogged)
Definition
StructureBlockUpdatePacket.php:32
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\types\BlockPosition
Definition
BlockPosition.php:19
pocketmine\network\mcpe\protocol\types\StructureEditorData
Definition
StructureEditorData.php:17
pocketmine\utils\BinaryStream\getBool
getBool()
Definition
BinaryStream.php:105
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
pocketmine\network\mcpe\protocol\ServerboundPacket
Definition
ServerboundPacket.php:17
vendor
pocketmine
bedrock-protocol
src
StructureBlockUpdatePacket.php
Generated by
1.12.0