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

@ -24,9 +24,9 @@ declare(strict_types=1);
namespace pocketmine\world\sound;
use pocketmine\block\Block;
use pocketmine\data\bedrock\LegacyEntityIdToStringIdMap;
use pocketmine\entity\Entity;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\AddActorPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\player\Player;
@ -50,7 +50,7 @@ class EntityLandSound implements Sound{
LevelSoundEventPacket::SOUND_LAND,
$pos,
$this->blockLandedOn->getRuntimeId(),
$this->entity instanceof Player ? "minecraft:player" : AddActorPacket::LEGACY_ID_MAP_BC[$this->entity::NETWORK_ID] //TODO: bad hack, stuff depends on players having a -1 network ID :(
$this->entity instanceof Player ? "minecraft:player" : LegacyEntityIdToStringIdMap::getInstance()->legacyToString($this->entity::NETWORK_ID) //TODO: bad hack, stuff depends on players having a -1 network ID :(
//TODO: does isBaby have any relevance here?
);
}