Throw an exception before calling base entity constructor if skin is not set or invalid, close #835 (#855)

This commit is contained in:
Dylan K. Taylor
2017-04-24 09:50:55 +01:00
committed by GitHub
parent 6ece57e23e
commit 559504225a
2 changed files with 25 additions and 5 deletions

View File

@ -697,9 +697,16 @@ class Chunk{
continue; //Fixes entities allocated in wrong chunks.
}
if(($entity = Entity::createEntity($nbt["id"], $level, $nbt)) instanceof Entity){
$entity->spawnToAll();
}else{
try{
$entity = Entity::createEntity($nbt["id"], $level, $nbt);
if($entity instanceof Entity){
$entity->spawnToAll();
}else{
$changed = true;
continue;
}
}catch(\Throwable $t){
$level->getServer()->getLogger()->logException($t);
$changed = true;
continue;
}