Improved Chunk entity loading

This commit is contained in:
Shoghi Cervantes 2014-09-29 13:14:14 +02:00
parent 25f8e8318b
commit 85ff696ae5

View File

@ -21,8 +21,10 @@
namespace pocketmine\level\format\generic; namespace pocketmine\level\format\generic;
use pocketmine\entity\Arrow;
use pocketmine\entity\DroppedItem; use pocketmine\entity\DroppedItem;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
use pocketmine\entity\FallingBlock;
use pocketmine\level\format\FullChunk; use pocketmine\level\format\FullChunk;
use pocketmine\level\format\LevelProvider; use pocketmine\level\format\LevelProvider;
use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Compound;
@ -116,14 +118,19 @@ abstract class BaseFullChunk implements FullChunk{
} }
//TODO: add all entities //TODO: add all entities
if($nbt->id instanceof String){ //New format switch($nbt["id"]){
switch($nbt["id"]){ case DroppedItem::NETWORK_ID:
case "Item": case "Item":
(new DroppedItem($this, $nbt))->spawnToAll(); (new DroppedItem($this, $nbt))->spawnToAll();
break; break;
} case Arrow::NETWORK_ID:
}else{ //Old format case "Arrow":
(new Arrow($this, $nbt))->spawnToAll();
break;
case FallingBlock::NETWORK_ID:
case "FallingSand":
(new FallingBlock($this, $nbt))->spawnToAll();
break;
} }
} }
} }