Skip to content

Commit

Permalink
Add <= 1.20.40 support
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed Oct 26, 2023
1 parent e816dad commit 951c5e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/data/bedrock/BedrockDataFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ private function __construct(){
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_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_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';
Expand All @@ -52,6 +54,7 @@ private function __construct(){
public const PARTICLE_ID_MAP_JSON = BEDROCK_DATA_PATH . '/particle_id_map.json';
public const R12_TO_CURRENT_BLOCK_MAP_1_20_0_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.0.bin';
public const R12_TO_CURRENT_BLOCK_MAP_1_20_10_BIN = BEDROCK_DATA_PATH . '/r12_to_current_block_map-1.20.10.bin';
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_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';
Expand Down
4 changes: 4 additions & 0 deletions src/network/mcpe/convert/GlobalItemTypeDictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ private static function make() : self{
public function __construct(private array $dictionaries){}

public static function getDictionaryProtocol(int $protocolId) : int{
if(ProtocolInfo::PROTOCOL_1_20_30){

Check failure on line 80 in src/network/mcpe/convert/GlobalItemTypeDictionary.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis (ubuntu-20.04, 8.1)

If condition is always true.

Check failure on line 80 in src/network/mcpe/convert/GlobalItemTypeDictionary.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis (ubuntu-20.04, 8.1)

Only booleans are allowed in an if condition, int given.

Check failure on line 80 in src/network/mcpe/convert/GlobalItemTypeDictionary.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis (ubuntu-20.04, 8.2)

If condition is always true.

Check failure on line 80 in src/network/mcpe/convert/GlobalItemTypeDictionary.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis (ubuntu-20.04, 8.2)

Only booleans are allowed in an if condition, int given.
return ProtocolInfo::PROTOCOL_1_20_40;
}

return $protocolId;

Check failure on line 84 in src/network/mcpe/convert/GlobalItemTypeDictionary.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis (ubuntu-20.04, 8.1)

Unreachable statement - code above always terminates.

Check failure on line 84 in src/network/mcpe/convert/GlobalItemTypeDictionary.php

View workflow job for this annotation

GitHub Actions / PHPStan analysis (ubuntu-20.04, 8.2)

Unreachable statement - code above always terminates.
}

Expand Down
4 changes: 4 additions & 0 deletions src/network/mcpe/convert/RuntimeBlockMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ private static function make() : self{
self::CANONICAL_BLOCK_STATES_PATH => '',
self::R12_TO_CURRENT_BLOCK_MAP_PATH => '',
],
ProtocolInfo::PROTOCOL_1_20_30 => [
self::CANONICAL_BLOCK_STATES_PATH => '-1.20.30',
self::R12_TO_CURRENT_BLOCK_MAP_PATH => '-1.20.30',
],
ProtocolInfo::PROTOCOL_1_20_10 => [
self::CANONICAL_BLOCK_STATES_PATH => '-1.20.10',
self::R12_TO_CURRENT_BLOCK_MAP_PATH => '-1.20.10',
Expand Down
1 change: 0 additions & 1 deletion src/network/mcpe/handler/InGamePacketHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@ public function handleBlockActorData(BlockActorDataPacket $packet) : bool{
throw new PacketHandlingException("Invalid tag type " . get_debug_type($frontTextTag) . " for tag \"" . Sign::TAG_FRONT_TEXT . "\" in sign update data");
}
$textBlobTag = $frontTextTag->getTag(Sign::TAG_TEXT_BLOB);

if(!$textBlobTag instanceof StringTag){
throw new PacketHandlingException("Invalid tag type " . get_debug_type($textBlobTag) . " for tag \"" . Sign::TAG_TEXT_BLOB . "\" in sign update data");
}
Expand Down

0 comments on commit 951c5e7

Please sign in to comment.