mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +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:
@ -29,7 +29,7 @@ use pocketmine\level\generator\Generator;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\LevelException;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\BigEndianNBTStream;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\scheduler\AsyncTask;
|
||||
@ -48,7 +48,7 @@ abstract class BaseLevelProvider implements LevelProvider{
|
||||
if(!file_exists($this->path)){
|
||||
mkdir($this->path, 0777, true);
|
||||
}
|
||||
$nbt = new NBT(NBT::BIG_ENDIAN);
|
||||
$nbt = new BigEndianNBTStream();
|
||||
$nbt->readCompressed(file_get_contents($this->getPath() . "level.dat"));
|
||||
$levelData = $nbt->getData()->getCompoundTag("Data");
|
||||
if($levelData !== null){
|
||||
@ -120,7 +120,7 @@ abstract class BaseLevelProvider implements LevelProvider{
|
||||
}
|
||||
|
||||
public function saveLevelData(){
|
||||
$nbt = new NBT(NBT::BIG_ENDIAN);
|
||||
$nbt = new BigEndianNBTStream();
|
||||
$nbt->setData(new CompoundTag("", [
|
||||
$this->levelData
|
||||
]));
|
||||
|
Reference in New Issue
Block a user