PocketMine-MP
5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
TransactionData.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\types\inventory;
16
17
use
pocketmine\network\mcpe\protocol\PacketDecodeException
;
18
use
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
;
19
use
pocketmine\utils\BinaryDataException
;
20
use
function
count;
21
22
abstract
class
TransactionData
{
24
protected
array $actions = [];
25
29
final
public
function
getActions
() : array{
30
return $this->actions;
31
}
32
33
abstract
public
function
getTypeId() : int;
34
39
final
public
function
decode
(
PacketSerializer
$stream) : void{
40
$actionCount = $stream->getUnsignedVarInt();
41
for
($i = 0; $i < $actionCount; ++$i){
42
$this->actions[] = (
new
NetworkInventoryAction
())->read($stream);
43
}
44
$this->decodeData($stream);
45
}
46
51
abstract
protected
function
decodeData
(
PacketSerializer
$stream) : void;
52
53
final
public
function
encode(
PacketSerializer
$stream) : void{
54
$stream->putUnsignedVarInt(count($this->actions));
55
foreach
($this->actions as $action){
56
$action->write($stream);
57
}
58
$this->encodeData($stream);
59
}
60
61
abstract
protected
function
encodeData(
PacketSerializer
$stream) : void;
62
}
pocketmine\network\mcpe\protocol\PacketDecodeException
Definition
PacketDecodeException.php:17
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\types\inventory\NetworkInventoryAction
Definition
NetworkInventoryAction.php:21
pocketmine\network\mcpe\protocol\types\inventory\TransactionData
Definition
TransactionData.php:22
pocketmine\network\mcpe\protocol\types\inventory\TransactionData\decode
decode(PacketSerializer $stream)
Definition
TransactionData.php:39
pocketmine\network\mcpe\protocol\types\inventory\TransactionData\decodeData
decodeData(PacketSerializer $stream)
pocketmine\network\mcpe\protocol\types\inventory\TransactionData\getActions
getActions()
Definition
TransactionData.php:29
pocketmine\utils\BinaryDataException
Definition
BinaryDataException.php:26
vendor
pocketmine
bedrock-protocol
src
types
inventory
TransactionData.php
Generated by
1.12.0