mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
updated NBT dependency
This commit is contained in:
@ -108,7 +108,7 @@ class BedrockWorldData extends BaseNbtWorldData{
|
||||
protected function load() : CompoundTag{
|
||||
$nbt = new LittleEndianNbtSerializer();
|
||||
try{
|
||||
$worldData = $nbt->read(substr(file_get_contents($this->dataPath), 8))->getTag();
|
||||
$worldData = $nbt->read(substr(file_get_contents($this->dataPath), 8))->mustGetCompoundTag();
|
||||
}catch(NbtDataException $e){
|
||||
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class JavaWorldData extends BaseNbtWorldData{
|
||||
protected function load() : CompoundTag{
|
||||
$nbt = new BigEndianNbtSerializer();
|
||||
try{
|
||||
$worldData = $nbt->readCompressed(file_get_contents($this->dataPath))->getTag();
|
||||
$worldData = $nbt->readCompressed(file_get_contents($this->dataPath))->mustGetCompoundTag();
|
||||
}catch(NbtDataException $e){
|
||||
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
||||
$palette = [];
|
||||
for($i = 0, $paletteSize = $stream->getLInt(); $i < $paletteSize; ++$i){
|
||||
$offset = $stream->getOffset();
|
||||
$tag = $nbt->read($stream->getBuffer(), $offset)->getTag();
|
||||
$tag = $nbt->read($stream->getBuffer(), $offset)->mustGetCompoundTag();
|
||||
$stream->setOffset($offset);
|
||||
|
||||
$id = $stringToLegacyId[$tag->getString("name")] ?? BlockLegacyIds::INFO_UPDATE;
|
||||
@ -392,7 +392,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
||||
$entities = [];
|
||||
if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and $entityData !== ""){
|
||||
try{
|
||||
$entities = array_map(function(TreeRoot $root) : CompoundTag{ return $root->getTag(); }, $nbt->readMultiple($entityData));
|
||||
$entities = array_map(function(TreeRoot $root) : CompoundTag{ return $root->mustGetCompoundTag(); }, $nbt->readMultiple($entityData));
|
||||
}catch(NbtDataException $e){
|
||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||
}
|
||||
@ -402,7 +402,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
||||
$tiles = [];
|
||||
if(($tileData = $this->db->get($index . self::TAG_BLOCK_ENTITY)) !== false and $tileData !== ""){
|
||||
try{
|
||||
$tiles = array_map(function(TreeRoot $root) : CompoundTag{ return $root->getTag(); }, $nbt->readMultiple($tileData));
|
||||
$tiles = array_map(function(TreeRoot $root) : CompoundTag{ return $root->mustGetCompoundTag(); }, $nbt->readMultiple($tileData));
|
||||
}catch(NbtDataException $e){
|
||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ trait LegacyAnvilChunkTrait{
|
||||
protected function deserializeChunk(string $data) : Chunk{
|
||||
$nbt = new BigEndianNbtSerializer();
|
||||
try{
|
||||
$chunk = $nbt->readCompressed($data)->getTag();
|
||||
$chunk = $nbt->readCompressed($data)->mustGetCompoundTag();
|
||||
}catch(NbtDataException $e){
|
||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class McRegion extends RegionWorldProvider{
|
||||
protected function deserializeChunk(string $data) : Chunk{
|
||||
$nbt = new BigEndianNbtSerializer();
|
||||
try{
|
||||
$chunk = $nbt->readCompressed($data)->getTag();
|
||||
$chunk = $nbt->readCompressed($data)->mustGetCompoundTag();
|
||||
}catch(NbtDataException $e){
|
||||
throw new CorruptedChunkException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user