diff --git a/src/data/bedrock/block/upgrade/BlockIdMetaUpgrader.php b/src/data/bedrock/block/upgrade/BlockIdMetaUpgrader.php index 3bb63a623..ef8267295 100644 --- a/src/data/bedrock/block/upgrade/BlockIdMetaUpgrader.php +++ b/src/data/bedrock/block/upgrade/BlockIdMetaUpgrader.php @@ -52,16 +52,23 @@ final class BlockIdMetaUpgrader{ return $this->fromStringIdMeta($stringId, $meta); } + /** + * Adds a mapping of legacy block numeric ID to modern string ID. This is used for upgrading blocks from pre-1.2.13 + * worlds (PM3). It's also needed for upgrading flower pot contents and falling blocks from PM4 worlds. + */ + public function addIntIdToStringIdMapping(int $intId, string $stringId) : void{ + $this->legacyNumericIdMap->add($stringId, $intId); + } + /** * Adds a mapping of legacy block ID and meta to modern blockstate data. This may be needed for upgrading data from * stored custom blocks from older versions of PocketMine-MP. */ - public function addMapping(string $stringId, int $intId, int $meta, BlockStateData $stateData) : void{ + public function addIdMetaToStateMapping(string $stringId, int $meta, BlockStateData $stateData) : void{ if(isset($this->mappingTable[$stringId][$meta])){ throw new \InvalidArgumentException("A mapping for $stringId:$meta already exists"); } $this->mappingTable[$stringId][$meta] = $stateData; - $this->legacyNumericIdMap->add($stringId, $intId); } public static function loadFromString(string $data, LegacyBlockIdToStringIdMap $idMap, BlockStateUpgrader $blockStateUpgrader) : self{