mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
NBT: Split up concerns of endianness and varint NBT into their own classes, separate stream handling from NBT class
The remaining methods, constants and fields in the NBT class now pertain to generic NBT functionality (except for the matchList()/matchTree() methods, but that's a job for another time). All NBT I/O specific logic has now been moved to NBTStream and its descendents.
This commit is contained in:
@ -34,6 +34,7 @@ use pocketmine\item\enchantment\Enchantment;
|
||||
use pocketmine\item\enchantment\EnchantmentInstance;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\LittleEndianNBTStream;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\tag\ByteTag;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
@ -64,7 +65,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
}
|
||||
|
||||
if(self::$cachedParser === null){
|
||||
self::$cachedParser = new NBT(NBT::LITTLE_ENDIAN);
|
||||
self::$cachedParser = new LittleEndianNBTStream();
|
||||
}
|
||||
|
||||
self::$cachedParser->read($tag);
|
||||
@ -79,7 +80,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
|
||||
private static function writeCompoundTag(CompoundTag $tag) : string{
|
||||
if(self::$cachedParser === null){
|
||||
self::$cachedParser = new NBT(NBT::LITTLE_ENDIAN);
|
||||
self::$cachedParser = new LittleEndianNBTStream();
|
||||
}
|
||||
|
||||
self::$cachedParser->setData($tag);
|
||||
|
Reference in New Issue
Block a user