LevelDB: fixed leftover usage of the old CompoundTag API

This commit is contained in:
Dylan K. Taylor 2018-02-06 11:16:14 +00:00
parent dcb53b1cbb
commit 8222b16d9a

View File

@ -368,6 +368,7 @@ class LevelDB extends BaseLevelProvider{
$nbt = new LittleEndianNBTStream(); $nbt = new LittleEndianNBTStream();
/** @var CompoundTag[] $entities */
$entities = []; $entities = [];
if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and strlen($entityData) > 0){ if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and strlen($entityData) > 0){
$nbt->read($entityData, true); $nbt->read($entityData, true);
@ -377,9 +378,10 @@ class LevelDB extends BaseLevelProvider{
} }
} }
/** @var CompoundTag $entityNBT */
foreach($entities as $entityNBT){ foreach($entities as $entityNBT){
if($entityNBT->id instanceof IntTag){ if($entityNBT->hasTag("id", IntTag::class)){
$entityNBT["id"] &= 0xff; $entityNBT->setInt("id", $entityNBT->getInt("id") & 0xff); //remove type flags - TODO: use these instead of removing them)
} }
} }