From 47b6fddcb8756225ba4a33de6ca24320254c1b3d Mon Sep 17 00:00:00 2001 From: Dries C Date: Wed, 13 Mar 2024 17:00:10 +0100 Subject: [PATCH] Add 1.20.60 MP BC support --- src/data/bedrock/BedrockDataFiles.php | 5 +++++ src/data/bedrock/ItemTagToIdMap.php | 1 + src/network/mcpe/convert/BlockTranslator.php | 4 ++++ src/network/mcpe/convert/ItemTranslator.php | 2 ++ .../mcpe/convert/ItemTypeDictionaryFromDataHelper.php | 1 + 5 files changed, 13 insertions(+) diff --git a/src/data/bedrock/BedrockDataFiles.php b/src/data/bedrock/BedrockDataFiles.php index 7e052dcdcd7..f6ccf692f88 100644 --- a/src/data/bedrock/BedrockDataFiles.php +++ b/src/data/bedrock/BedrockDataFiles.php @@ -38,18 +38,21 @@ private function __construct(){ public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_10_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.10.json'; public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_40_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.40.json'; public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_50_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.50.json'; + public const BLOCK_ID_TO_ITEM_ID_MAP_1_20_60_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map-1.20.60.json'; public const BLOCK_ID_TO_ITEM_ID_MAP_JSON = BEDROCK_DATA_PATH . '/block_id_to_item_id_map.json'; public const BLOCK_STATE_META_MAP_1_20_0_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.0.json'; public const BLOCK_STATE_META_MAP_1_20_10_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.10.json'; public const BLOCK_STATE_META_MAP_1_20_30_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.30.json'; public const BLOCK_STATE_META_MAP_1_20_40_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.40.json'; public const BLOCK_STATE_META_MAP_1_20_50_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.50.json'; + public const BLOCK_STATE_META_MAP_1_20_60_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map-1.20.60.json'; public const BLOCK_STATE_META_MAP_JSON = BEDROCK_DATA_PATH . '/block_state_meta_map.json'; public const CANONICAL_BLOCK_STATES_1_20_0_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.0.nbt'; public const CANONICAL_BLOCK_STATES_1_20_10_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.10.nbt'; public const CANONICAL_BLOCK_STATES_1_20_30_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.30.nbt'; public const CANONICAL_BLOCK_STATES_1_20_40_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.40.nbt'; public const CANONICAL_BLOCK_STATES_1_20_50_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.50.nbt'; + public const CANONICAL_BLOCK_STATES_1_20_60_NBT = BEDROCK_DATA_PATH . '/canonical_block_states-1.20.60.nbt'; public const CANONICAL_BLOCK_STATES_NBT = BEDROCK_DATA_PATH . '/canonical_block_states.nbt'; public const COMMAND_ARG_TYPES_JSON = BEDROCK_DATA_PATH . '/command_arg_types.json'; public const CREATIVEITEMS_JSON = BEDROCK_DATA_PATH . '/creativeitems.json'; @@ -64,11 +67,13 @@ private function __construct(){ public const R12_TO_CURRENT_BLOCK_MAP_1_20_30_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.30.bin'; public const R12_TO_CURRENT_BLOCK_MAP_1_20_40_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.40.bin'; public const R12_TO_CURRENT_BLOCK_MAP_1_20_50_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.50.bin'; + public const R12_TO_CURRENT_BLOCK_MAP_1_20_60_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.60.bin'; public const R12_TO_CURRENT_BLOCK_MAP_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map.bin'; public const R16_TO_CURRENT_ITEM_MAP_JSON = BEDROCK_DATA_PATH . '/r16_to_current_item_map.json'; public const REQUIRED_ITEM_LIST_1_20_0_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.0.json'; public const REQUIRED_ITEM_LIST_1_20_10_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.10.json'; public const REQUIRED_ITEM_LIST_1_20_40_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.40.json'; public const REQUIRED_ITEM_LIST_1_20_50_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.50.json'; + public const REQUIRED_ITEM_LIST_1_20_60_JSON = BEDROCK_DATA_PATH . '/required_item_list-1.20.60.json'; public const REQUIRED_ITEM_LIST_JSON = BEDROCK_DATA_PATH . '/required_item_list.json'; } diff --git a/src/data/bedrock/ItemTagToIdMap.php b/src/data/bedrock/ItemTagToIdMap.php index 1a8af69b658..15cec23a0aa 100644 --- a/src/data/bedrock/ItemTagToIdMap.php +++ b/src/data/bedrock/ItemTagToIdMap.php @@ -46,6 +46,7 @@ final class ItemTagToIdMap{ private const PATHS = [ ProtocolInfo::CURRENT_PROTOCOL => "", + ProtocolInfo::PROTOCOL_1_20_60 => "", ProtocolInfo::PROTOCOL_1_20_50 => "", ProtocolInfo::PROTOCOL_1_20_40 => "-1.20.0", ProtocolInfo::PROTOCOL_1_20_30 => "-1.20.0", diff --git a/src/network/mcpe/convert/BlockTranslator.php b/src/network/mcpe/convert/BlockTranslator.php index f25aeafe74c..31de633d8d9 100644 --- a/src/network/mcpe/convert/BlockTranslator.php +++ b/src/network/mcpe/convert/BlockTranslator.php @@ -46,6 +46,10 @@ final class BlockTranslator{ self::CANONICAL_BLOCK_STATES_PATH => '', self::BLOCK_STATE_META_MAP_PATH => '', ], + ProtocolInfo::PROTOCOL_1_20_60 => [ + self::CANONICAL_BLOCK_STATES_PATH => '-1.20.60', + self::BLOCK_STATE_META_MAP_PATH => '-1.20.60', + ], ProtocolInfo::PROTOCOL_1_20_50 => [ self::CANONICAL_BLOCK_STATES_PATH => '-1.20.50', self::BLOCK_STATE_META_MAP_PATH => '-1.20.50', diff --git a/src/network/mcpe/convert/ItemTranslator.php b/src/network/mcpe/convert/ItemTranslator.php index f40780972b9..8bdcc5cb36a 100644 --- a/src/network/mcpe/convert/ItemTranslator.php +++ b/src/network/mcpe/convert/ItemTranslator.php @@ -137,6 +137,8 @@ public function fromNetworkId(int $networkId, int $networkMeta, int $networkBloc public static function getItemSchemaId(int $protocolId) : int{ return match($protocolId){ + ProtocolInfo::PROTOCOL_1_20_70 => 171, + ProtocolInfo::PROTOCOL_1_20_60 => 161, ProtocolInfo::PROTOCOL_1_20_50 => 151, diff --git a/src/network/mcpe/convert/ItemTypeDictionaryFromDataHelper.php b/src/network/mcpe/convert/ItemTypeDictionaryFromDataHelper.php index 508e7be7ab4..e6910bfe941 100644 --- a/src/network/mcpe/convert/ItemTypeDictionaryFromDataHelper.php +++ b/src/network/mcpe/convert/ItemTypeDictionaryFromDataHelper.php @@ -40,6 +40,7 @@ final class ItemTypeDictionaryFromDataHelper{ private const PATHS = [ ProtocolInfo::CURRENT_PROTOCOL => "", + ProtocolInfo::PROTOCOL_1_20_60 => "-1.20.60", ProtocolInfo::PROTOCOL_1_20_50 => "-1.20.50", ProtocolInfo::PROTOCOL_1_20_40 => "-1.20.40", ProtocolInfo::PROTOCOL_1_20_30 => "-1.20.40",