mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
remove hardcoded legacy entity type ID mapping, load from resources instead
This commit is contained in:
@ -23,11 +23,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block\tile;
|
||||
|
||||
use pocketmine\data\bedrock\LegacyEntityIdToStringIdMap;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\protocol\AddActorPacket;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
@ -97,7 +97,7 @@ class MonsterSpawner extends Spawnable{
|
||||
public function readSaveData(CompoundTag $nbt) : void{
|
||||
if($nbt->hasTag(self::TAG_LEGACY_ENTITY_TYPE_ID, IntTag::class)){
|
||||
//TODO: this will cause unexpected results when there's no mapping for the entity
|
||||
$this->entityTypeId = AddActorPacket::LEGACY_ID_MAP_BC[$nbt->getInt(self::TAG_LEGACY_ENTITY_TYPE_ID)] ?? ":";
|
||||
$this->entityTypeId = LegacyEntityIdToStringIdMap::getInstance()->legacyToString($nbt->getInt(self::TAG_LEGACY_ENTITY_TYPE_ID)) ?? ":";
|
||||
}elseif($nbt->hasTag(self::TAG_ENTITY_TYPE_ID, StringTag::class)){
|
||||
$this->entityTypeId = $nbt->getString(self::TAG_ENTITY_TYPE_ID);
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user