PocketMine-MP
5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
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 pmmp\encoding\ByteBufferReader;
18
use pmmp\encoding\ByteBufferWriter;
19
use
pocketmine\network\mcpe\protocol\serializer\CommonTypes
;
20
use
pocketmine\network\mcpe\protocol\types\BlockPosition
;
21
use
pocketmine\network\mcpe\protocol\types\StructureEditorData
;
22
23
class
StructureBlockUpdatePacket
extends
DataPacket
implements
ServerboundPacket
{
24
public
const
NETWORK_ID = ProtocolInfo::STRUCTURE_BLOCK_UPDATE_PACKET;
25
26
public
BlockPosition
$blockPosition;
27
public
StructureEditorData
$structureEditorData;
28
public
bool
$isPowered;
29
public
bool
$waterlogged;
30
34
public
static
function
create
(
BlockPosition
$blockPosition,
StructureEditorData
$structureEditorData,
bool
$isPowered,
bool
$waterlogged) : self{
35
$result = new self;
36
$result->blockPosition = $blockPosition;
37
$result->structureEditorData = $structureEditorData;
38
$result->isPowered = $isPowered;
39
$result->waterlogged = $waterlogged;
40
return
$result;
41
}
42
43
protected
function
decodePayload
(ByteBufferReader $in) : void{
44
$this->blockPosition =
CommonTypes
::getBlockPosition($in);
45
$this->structureEditorData = CommonTypes::getStructureEditorData($in);
46
$this->isPowered = CommonTypes::getBool($in);
47
$this->waterlogged = CommonTypes::getBool($in);
48
}
49
50
protected
function
encodePayload
(ByteBufferWriter $out) : void{
51
CommonTypes
::putBlockPosition($out, $this->blockPosition);
52
CommonTypes::putStructureEditorData($out, $this->structureEditorData);
53
CommonTypes::putBool($out, $this->isPowered);
54
CommonTypes::putBool($out, $this->waterlogged);
55
}
56
57
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
58
return $handler->handleStructureBlockUpdate($this);
59
}
60
}
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:23
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket
Definition
StructureBlockUpdatePacket.php:23
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\handle
handle(PacketHandlerInterface $handler)
Definition
StructureBlockUpdatePacket.php:57
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\encodePayload
encodePayload(ByteBufferWriter $out)
Definition
StructureBlockUpdatePacket.php:50
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\create
static create(BlockPosition $blockPosition, StructureEditorData $structureEditorData, bool $isPowered, bool $waterlogged)
Definition
StructureBlockUpdatePacket.php:34
pocketmine\network\mcpe\protocol\StructureBlockUpdatePacket\decodePayload
decodePayload(ByteBufferReader $in)
Definition
StructureBlockUpdatePacket.php:43
pocketmine\network\mcpe\protocol\serializer\CommonTypes
Definition
CommonTypes.php:70
pocketmine\network\mcpe\protocol\types\BlockPosition
Definition
BlockPosition.php:19
pocketmine\network\mcpe\protocol\types\StructureEditorData
Definition
StructureEditorData.php:17
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