mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-21 18:36:40 +00:00
Chunk: remove useless instanceof checks
these are always CompoundTags, and if they aren't we have a bug somewhere else.
This commit is contained in:
parent
2f325b8c91
commit
e1ddf90695
@ -687,23 +687,21 @@ class Chunk{
|
|||||||
|
|
||||||
$level->timings->syncChunkLoadEntitiesTimer->startTiming();
|
$level->timings->syncChunkLoadEntitiesTimer->startTiming();
|
||||||
foreach($this->NBTentities as $nbt){
|
foreach($this->NBTentities as $nbt){
|
||||||
if($nbt instanceof CompoundTag){
|
if(!$nbt->hasTag("id")){ //allow mixed types (because of leveldb)
|
||||||
if(!$nbt->hasTag("id")){ //allow mixed types (because of leveldb)
|
$changed = true;
|
||||||
$changed = true;
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$entity = Entity::createEntity($nbt->getTag("id")->getValue(), $level, $nbt);
|
$entity = Entity::createEntity($nbt->getTag("id")->getValue(), $level, $nbt);
|
||||||
if(!($entity instanceof Entity)){
|
if(!($entity instanceof Entity)){
|
||||||
$changed = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}catch(\Throwable $t){
|
|
||||||
$level->getServer()->getLogger()->logException($t);
|
|
||||||
$changed = true;
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}catch(\Throwable $t){
|
||||||
|
$level->getServer()->getLogger()->logException($t);
|
||||||
|
$changed = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->NBTentities = [];
|
$this->NBTentities = [];
|
||||||
@ -711,16 +709,14 @@ class Chunk{
|
|||||||
|
|
||||||
$level->timings->syncChunkLoadTileEntitiesTimer->startTiming();
|
$level->timings->syncChunkLoadTileEntitiesTimer->startTiming();
|
||||||
foreach($this->NBTtiles as $nbt){
|
foreach($this->NBTtiles as $nbt){
|
||||||
if($nbt instanceof CompoundTag){
|
if(!$nbt->hasTag(Tile::TAG_ID, StringTag::class)){
|
||||||
if(!$nbt->hasTag(Tile::TAG_ID, StringTag::class)){
|
$changed = true;
|
||||||
$changed = true;
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(Tile::createTile($nbt->getString(Tile::TAG_ID), $level, $nbt) === null){
|
if(Tile::createTile($nbt->getString(Tile::TAG_ID), $level, $nbt) === null){
|
||||||
$changed = true;
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user