Fixed entities not loading on imported MCPE worlds

This commit is contained in:
Dylan K. Taylor 2019-03-21 20:03:10 +00:00
parent b8d1eb20b0
commit 3dbed830ef
2 changed files with 4 additions and 1 deletions

View File

@ -207,6 +207,9 @@ final class EntityFactory{
*/
public static function createFromData(Level $level, CompoundTag $nbt) : ?Entity{
$saveId = $nbt->getTag("id");
if($saveId === null){
$saveId = $nbt->getTag("identifier"); //new MCPE format
}
$baseClass = null;
if($saveId instanceof StringTag){
$baseClass = self::$knownEntities[$saveId->getValue()] ?? null;

View File

@ -586,7 +586,7 @@ class Chunk{
try{
$entity = EntityFactory::createFromData($level, $nbt);
if(!($entity instanceof Entity)){
$level->getServer()->getLogger()->warning("Chunk $this->x $this->z: Deleted unknown entity type " . $nbt->getString("id", "<unknown>", true));
$level->getServer()->getLogger()->warning("Chunk $this->x $this->z: Deleted unknown entity type " . $nbt->getString("id", $nbt->getString("identifier", "<unknown>", true), true));
$changed = true;
continue;
}