48 private static function make() :
self{
50 Filesystem::fileGetContents(Path::join(BEDROCK_ITEM_UPGRADE_SCHEMA_PATH,
'1.12.0_item_id_to_block_id_map.json')),
52 flags: JSON_THROW_ON_ERROR
59 foreach(Utils::promoteKeys($map) as $itemId => $blockId){
60 if(!is_string($itemId)){
63 if(!is_string($blockId)){
66 $builtMap[$itemId] = $blockId;
69 return new self($builtMap);
76 private array $itemToBlock = [];
81 private array $blockToItem = [];
88 foreach(Utils::stringifyKeys($itemToBlock) as $itemId => $blockId){
89 $this->itemToBlock[mb_strtolower($itemId,
'US-ASCII')] = $blockId;
90 $this->blockToItem[mb_strtolower($blockId,
'US-ASCII')] = $itemId;
94 public function itemIdToBlockId(
string $itemId) : ?string{
95 return $this->itemToBlock[mb_strtolower($itemId,
'US-ASCII')] ?? null;
98 public function blockIdToItemId(
string $blockId) : ?string{
100 return $this->blockToItem[mb_strtolower($blockId,
'US-ASCII')] ?? null;