remove hardcoded legacy entity type ID mapping, load from resources instead

This commit is contained in:
Dylan K. Taylor
2020-05-04 13:47:39 +01:00
parent f0dfa45172
commit 81f982a8d9
6 changed files with 10 additions and 119 deletions

View File

@@ -28,6 +28,7 @@ namespace pocketmine\entity;
use pocketmine\block\Block;
use pocketmine\block\Water;
use pocketmine\data\bedrock\LegacyEntityIdToStringIdMap;
use pocketmine\entity\animation\Animation;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\event\entity\EntityDespawnEvent;
@@ -1511,7 +1512,7 @@ abstract class Entity{
protected function sendSpawnPacket(Player $player) : void{
$pk = new AddActorPacket();
$pk->entityRuntimeId = $this->getId();
$pk->type = AddActorPacket::LEGACY_ID_MAP_BC[static::NETWORK_ID];
$pk->type = LegacyEntityIdToStringIdMap::getInstance()->legacyToString(static::NETWORK_ID);
$pk->position = $this->location->asVector3();
$pk->motion = $this->getMotion();
$pk->yaw = $this->location->yaw;