PocketMine-MP
5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
CacheableNbt.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;
16
17
use
pocketmine\nbt\tag\Tag
;
18
use
pocketmine\nbt\TreeRoot
;
19
use
pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer
;
20
24
final
class
CacheableNbt
{
25
private
?
string
$encodedNbt;
26
30
public
function
__construct
(
31
private
Tag
$nbtRoot
32
){}
33
37
public
function
getRoot
() :
Tag
{
38
return $this->nbtRoot;
39
}
40
41
public
function
getEncodedNbt() : string{
42
return $this->encodedNbt ?? ($this->encodedNbt = (new
NetworkNbtSerializer
())->write(new
TreeRoot
($this->nbtRoot)));
43
}
44
}
pocketmine\nbt\TreeRoot
Definition
TreeRoot.php:32
pocketmine\nbt\tag\Tag
Definition
Tag.php:28
pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer
Definition
NetworkNbtSerializer.php:22
pocketmine\network\mcpe\protocol\types\CacheableNbt
Definition
CacheableNbt.php:24
pocketmine\network\mcpe\protocol\types\CacheableNbt\getRoot
getRoot()
Definition
CacheableNbt.php:37
pocketmine\network\mcpe\protocol\types\CacheableNbt\__construct
__construct(private Tag $nbtRoot)
Definition
CacheableNbt.php:30
vendor
pocketmine
bedrock-protocol
src
types
CacheableNbt.php
Generated by
1.12.0