PocketMine-MP
5.42.1 git-443151900a14fe9dc682cbf786fa441be1294fab
Loading...
Searching...
No Matches
ClientboundDataDrivenUIShowScreenPacket.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 pmmp\encoding\LE;
20
use
pocketmine\network\mcpe\protocol\serializer\CommonTypes
;
21
22
class
ClientboundDataDrivenUIShowScreenPacket
extends
DataPacket
implements
ClientboundPacket
{
23
public
const
NETWORK_ID = ProtocolInfo::CLIENTBOUND_DATA_DRIVEN_UI_SHOW_SCREEN_PACKET;
24
25
private
string
$screenId;
26
private
int
$formId;
27
private
?
int
$dataInstanceId;
28
32
public
static
function
create
(
string
$screenId,
int
$formId, ?
int
$dataInstanceId) : self{
33
$result = new self;
34
$result->screenId = $screenId;
35
$result->formId = $formId;
36
$result->dataInstanceId = $dataInstanceId;
37
return
$result;
38
}
39
40
public
function
getScreenId() : string{ return $this->screenId; }
41
42
public
function
getFormId() : int{ return $this->formId; }
43
44
public
function
getDataInstanceId() : ?int{ return $this->dataInstanceId; }
45
46
protected
function
decodePayload
(ByteBufferReader $in) : void{
47
$this->screenId =
CommonTypes
::getString($in);
48
$this->formId = LE::readUnsignedInt($in);
49
$this->dataInstanceId = CommonTypes::readOptional($in, LE::readUnsignedInt(...));
50
}
51
52
protected
function
encodePayload
(ByteBufferWriter $out) : void{
53
CommonTypes
::putString($out, $this->screenId);
54
LE::writeUnsignedInt($out, $this->formId);
55
CommonTypes::writeOptional($out, $this->dataInstanceId, LE::writeUnsignedInt(...));
56
}
57
58
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
59
return $handler->handleClientboundDataDrivenUIShowScreen($this);
60
}
61
}
pocketmine\network\mcpe\protocol\ClientboundDataDrivenUIShowScreenPacket
Definition
ClientboundDataDrivenUIShowScreenPacket.php:22
pocketmine\network\mcpe\protocol\ClientboundDataDrivenUIShowScreenPacket\create
static create(string $screenId, int $formId, ?int $dataInstanceId)
Definition
ClientboundDataDrivenUIShowScreenPacket.php:32
pocketmine\network\mcpe\protocol\ClientboundDataDrivenUIShowScreenPacket\encodePayload
encodePayload(ByteBufferWriter $out)
Definition
ClientboundDataDrivenUIShowScreenPacket.php:52
pocketmine\network\mcpe\protocol\ClientboundDataDrivenUIShowScreenPacket\handle
handle(PacketHandlerInterface $handler)
Definition
ClientboundDataDrivenUIShowScreenPacket.php:58
pocketmine\network\mcpe\protocol\ClientboundDataDrivenUIShowScreenPacket\decodePayload
decodePayload(ByteBufferReader $in)
Definition
ClientboundDataDrivenUIShowScreenPacket.php:46
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:23
pocketmine\network\mcpe\protocol\serializer\CommonTypes
Definition
CommonTypes.php:69
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
vendor
pocketmine
bedrock-protocol
src
ClientboundDataDrivenUIShowScreenPacket.php
Generated by
1.12.0