Moved Entity initialization into Entity class

This commit is contained in:
Dylan K. Taylor 2016-12-27 12:03:21 +00:00
parent b68df2da5c
commit 096836faaa
2 changed files with 15 additions and 25 deletions

View File

@ -31,18 +31,9 @@ use pocketmine\command\CommandSender;
use pocketmine\command\ConsoleCommandSender;
use pocketmine\command\PluginIdentifiableCommand;
use pocketmine\command\SimpleCommandMap;
use pocketmine\entity\Arrow;
use pocketmine\entity\Attribute;
use pocketmine\entity\Effect;
use pocketmine\entity\Entity;
use pocketmine\entity\FallingSand;
use pocketmine\entity\Human;
use pocketmine\entity\Item as DroppedItem;
use pocketmine\entity\PrimedTNT;
use pocketmine\entity\Snowball;
use pocketmine\entity\Squid;
use pocketmine\entity\Villager;
use pocketmine\entity\Zombie;
use pocketmine\event\HandlerList;
use pocketmine\event\level\LevelInitEvent;
use pocketmine\event\level\LevelLoadEvent;
@ -1495,8 +1486,7 @@ class Server{
$this->consoleSender = new ConsoleCommandSender();
$this->commandMap = new SimpleCommandMap($this);
$this->registerEntities();
Entity::init();
Tile::init();
InventoryType::init();
Block::init();
@ -2421,17 +2411,4 @@ class Server{
return true;
}
private function registerEntities(){
Entity::registerEntity(Arrow::class);
Entity::registerEntity(DroppedItem::class);
Entity::registerEntity(FallingSand::class);
Entity::registerEntity(PrimedTNT::class);
Entity::registerEntity(Snowball::class);
Entity::registerEntity(Villager::class);
Entity::registerEntity(Zombie::class);
Entity::registerEntity(Squid::class);
Entity::registerEntity(Human::class, true);
}
}

View File

@ -85,7 +85,7 @@ abstract class Entity extends Location implements Metadatable{
const DATA_POTION_AMBIENT = 9; //byte
/* 27 (byte) player-specific flags
* 28 (int) player "index"?
* 28 (int) player "index"?
* 29 (block coords) bed position */
const DATA_LEAD_HOLDER_EID = 38; //long
const DATA_SCALE = 39; //float
@ -151,6 +151,19 @@ abstract class Entity extends Location implements Metadatable{
private static $knownEntities = [];
private static $shortNames = [];
public static function init(){
Entity::registerEntity(Arrow::class);
Entity::registerEntity(FallingSand::class);
Entity::registerEntity(Item::class);
Entity::registerEntity(PrimedTNT::class);
Entity::registerEntity(Snowball::class);
Entity::registerEntity(Squid::class);
Entity::registerEntity(Villager::class);
Entity::registerEntity(Zombie::class);
Entity::registerEntity(Human::class, true);
}
/**
* @var Player[]
*/