tools/generate-bedrock-data-from-packets: fixed interpreting item metadata as blockstates when the item ID could be interpreted as a block ID

this broke crafting recipes which accepted skulls as inputs, as well as nether wart and bed recipes.
This commit is contained in:
Dylan K. Taylor 2023-09-27 12:36:57 +01:00
parent c028bb9055
commit c3bca9e172
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -276,7 +276,7 @@ class ParserPacketHandler extends PacketHandler{
$meta = $descriptor->getMeta();
if($meta !== 32767){
$blockStateId = $this->blockTranslator->getBlockStateDictionary()->lookupStateIdFromIdMeta($data->name, $meta);
if($blockStateId !== null){
if($this->blockItemIdMap->lookupBlockId($data->name) !== null && $blockStateId !== null){
$blockState = $this->blockTranslator->getBlockStateDictionary()->generateDataFromStateId($blockStateId);
if($blockState !== null && count($blockState->getStates()) > 0){
$data->block_states = self::blockStatePropertiesToString($blockState);