mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 19:24:12 +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:
@ -27,6 +27,7 @@ use pocketmine\level\format\Chunk;
|
||||
use pocketmine\level\format\ChunkException;
|
||||
use pocketmine\level\format\io\ChunkUtils;
|
||||
use pocketmine\level\format\SubChunk;
|
||||
use pocketmine\nbt\BigEndianNBTStream;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\tag\ByteArrayTag;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
@ -83,7 +84,7 @@ class Anvil extends McRegion{
|
||||
|
||||
//TODO: TileTicks
|
||||
|
||||
$writer = new NBT(NBT::BIG_ENDIAN);
|
||||
$writer = new BigEndianNBTStream();
|
||||
$nbt->setName("Level");
|
||||
$writer->setData(new CompoundTag("", [$nbt]));
|
||||
|
||||
@ -100,7 +101,7 @@ class Anvil extends McRegion{
|
||||
}
|
||||
|
||||
public function nbtDeserialize(string $data){
|
||||
$nbt = new NBT(NBT::BIG_ENDIAN);
|
||||
$nbt = new BigEndianNBTStream();
|
||||
try{
|
||||
$nbt->readCompressed($data);
|
||||
|
||||
|
Reference in New Issue
Block a user