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:
@ -25,6 +25,7 @@ namespace pocketmine\tile;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\NetworkLittleEndianNBTStream;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
|
||||
use pocketmine\Player;
|
||||
@ -92,11 +93,11 @@ abstract class Spawnable extends Tile{
|
||||
final public function getSerializedSpawnCompound() : string{
|
||||
if($this->spawnCompoundCache === null){
|
||||
if(self::$nbtWriter === null){
|
||||
self::$nbtWriter = new NBT(NBT::LITTLE_ENDIAN);
|
||||
self::$nbtWriter = new NetworkLittleEndianNBTStream();
|
||||
}
|
||||
|
||||
self::$nbtWriter->setData($this->getSpawnCompound());
|
||||
$this->spawnCompoundCache = self::$nbtWriter->write(true);
|
||||
$this->spawnCompoundCache = self::$nbtWriter->write();
|
||||
}
|
||||
|
||||
return $this->spawnCompoundCache;
|
||||
|
Reference in New Issue
Block a user