Entity: add abstract getNetworkTypeId(), remove NETWORK_ID constant

this now requires that subclasses supply a proper NETWORK_ID.
This commit is contained in:
Dylan K. Taylor
2020-05-16 16:08:12 +01:00
parent 67666db827
commit c30dd9f1b6
21 changed files with 34 additions and 32 deletions

View File

@@ -252,8 +252,8 @@ class ItemFactory{
foreach(EntityFactory::getInstance()->getKnownTypes() as $className){
/** @var Living|string $className */
if(is_a($className, Living::class, true) and $className::NETWORK_ID !== -1){
$this->register(new SpawnEgg(ItemIds::SPAWN_EGG, $className::NETWORK_ID, "Spawn Egg", $className));
if(is_a($className, Living::class, true) and $className::getNetworkTypeId() !== -1){
$this->register(new SpawnEgg(ItemIds::SPAWN_EGG, $className::getNetworkTypeId(), "Spawn Egg", $className));
}
}