diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 4c08f29c..208cd1a4 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -649,11 +649,18 @@ class BlockAPI{ * 方块/物品id转换,防止新版本影响旧版本视觉效果 */ public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId) : int{ - if ($protocolId >= ProtocolInfo::CURRENT_PROTOCOL) { + if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_12) { return $itemId; } - $idMap = []; + $idMap = [ //default for protocol < 12 + LIT_PUMPKIN => MELON_BLOCK, //block + PUMPKIN_SEEDS => MELON_SEEDS, //item + PUMPKIN_PIE => BREAD, //item + BEETROOT => BREAD, //item + BEETROOT_SEEDS => SEEDS, //item + ]; + if ($protocolId < ProtocolInfo9::CURRENT_PROTOCOL_9) { $idMap += [ NETHERRACK => OBSIDIAN, //block @@ -661,15 +668,6 @@ class BlockAPI{ NETHER_QUARTZ => BRICK, //item ]; } - if ($protocolId < ProtocolInfo12::CURRENT_PROTOCOL_12) { - $idMap += [ - LIT_PUMPKIN => MELON_BLOCK, //block - PUMPKIN_SEEDS => MELON_SEEDS, //item - PUMPKIN_PIE => BREAD, //item - BEETROOT => BREAD, //item - BEETROOT_SEEDS => SEEDS, //item - ]; - } return $idMap[$itemId] ?? $itemId; }