From ba48f258f37aee7b935d9ed9b63081ab13779a90 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 13 Mar 2024 14:53:27 +0000 Subject: [PATCH] Support for 1.20.70 --- composer.json | 8 +-- composer.lock | 50 ++++++++--------- src/data/bedrock/block/BlockStateData.php | 4 +- src/data/bedrock/block/BlockStateNames.php | 4 +- .../bedrock/block/BlockStateStringValues.php | 20 ++----- src/data/bedrock/block/BlockTypeNames.php | 38 +++++++++++-- .../convert/BlockObjectToStateSerializer.php | 56 +++++++------------ .../convert/BlockStateDeserializerHelper.php | 14 ----- .../convert/BlockStateSerializerHelper.php | 23 -------- .../BlockStateToObjectDeserializer.php | 56 +++++++------------ .../block/convert/BlockStateWriter.php | 14 ----- src/data/bedrock/item/ItemTypeNames.php | 6 ++ src/entity/Entity.php | 2 +- .../mcpe/StandardEntityEventBroadcaster.php | 5 +- .../mcpe/handler/InGamePacketHandler.php | 16 ------ .../handler/ResourcePacksPacketHandler.php | 10 +++- src/player/Player.php | 2 +- src/world/format/io/data/BedrockWorldData.php | 6 +- 18 files changed, 130 insertions(+), 204 deletions(-) diff --git a/composer.json b/composer.json index 895fa7ecc..962777275 100644 --- a/composer.json +++ b/composer.json @@ -33,10 +33,10 @@ "composer-runtime-api": "^2.0", "adhocore/json-comment": "~1.2.0", "pocketmine/netresearch-jsonmapper": "~v4.4.999", - "pocketmine/bedrock-block-upgrade-schema": "~3.5.0+bedrock-1.20.60", - "pocketmine/bedrock-data": "~2.8.0+bedrock-1.20.60", - "pocketmine/bedrock-item-upgrade-schema": "~1.7.0+bedrock-1.20.60", - "pocketmine/bedrock-protocol": "~28.0.0+bedrock-1.20.60", + "pocketmine/bedrock-block-upgrade-schema": "~3.6.0+bedrock-1.20.70", + "pocketmine/bedrock-data": "~2.9.0+bedrock-1.20.70", + "pocketmine/bedrock-item-upgrade-schema": "~1.8.0+bedrock-1.20.70", + "pocketmine/bedrock-protocol": "~29.0.0+bedrock-1.20.70", "pocketmine/binaryutils": "^0.2.1", "pocketmine/callback-validator": "^1.0.2", "pocketmine/color": "^0.3.0", diff --git a/composer.lock b/composer.lock index 190ac3e6b..0b04e40df 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a6b02985f32591475760c53e7104e2e4", + "content-hash": "e861861cb1f632e1db21efc6875a0aba", "packages": [ { "name": "adhocore/json-comment", @@ -122,16 +122,16 @@ }, { "name": "pocketmine/bedrock-block-upgrade-schema", - "version": "3.5.0", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockBlockUpgradeSchema.git", - "reference": "1ed4ba738333c4b4afe4fef8e9326a45c89f12e3" + "reference": "1496e275db5148cb96bdaa998115e5e31a5c1e4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/1ed4ba738333c4b4afe4fef8e9326a45c89f12e3", - "reference": "1ed4ba738333c4b4afe4fef8e9326a45c89f12e3", + "url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/1496e275db5148cb96bdaa998115e5e31a5c1e4d", + "reference": "1496e275db5148cb96bdaa998115e5e31a5c1e4d", "shasum": "" }, "type": "library", @@ -142,22 +142,22 @@ "description": "Schemas describing how to upgrade saved block data in older Minecraft: Bedrock Edition world saves", "support": { "issues": "https://github.com/pmmp/BedrockBlockUpgradeSchema/issues", - "source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/3.5.0" + "source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/3.6.0" }, - "time": "2024-02-07T11:46:50+00:00" + "time": "2024-02-28T19:25:25+00:00" }, { "name": "pocketmine/bedrock-data", - "version": "2.8.0+bedrock-1.20.60", + "version": "2.9.0+bedrock-1.20.70", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "d8ea0355b7c835564af9fe6e273e650ac62c84a2" + "reference": "10b6696b662fd80a282eff7dca6c99d321c5b9e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/d8ea0355b7c835564af9fe6e273e650ac62c84a2", - "reference": "d8ea0355b7c835564af9fe6e273e650ac62c84a2", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/10b6696b662fd80a282eff7dca6c99d321c5b9e3", + "reference": "10b6696b662fd80a282eff7dca6c99d321c5b9e3", "shasum": "" }, "type": "library", @@ -168,22 +168,22 @@ "description": "Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP", "support": { "issues": "https://github.com/pmmp/BedrockData/issues", - "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.20.60" + "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.20.70" }, - "time": "2024-02-07T11:23:46+00:00" + "time": "2024-03-13T13:55:05+00:00" }, { "name": "pocketmine/bedrock-item-upgrade-schema", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockItemUpgradeSchema.git", - "reference": "69772dd58e2b2c7b7513fa2bcdc46e782228641c" + "reference": "4c4dc3bbceb944c5de429b6e752ab7a15652078c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/69772dd58e2b2c7b7513fa2bcdc46e782228641c", - "reference": "69772dd58e2b2c7b7513fa2bcdc46e782228641c", + "url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/4c4dc3bbceb944c5de429b6e752ab7a15652078c", + "reference": "4c4dc3bbceb944c5de429b6e752ab7a15652078c", "shasum": "" }, "type": "library", @@ -194,22 +194,22 @@ "description": "JSON schemas for upgrading items found in older Minecraft: Bedrock world saves", "support": { "issues": "https://github.com/pmmp/BedrockItemUpgradeSchema/issues", - "source": "https://github.com/pmmp/BedrockItemUpgradeSchema/tree/1.7.0" + "source": "https://github.com/pmmp/BedrockItemUpgradeSchema/tree/1.8.0" }, - "time": "2024-02-07T11:58:05+00:00" + "time": "2024-02-28T19:25:53+00:00" }, { "name": "pocketmine/bedrock-protocol", - "version": "28.0.1+bedrock-1.20.60", + "version": "29.0.0+bedrock-1.20.70", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "fdb0d1ddee498f995fbd21b9077aac3d3518877e" + "reference": "8d63f39bb2cded3d3e578fd3cf7bc769b9674857" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/fdb0d1ddee498f995fbd21b9077aac3d3518877e", - "reference": "fdb0d1ddee498f995fbd21b9077aac3d3518877e", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/8d63f39bb2cded3d3e578fd3cf7bc769b9674857", + "reference": "8d63f39bb2cded3d3e578fd3cf7bc769b9674857", "shasum": "" }, "require": { @@ -240,9 +240,9 @@ "description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP", "support": { "issues": "https://github.com/pmmp/BedrockProtocol/issues", - "source": "https://github.com/pmmp/BedrockProtocol/tree/28.0.1+bedrock-1.20.60" + "source": "https://github.com/pmmp/BedrockProtocol/tree/29.0.0+bedrock-1.20.70" }, - "time": "2024-03-01T21:49:48+00:00" + "time": "2024-03-13T14:35:54+00:00" }, { "name": "pocketmine/binaryutils", diff --git a/src/data/bedrock/block/BlockStateData.php b/src/data/bedrock/block/BlockStateData.php index b089eea5b..ea8e9f5b8 100644 --- a/src/data/bedrock/block/BlockStateData.php +++ b/src/data/bedrock/block/BlockStateData.php @@ -42,8 +42,8 @@ final class BlockStateData{ public const CURRENT_VERSION = (1 << 24) | //major (20 << 16) | //minor - (60 << 8) | //patch - (1); //revision + (70 << 8) | //patch + (4); //revision public const TAG_NAME = "name"; public const TAG_STATES = "states"; diff --git a/src/data/bedrock/block/BlockStateNames.php b/src/data/bedrock/block/BlockStateNames.php index 75b45e88e..72b237ddf 100644 --- a/src/data/bedrock/block/BlockStateNames.php +++ b/src/data/bedrock/block/BlockStateNames.php @@ -105,9 +105,7 @@ final class BlockStateNames{ public const MOISTURIZED_AMOUNT = "moisturized_amount"; public const MONSTER_EGG_STONE_TYPE = "monster_egg_stone_type"; public const MULTI_FACE_DIRECTION_BITS = "multi_face_direction_bits"; - public const NEW_LEAF_TYPE = "new_leaf_type"; public const OCCUPIED_BIT = "occupied_bit"; - public const OLD_LEAF_TYPE = "old_leaf_type"; public const OPEN_BIT = "open_bit"; public const ORIENTATION = "orientation"; public const OUTPUT_LIT_BIT = "output_lit_bit"; @@ -151,6 +149,7 @@ final class BlockStateNames{ public const UPDATE_BIT = "update_bit"; public const UPPER_BLOCK_BIT = "upper_block_bit"; public const UPSIDE_DOWN_BIT = "upside_down_bit"; + public const VAULT_STATE = "vault_state"; public const VINE_DIRECTION_BITS = "vine_direction_bits"; public const WALL_BLOCK_TYPE = "wall_block_type"; public const WALL_CONNECTION_TYPE_EAST = "wall_connection_type_east"; @@ -160,5 +159,4 @@ final class BlockStateNames{ public const WALL_POST_BIT = "wall_post_bit"; public const WEEPING_VINES_AGE = "weeping_vines_age"; public const WEIRDO_DIRECTION = "weirdo_direction"; - public const WOOD_TYPE = "wood_type"; } diff --git a/src/data/bedrock/block/BlockStateStringValues.php b/src/data/bedrock/block/BlockStateStringValues.php index d9d8a748d..202bfa34d 100644 --- a/src/data/bedrock/block/BlockStateStringValues.php +++ b/src/data/bedrock/block/BlockStateStringValues.php @@ -143,14 +143,6 @@ final class BlockStateStringValues{ public const MONSTER_EGG_STONE_TYPE_STONE = "stone"; public const MONSTER_EGG_STONE_TYPE_STONE_BRICK = "stone_brick"; - public const NEW_LEAF_TYPE_ACACIA = "acacia"; - public const NEW_LEAF_TYPE_DARK_OAK = "dark_oak"; - - public const OLD_LEAF_TYPE_BIRCH = "birch"; - public const OLD_LEAF_TYPE_JUNGLE = "jungle"; - public const OLD_LEAF_TYPE_OAK = "oak"; - public const OLD_LEAF_TYPE_SPRUCE = "spruce"; - public const ORIENTATION_DOWN_EAST = "down_east"; public const ORIENTATION_DOWN_NORTH = "down_north"; public const ORIENTATION_DOWN_SOUTH = "down_south"; @@ -264,6 +256,11 @@ final class BlockStateStringValues{ public const TURTLE_EGG_COUNT_THREE_EGG = "three_egg"; public const TURTLE_EGG_COUNT_TWO_EGG = "two_egg"; + public const VAULT_STATE_ACTIVE = "active"; + public const VAULT_STATE_EJECTING = "ejecting"; + public const VAULT_STATE_INACTIVE = "inactive"; + public const VAULT_STATE_UNLOCKING = "unlocking"; + public const WALL_BLOCK_TYPE_ANDESITE = "andesite"; public const WALL_BLOCK_TYPE_BRICK = "brick"; public const WALL_BLOCK_TYPE_COBBLESTONE = "cobblestone"; @@ -295,11 +292,4 @@ final class BlockStateStringValues{ public const WALL_CONNECTION_TYPE_WEST_SHORT = "short"; public const WALL_CONNECTION_TYPE_WEST_TALL = "tall"; - public const WOOD_TYPE_ACACIA = "acacia"; - public const WOOD_TYPE_BIRCH = "birch"; - public const WOOD_TYPE_DARK_OAK = "dark_oak"; - public const WOOD_TYPE_JUNGLE = "jungle"; - public const WOOD_TYPE_OAK = "oak"; - public const WOOD_TYPE_SPRUCE = "spruce"; - } diff --git a/src/data/bedrock/block/BlockTypeNames.php b/src/data/bedrock/block/BlockTypeNames.php index 1d8bfadfa..614394f04 100644 --- a/src/data/bedrock/block/BlockTypeNames.php +++ b/src/data/bedrock/block/BlockTypeNames.php @@ -33,16 +33,20 @@ final class BlockTypeNames{ public const ACACIA_BUTTON = "minecraft:acacia_button"; public const ACACIA_DOOR = "minecraft:acacia_door"; + public const ACACIA_DOUBLE_SLAB = "minecraft:acacia_double_slab"; public const ACACIA_FENCE = "minecraft:acacia_fence"; public const ACACIA_FENCE_GATE = "minecraft:acacia_fence_gate"; public const ACACIA_HANGING_SIGN = "minecraft:acacia_hanging_sign"; + public const ACACIA_LEAVES = "minecraft:acacia_leaves"; public const ACACIA_LOG = "minecraft:acacia_log"; public const ACACIA_PLANKS = "minecraft:acacia_planks"; public const ACACIA_PRESSURE_PLATE = "minecraft:acacia_pressure_plate"; + public const ACACIA_SLAB = "minecraft:acacia_slab"; public const ACACIA_STAIRS = "minecraft:acacia_stairs"; public const ACACIA_STANDING_SIGN = "minecraft:acacia_standing_sign"; public const ACACIA_TRAPDOOR = "minecraft:acacia_trapdoor"; public const ACACIA_WALL_SIGN = "minecraft:acacia_wall_sign"; + public const ACACIA_WOOD = "minecraft:acacia_wood"; public const ACTIVATOR_RAIL = "minecraft:activator_rail"; public const AIR = "minecraft:air"; public const ALLOW = "minecraft:allow"; @@ -88,16 +92,20 @@ final class BlockTypeNames{ public const BIG_DRIPLEAF = "minecraft:big_dripleaf"; public const BIRCH_BUTTON = "minecraft:birch_button"; public const BIRCH_DOOR = "minecraft:birch_door"; + public const BIRCH_DOUBLE_SLAB = "minecraft:birch_double_slab"; public const BIRCH_FENCE = "minecraft:birch_fence"; public const BIRCH_FENCE_GATE = "minecraft:birch_fence_gate"; public const BIRCH_HANGING_SIGN = "minecraft:birch_hanging_sign"; + public const BIRCH_LEAVES = "minecraft:birch_leaves"; public const BIRCH_LOG = "minecraft:birch_log"; public const BIRCH_PLANKS = "minecraft:birch_planks"; public const BIRCH_PRESSURE_PLATE = "minecraft:birch_pressure_plate"; + public const BIRCH_SLAB = "minecraft:birch_slab"; public const BIRCH_STAIRS = "minecraft:birch_stairs"; public const BIRCH_STANDING_SIGN = "minecraft:birch_standing_sign"; public const BIRCH_TRAPDOOR = "minecraft:birch_trapdoor"; public const BIRCH_WALL_SIGN = "minecraft:birch_wall_sign"; + public const BIRCH_WOOD = "minecraft:birch_wood"; public const BLACK_CANDLE = "minecraft:black_candle"; public const BLACK_CANDLE_CAKE = "minecraft:black_candle_cake"; public const BLACK_CARPET = "minecraft:black_carpet"; @@ -266,14 +274,18 @@ final class BlockTypeNames{ public const CYAN_WOOL = "minecraft:cyan_wool"; public const DARK_OAK_BUTTON = "minecraft:dark_oak_button"; public const DARK_OAK_DOOR = "minecraft:dark_oak_door"; + public const DARK_OAK_DOUBLE_SLAB = "minecraft:dark_oak_double_slab"; public const DARK_OAK_FENCE = "minecraft:dark_oak_fence"; public const DARK_OAK_FENCE_GATE = "minecraft:dark_oak_fence_gate"; public const DARK_OAK_HANGING_SIGN = "minecraft:dark_oak_hanging_sign"; + public const DARK_OAK_LEAVES = "minecraft:dark_oak_leaves"; public const DARK_OAK_LOG = "minecraft:dark_oak_log"; public const DARK_OAK_PLANKS = "minecraft:dark_oak_planks"; public const DARK_OAK_PRESSURE_PLATE = "minecraft:dark_oak_pressure_plate"; + public const DARK_OAK_SLAB = "minecraft:dark_oak_slab"; public const DARK_OAK_STAIRS = "minecraft:dark_oak_stairs"; public const DARK_OAK_TRAPDOOR = "minecraft:dark_oak_trapdoor"; + public const DARK_OAK_WOOD = "minecraft:dark_oak_wood"; public const DARK_PRISMARINE_STAIRS = "minecraft:dark_prismarine_stairs"; public const DARKOAK_STANDING_SIGN = "minecraft:darkoak_standing_sign"; public const DARKOAK_WALL_SIGN = "minecraft:darkoak_wall_sign"; @@ -320,7 +332,6 @@ final class BlockTypeNames{ public const DOUBLE_STONE_BLOCK_SLAB2 = "minecraft:double_stone_block_slab2"; public const DOUBLE_STONE_BLOCK_SLAB3 = "minecraft:double_stone_block_slab3"; public const DOUBLE_STONE_BLOCK_SLAB4 = "minecraft:double_stone_block_slab4"; - public const DOUBLE_WOODEN_SLAB = "minecraft:double_wooden_slab"; public const DRAGON_EGG = "minecraft:dragon_egg"; public const DRIED_KELP_BLOCK = "minecraft:dried_kelp_block"; public const DRIPSTONE_BLOCK = "minecraft:dripstone_block"; @@ -490,7 +501,7 @@ final class BlockTypeNames{ public const GOLDEN_RAIL = "minecraft:golden_rail"; public const GRANITE = "minecraft:granite"; public const GRANITE_STAIRS = "minecraft:granite_stairs"; - public const GRASS = "minecraft:grass"; + public const GRASS_BLOCK = "minecraft:grass_block"; public const GRASS_PATH = "minecraft:grass_path"; public const GRAVEL = "minecraft:gravel"; public const GRAY_CANDLE = "minecraft:gray_candle"; @@ -572,16 +583,20 @@ final class BlockTypeNames{ public const JUKEBOX = "minecraft:jukebox"; public const JUNGLE_BUTTON = "minecraft:jungle_button"; public const JUNGLE_DOOR = "minecraft:jungle_door"; + public const JUNGLE_DOUBLE_SLAB = "minecraft:jungle_double_slab"; public const JUNGLE_FENCE = "minecraft:jungle_fence"; public const JUNGLE_FENCE_GATE = "minecraft:jungle_fence_gate"; public const JUNGLE_HANGING_SIGN = "minecraft:jungle_hanging_sign"; + public const JUNGLE_LEAVES = "minecraft:jungle_leaves"; public const JUNGLE_LOG = "minecraft:jungle_log"; public const JUNGLE_PLANKS = "minecraft:jungle_planks"; public const JUNGLE_PRESSURE_PLATE = "minecraft:jungle_pressure_plate"; + public const JUNGLE_SLAB = "minecraft:jungle_slab"; public const JUNGLE_STAIRS = "minecraft:jungle_stairs"; public const JUNGLE_STANDING_SIGN = "minecraft:jungle_standing_sign"; public const JUNGLE_TRAPDOOR = "minecraft:jungle_trapdoor"; public const JUNGLE_WALL_SIGN = "minecraft:jungle_wall_sign"; + public const JUNGLE_WOOD = "minecraft:jungle_wood"; public const KELP = "minecraft:kelp"; public const LADDER = "minecraft:ladder"; public const LANTERN = "minecraft:lantern"; @@ -589,8 +604,6 @@ final class BlockTypeNames{ public const LAPIS_ORE = "minecraft:lapis_ore"; public const LARGE_AMETHYST_BUD = "minecraft:large_amethyst_bud"; public const LAVA = "minecraft:lava"; - public const LEAVES = "minecraft:leaves"; - public const LEAVES2 = "minecraft:leaves2"; public const LECTERN = "minecraft:lectern"; public const LEVER = "minecraft:lever"; public const LIGHT_BLOCK = "minecraft:light_block"; @@ -698,11 +711,15 @@ final class BlockTypeNames{ public const NETHERREACTOR = "minecraft:netherreactor"; public const NORMAL_STONE_STAIRS = "minecraft:normal_stone_stairs"; public const NOTEBLOCK = "minecraft:noteblock"; + public const OAK_DOUBLE_SLAB = "minecraft:oak_double_slab"; public const OAK_FENCE = "minecraft:oak_fence"; public const OAK_HANGING_SIGN = "minecraft:oak_hanging_sign"; + public const OAK_LEAVES = "minecraft:oak_leaves"; public const OAK_LOG = "minecraft:oak_log"; public const OAK_PLANKS = "minecraft:oak_planks"; + public const OAK_SLAB = "minecraft:oak_slab"; public const OAK_STAIRS = "minecraft:oak_stairs"; + public const OAK_WOOD = "minecraft:oak_wood"; public const OBSERVER = "minecraft:observer"; public const OBSIDIAN = "minecraft:obsidian"; public const OCHRE_FROGLIGHT = "minecraft:ochre_froglight"; @@ -875,16 +892,20 @@ final class BlockTypeNames{ public const SPORE_BLOSSOM = "minecraft:spore_blossom"; public const SPRUCE_BUTTON = "minecraft:spruce_button"; public const SPRUCE_DOOR = "minecraft:spruce_door"; + public const SPRUCE_DOUBLE_SLAB = "minecraft:spruce_double_slab"; public const SPRUCE_FENCE = "minecraft:spruce_fence"; public const SPRUCE_FENCE_GATE = "minecraft:spruce_fence_gate"; public const SPRUCE_HANGING_SIGN = "minecraft:spruce_hanging_sign"; + public const SPRUCE_LEAVES = "minecraft:spruce_leaves"; public const SPRUCE_LOG = "minecraft:spruce_log"; public const SPRUCE_PLANKS = "minecraft:spruce_planks"; public const SPRUCE_PRESSURE_PLATE = "minecraft:spruce_pressure_plate"; + public const SPRUCE_SLAB = "minecraft:spruce_slab"; public const SPRUCE_STAIRS = "minecraft:spruce_stairs"; public const SPRUCE_STANDING_SIGN = "minecraft:spruce_standing_sign"; public const SPRUCE_TRAPDOOR = "minecraft:spruce_trapdoor"; public const SPRUCE_WALL_SIGN = "minecraft:spruce_wall_sign"; + public const SPRUCE_WOOD = "minecraft:spruce_wood"; public const STANDING_BANNER = "minecraft:standing_banner"; public const STANDING_SIGN = "minecraft:standing_sign"; public const STICKY_PISTON = "minecraft:sticky_piston"; @@ -902,18 +923,24 @@ final class BlockTypeNames{ public const STONECUTTER = "minecraft:stonecutter"; public const STONECUTTER_BLOCK = "minecraft:stonecutter_block"; public const STRIPPED_ACACIA_LOG = "minecraft:stripped_acacia_log"; + public const STRIPPED_ACACIA_WOOD = "minecraft:stripped_acacia_wood"; public const STRIPPED_BAMBOO_BLOCK = "minecraft:stripped_bamboo_block"; public const STRIPPED_BIRCH_LOG = "minecraft:stripped_birch_log"; + public const STRIPPED_BIRCH_WOOD = "minecraft:stripped_birch_wood"; public const STRIPPED_CHERRY_LOG = "minecraft:stripped_cherry_log"; public const STRIPPED_CHERRY_WOOD = "minecraft:stripped_cherry_wood"; public const STRIPPED_CRIMSON_HYPHAE = "minecraft:stripped_crimson_hyphae"; public const STRIPPED_CRIMSON_STEM = "minecraft:stripped_crimson_stem"; public const STRIPPED_DARK_OAK_LOG = "minecraft:stripped_dark_oak_log"; + public const STRIPPED_DARK_OAK_WOOD = "minecraft:stripped_dark_oak_wood"; public const STRIPPED_JUNGLE_LOG = "minecraft:stripped_jungle_log"; + public const STRIPPED_JUNGLE_WOOD = "minecraft:stripped_jungle_wood"; public const STRIPPED_MANGROVE_LOG = "minecraft:stripped_mangrove_log"; public const STRIPPED_MANGROVE_WOOD = "minecraft:stripped_mangrove_wood"; public const STRIPPED_OAK_LOG = "minecraft:stripped_oak_log"; + public const STRIPPED_OAK_WOOD = "minecraft:stripped_oak_wood"; public const STRIPPED_SPRUCE_LOG = "minecraft:stripped_spruce_log"; + public const STRIPPED_SPRUCE_WOOD = "minecraft:stripped_spruce_wood"; public const STRIPPED_WARPED_HYPHAE = "minecraft:stripped_warped_hyphae"; public const STRIPPED_WARPED_STEM = "minecraft:stripped_warped_stem"; public const STRUCTURE_BLOCK = "minecraft:structure_block"; @@ -952,6 +979,7 @@ final class BlockTypeNames{ public const UNLIT_REDSTONE_TORCH = "minecraft:unlit_redstone_torch"; public const UNPOWERED_COMPARATOR = "minecraft:unpowered_comparator"; public const UNPOWERED_REPEATER = "minecraft:unpowered_repeater"; + public const VAULT = "minecraft:vault"; public const VERDANT_FROGLIGHT = "minecraft:verdant_froglight"; public const VINE = "minecraft:vine"; public const WALL_BANNER = "minecraft:wall_banner"; @@ -1042,11 +1070,9 @@ final class BlockTypeNames{ public const WHITE_TERRACOTTA = "minecraft:white_terracotta"; public const WHITE_WOOL = "minecraft:white_wool"; public const WITHER_ROSE = "minecraft:wither_rose"; - public const WOOD = "minecraft:wood"; public const WOODEN_BUTTON = "minecraft:wooden_button"; public const WOODEN_DOOR = "minecraft:wooden_door"; public const WOODEN_PRESSURE_PLATE = "minecraft:wooden_pressure_plate"; - public const WOODEN_SLAB = "minecraft:wooden_slab"; public const YELLOW_CANDLE = "minecraft:yellow_candle"; public const YELLOW_CANDLE_CAKE = "minecraft:yellow_candle_cake"; public const YELLOW_CARPET = "minecraft:yellow_carpet"; diff --git a/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php b/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php index b0b06ac90..453fd75fd 100644 --- a/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php +++ b/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php @@ -203,7 +203,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->registerFlatCoralSerializers(); $this->registerCauldronSerializers(); $this->registerFlatWoodBlockSerializers(); - $this->registerLegacyWoodBlockSerializers(); $this->registerLeavesSerializers(); $this->registerSimpleSerializers(); $this->registerSerializers(); @@ -558,9 +557,10 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->map(Blocks::ACACIA_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::ACACIA_TRAPDOOR))); $this->map(Blocks::ACACIA_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::ACACIA_WALL_SIGN))); $this->mapLog(Blocks::ACACIA_LOG(), Ids::ACACIA_LOG, Ids::STRIPPED_ACACIA_LOG); + $this->mapLog(Blocks::ACACIA_WOOD(), Ids::ACACIA_WOOD, Ids::STRIPPED_ACACIA_WOOD); $this->mapSimple(Blocks::ACACIA_FENCE(), Ids::ACACIA_FENCE); $this->mapSimple(Blocks::ACACIA_PLANKS(), Ids::ACACIA_PLANKS); - //wood and slabs still use the old way of storing wood type + $this->mapSlab(Blocks::ACACIA_SLAB(), Ids::ACACIA_SLAB, Ids::ACACIA_DOUBLE_SLAB); $this->map(Blocks::BIRCH_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block, new Writer(Ids::BIRCH_BUTTON))); $this->map(Blocks::BIRCH_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block, new Writer(Ids::BIRCH_DOOR))); @@ -570,10 +570,11 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->map(Blocks::BIRCH_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::BIRCH_TRAPDOOR))); $this->map(Blocks::BIRCH_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::BIRCH_WALL_SIGN))); $this->mapLog(Blocks::BIRCH_LOG(), Ids::BIRCH_LOG, Ids::STRIPPED_BIRCH_LOG); + $this->mapLog(Blocks::BIRCH_WOOD(), Ids::BIRCH_WOOD, Ids::STRIPPED_BIRCH_WOOD); $this->mapSimple(Blocks::BIRCH_FENCE(), Ids::BIRCH_FENCE); $this->mapSimple(Blocks::BIRCH_PLANKS(), Ids::BIRCH_PLANKS); + $this->mapSlab(Blocks::BIRCH_SLAB(), Ids::BIRCH_SLAB, Ids::BIRCH_DOUBLE_SLAB); $this->mapStairs(Blocks::BIRCH_STAIRS(), Ids::BIRCH_STAIRS); - //wood and slabs still use the old way of storing wood type $this->map(Blocks::CHERRY_BUTTON(), fn(Button $block) => Helper::encodeButton($block, new Writer(Ids::CHERRY_BUTTON))); $this->map(Blocks::CHERRY_DOOR(), fn(Door $block) => Helper::encodeDoor($block, new Writer(Ids::CHERRY_DOOR))); @@ -621,10 +622,11 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->map(Blocks::DARK_OAK_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::DARK_OAK_TRAPDOOR))); $this->map(Blocks::DARK_OAK_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::DARKOAK_WALL_SIGN))); $this->mapLog(Blocks::DARK_OAK_LOG(), Ids::DARK_OAK_LOG, Ids::STRIPPED_DARK_OAK_LOG); + $this->mapLog(Blocks::DARK_OAK_WOOD(), Ids::DARK_OAK_WOOD, Ids::STRIPPED_DARK_OAK_WOOD); $this->mapSimple(Blocks::DARK_OAK_FENCE(), Ids::DARK_OAK_FENCE); $this->mapSimple(Blocks::DARK_OAK_PLANKS(), Ids::DARK_OAK_PLANKS); + $this->mapSlab(Blocks::DARK_OAK_SLAB(), Ids::DARK_OAK_SLAB, Ids::DARK_OAK_DOUBLE_SLAB); $this->mapStairs(Blocks::DARK_OAK_STAIRS(), Ids::DARK_OAK_STAIRS); - //wood and slabs still use the old way of storing wood type $this->map(Blocks::JUNGLE_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block, new Writer(Ids::JUNGLE_BUTTON))); $this->map(Blocks::JUNGLE_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block, new Writer(Ids::JUNGLE_DOOR))); @@ -634,10 +636,11 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->map(Blocks::JUNGLE_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::JUNGLE_TRAPDOOR))); $this->map(Blocks::JUNGLE_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::JUNGLE_WALL_SIGN))); $this->mapLog(Blocks::JUNGLE_LOG(), Ids::JUNGLE_LOG, Ids::STRIPPED_JUNGLE_LOG); + $this->mapLog(Blocks::JUNGLE_WOOD(), Ids::JUNGLE_WOOD, Ids::STRIPPED_JUNGLE_WOOD); $this->mapSimple(Blocks::JUNGLE_FENCE(), Ids::JUNGLE_FENCE); $this->mapSimple(Blocks::JUNGLE_PLANKS(), Ids::JUNGLE_PLANKS); + $this->mapSlab(Blocks::JUNGLE_SLAB(), Ids::JUNGLE_SLAB, Ids::JUNGLE_DOUBLE_SLAB); $this->mapStairs(Blocks::JUNGLE_STAIRS(), Ids::JUNGLE_STAIRS); - //wood and slabs still use the old way of storing wood type $this->map(Blocks::MANGROVE_BUTTON(), fn(Button $block) => Helper::encodeButton($block, new Writer(Ids::MANGROVE_BUTTON))); $this->map(Blocks::MANGROVE_DOOR(), fn(Door $block) => Helper::encodeDoor($block, new Writer(Ids::MANGROVE_DOOR))); @@ -671,10 +674,11 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->map(Blocks::OAK_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::TRAPDOOR))); $this->map(Blocks::OAK_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::WALL_SIGN))); $this->mapLog(Blocks::OAK_LOG(), Ids::OAK_LOG, Ids::STRIPPED_OAK_LOG); + $this->mapLog(Blocks::OAK_WOOD(), Ids::OAK_WOOD, Ids::STRIPPED_OAK_WOOD); $this->mapSimple(Blocks::OAK_FENCE(), Ids::OAK_FENCE); $this->mapSimple(Blocks::OAK_PLANKS(), Ids::OAK_PLANKS); + $this->mapSlab(Blocks::OAK_SLAB(), Ids::OAK_SLAB, Ids::OAK_DOUBLE_SLAB); $this->mapStairs(Blocks::OAK_STAIRS(), Ids::OAK_STAIRS); - //wood and slabs still use the old way of storing wood type $this->map(Blocks::SPRUCE_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block, new Writer(Ids::SPRUCE_BUTTON))); $this->map(Blocks::SPRUCE_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block, new Writer(Ids::SPRUCE_DOOR))); @@ -684,8 +688,10 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->map(Blocks::SPRUCE_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::SPRUCE_TRAPDOOR))); $this->map(Blocks::SPRUCE_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::SPRUCE_WALL_SIGN))); $this->mapLog(Blocks::SPRUCE_LOG(), Ids::SPRUCE_LOG, Ids::STRIPPED_SPRUCE_LOG); + $this->mapLog(Blocks::SPRUCE_WOOD(), Ids::SPRUCE_WOOD, Ids::STRIPPED_SPRUCE_WOOD); $this->mapSimple(Blocks::SPRUCE_FENCE(), Ids::SPRUCE_FENCE); $this->mapSimple(Blocks::SPRUCE_PLANKS(), Ids::SPRUCE_PLANKS); + $this->mapSlab(Blocks::SPRUCE_SLAB(), Ids::SPRUCE_SLAB, Ids::SPRUCE_DOUBLE_SLAB); $this->mapStairs(Blocks::SPRUCE_STAIRS(), Ids::SPRUCE_STAIRS); //wood and slabs still use the old way of storing wood type @@ -704,30 +710,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapStairs(Blocks::WARPED_STAIRS(), Ids::WARPED_STAIRS); } - private function registerLegacyWoodBlockSerializers() : void{ - foreach([ - StringValues::WOOD_TYPE_ACACIA => Blocks::ACACIA_SLAB(), - StringValues::WOOD_TYPE_BIRCH => Blocks::BIRCH_SLAB(), - StringValues::WOOD_TYPE_DARK_OAK => Blocks::DARK_OAK_SLAB(), - StringValues::WOOD_TYPE_JUNGLE => Blocks::JUNGLE_SLAB(), - StringValues::WOOD_TYPE_OAK => Blocks::OAK_SLAB(), - StringValues::WOOD_TYPE_SPRUCE => Blocks::SPRUCE_SLAB(), - ] as $woodType => $block){ - $this->map($block, fn(Slab $block) => Helper::encodeWoodenSlab($block, $woodType)); - } - - foreach([ - Blocks::ACACIA_WOOD(), - Blocks::BIRCH_WOOD(), - Blocks::DARK_OAK_WOOD(), - Blocks::JUNGLE_WOOD(), - Blocks::OAK_WOOD(), - Blocks::SPRUCE_WOOD(), - ] as $block){ - $this->map($block, fn(Wood $block) => Helper::encodeAllSidedLog($block)); - } - } - private function registerLeavesSerializers() : void{ //flattened IDs $this->map(Blocks::AZALEA_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::AZALEA_LEAVES))); @@ -736,12 +718,12 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->map(Blocks::MANGROVE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::MANGROVE_LEAVES))); //legacy mess - $this->map(Blocks::ACACIA_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves2($block, StringValues::NEW_LEAF_TYPE_ACACIA)); - $this->map(Blocks::BIRCH_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves1($block, StringValues::OLD_LEAF_TYPE_BIRCH)); - $this->map(Blocks::DARK_OAK_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves2($block, StringValues::NEW_LEAF_TYPE_DARK_OAK)); - $this->map(Blocks::JUNGLE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves1($block, StringValues::OLD_LEAF_TYPE_JUNGLE)); - $this->map(Blocks::OAK_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves1($block, StringValues::OLD_LEAF_TYPE_OAK)); - $this->map(Blocks::SPRUCE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves1($block, StringValues::OLD_LEAF_TYPE_SPRUCE)); + $this->map(Blocks::ACACIA_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::ACACIA_LEAVES))); + $this->map(Blocks::BIRCH_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::BIRCH_LEAVES))); + $this->map(Blocks::DARK_OAK_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::DARK_OAK_LEAVES))); + $this->map(Blocks::JUNGLE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::JUNGLE_LEAVES))); + $this->map(Blocks::OAK_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::OAK_LEAVES))); + $this->map(Blocks::SPRUCE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::SPRUCE_LEAVES))); } private function registerSimpleSerializers() : void{ @@ -927,7 +909,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapSimple(Blocks::GOLD(), Ids::GOLD_BLOCK); $this->mapSimple(Blocks::GOLD_ORE(), Ids::GOLD_ORE); $this->mapSimple(Blocks::GRANITE(), Ids::GRANITE); - $this->mapSimple(Blocks::GRASS(), Ids::GRASS); + $this->mapSimple(Blocks::GRASS(), Ids::GRASS_BLOCK); $this->mapSimple(Blocks::GRASS_PATH(), Ids::GRASS_PATH); $this->mapSimple(Blocks::GRAVEL(), Ids::GRAVEL); $this->mapSimple(Blocks::HANGING_ROOTS(), Ids::HANGING_ROOTS); diff --git a/src/data/bedrock/block/convert/BlockStateDeserializerHelper.php b/src/data/bedrock/block/convert/BlockStateDeserializerHelper.php index b929f6800..68bf14a7e 100644 --- a/src/data/bedrock/block/convert/BlockStateDeserializerHelper.php +++ b/src/data/bedrock/block/convert/BlockStateDeserializerHelper.php @@ -362,18 +362,4 @@ final class BlockStateDeserializerHelper{ default => throw $in->badValueException(BlockStateNames::STONE_SLAB_TYPE_4, $type), }; } - - /** @throws BlockStateDeserializeException */ - public static function mapWoodenSlabType(BlockStateReader $in) : Slab{ - // * wood_type (StringTag) = acacia, birch, dark_oak, jungle, oak, spruce - return match($type = $in->readString(BlockStateNames::WOOD_TYPE)){ - StringValues::WOOD_TYPE_ACACIA => VanillaBlocks::ACACIA_SLAB(), - StringValues::WOOD_TYPE_BIRCH => VanillaBlocks::BIRCH_SLAB(), - StringValues::WOOD_TYPE_DARK_OAK => VanillaBlocks::DARK_OAK_SLAB(), - StringValues::WOOD_TYPE_JUNGLE => VanillaBlocks::JUNGLE_SLAB(), - StringValues::WOOD_TYPE_OAK => VanillaBlocks::OAK_SLAB(), - StringValues::WOOD_TYPE_SPRUCE => VanillaBlocks::SPRUCE_SLAB(), - default => throw $in->badValueException(BlockStateNames::WOOD_TYPE, $type), - }; - } } diff --git a/src/data/bedrock/block/convert/BlockStateSerializerHelper.php b/src/data/bedrock/block/convert/BlockStateSerializerHelper.php index 2b9123438..68bb227cc 100644 --- a/src/data/bedrock/block/convert/BlockStateSerializerHelper.php +++ b/src/data/bedrock/block/convert/BlockStateSerializerHelper.php @@ -56,14 +56,6 @@ use pocketmine\data\bedrock\MushroomBlockTypeIdMap; use pocketmine\math\Facing; final class BlockStateSerializerHelper{ - - public static function encodeAllSidedLog(Wood $block) : Writer{ - return Writer::create(Ids::WOOD) - ->writeBool(BlockStateNames::STRIPPED_BIT, $block->isStripped()) - ->writePillarAxis($block->getAxis()) - ->writeLegacyWoodType($block->getWoodType()); - } - public static function encodeButton(Button $block, Writer $out) : Writer{ return $out ->writeFacingDirection($block->getFacing()) @@ -151,16 +143,6 @@ final class BlockStateSerializerHelper{ ->writeBool(BlockStateNames::UPDATE_BIT, $block->isCheckDecay()); } - public static function encodeLeaves1(Leaves $block, string $type) : Writer{ - return self::encodeLeaves($block, Writer::create(Ids::LEAVES) - ->writeString(BlockStateNames::OLD_LEAF_TYPE, $type)); - } - - public static function encodeLeaves2(Leaves $block, string $type) : Writer{ - return self::encodeLeaves($block, Writer::create(Ids::LEAVES2) - ->writeString(BlockStateNames::NEW_LEAF_TYPE, $type)); - } - public static function encodeLiquid(Liquid $block, string $stillId, string $flowingId) : Writer{ return Writer::create($block->isStill() ? $stillId : $flowingId) ->writeInt(BlockStateNames::LIQUID_DEPTH, $block->getDecay() | ($block->isFalling() ? 0x8 : 0)); @@ -279,9 +261,4 @@ final class BlockStateSerializerHelper{ return $out ->writeHorizontalFacing($block->getFacing()); } - - public static function encodeWoodenSlab(Slab $block, string $typeValue) : Writer{ - return self::encodeSlab($block, Ids::WOODEN_SLAB, Ids::DOUBLE_WOODEN_SLAB) - ->writeString(BlockStateNames::WOOD_TYPE, $typeValue); - } } diff --git a/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php b/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php index 294126367..b82eeb14c 100644 --- a/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php +++ b/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php @@ -82,7 +82,6 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->registerFlatCoralDeserializers(); $this->registerCauldronDeserializers(); $this->registerFlatWoodBlockDeserializers(); - $this->registerLegacyWoodBlockDeserializers(); $this->registerLeavesDeserializers(); $this->registerSimpleDeserializers(); $this->registerDeserializers(); @@ -468,10 +467,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->map(Ids::ACACIA_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::ACACIA_TRAPDOOR(), $in)); $this->map(Ids::ACACIA_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::ACACIA_WALL_SIGN(), $in)); $this->mapLog(Ids::ACACIA_LOG, Ids::STRIPPED_ACACIA_LOG, fn() => Blocks::ACACIA_LOG()); + $this->mapLog(Ids::ACACIA_WOOD, Ids::STRIPPED_ACACIA_WOOD, fn() => Blocks::ACACIA_WOOD()); $this->mapSimple(Ids::ACACIA_FENCE, fn() => Blocks::ACACIA_FENCE()); $this->mapSimple(Ids::ACACIA_PLANKS, fn() => Blocks::ACACIA_PLANKS()); + $this->mapSlab(Ids::ACACIA_SLAB, Ids::ACACIA_DOUBLE_SLAB, fn() => Blocks::ACACIA_SLAB()); $this->mapStairs(Ids::ACACIA_STAIRS, fn() => Blocks::ACACIA_STAIRS()); - //wood, planks and slabs still use the old way of storing wood type $this->map(Ids::BIRCH_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::BIRCH_BUTTON(), $in)); $this->map(Ids::BIRCH_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::BIRCH_DOOR(), $in)); @@ -481,10 +481,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->map(Ids::BIRCH_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::BIRCH_TRAPDOOR(), $in)); $this->map(Ids::BIRCH_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::BIRCH_WALL_SIGN(), $in)); $this->mapLog(Ids::BIRCH_LOG, Ids::STRIPPED_BIRCH_LOG, fn() => Blocks::BIRCH_LOG()); + $this->mapLog(Ids::BIRCH_WOOD, Ids::STRIPPED_BIRCH_WOOD, fn() => Blocks::BIRCH_WOOD()); $this->mapSimple(Ids::BIRCH_FENCE, fn() => Blocks::BIRCH_FENCE()); $this->mapSimple(Ids::BIRCH_PLANKS, fn() => Blocks::BIRCH_PLANKS()); + $this->mapSlab(Ids::BIRCH_SLAB, Ids::BIRCH_DOUBLE_SLAB, fn() => Blocks::BIRCH_SLAB()); $this->mapStairs(Ids::BIRCH_STAIRS, fn() => Blocks::BIRCH_STAIRS()); - //wood, planks and slabs still use the old way of storing wood type $this->map(Ids::CHERRY_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::CHERRY_BUTTON(), $in)); $this->map(Ids::CHERRY_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::CHERRY_DOOR(), $in)); @@ -526,10 +527,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->map(Ids::DARK_OAK_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::DARK_OAK_PRESSURE_PLATE(), $in)); $this->map(Ids::DARK_OAK_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::DARK_OAK_TRAPDOOR(), $in)); $this->mapLog(Ids::DARK_OAK_LOG, Ids::STRIPPED_DARK_OAK_LOG, fn() => Blocks::DARK_OAK_LOG()); + $this->mapLog(Ids::DARK_OAK_WOOD, Ids::STRIPPED_DARK_OAK_WOOD, fn() => Blocks::DARK_OAK_WOOD()); $this->mapSimple(Ids::DARK_OAK_FENCE, fn() => Blocks::DARK_OAK_FENCE()); $this->mapSimple(Ids::DARK_OAK_PLANKS, fn() => Blocks::DARK_OAK_PLANKS()); + $this->mapSlab(Ids::DARK_OAK_SLAB, Ids::DARK_OAK_DOUBLE_SLAB, fn() => Blocks::DARK_OAK_SLAB()); $this->mapStairs(Ids::DARK_OAK_STAIRS, fn() => Blocks::DARK_OAK_STAIRS()); - //wood, planks and slabs still use the old way of storing wood type $this->map(Ids::JUNGLE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::JUNGLE_BUTTON(), $in)); $this->map(Ids::JUNGLE_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::JUNGLE_DOOR(), $in)); @@ -539,10 +541,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->map(Ids::JUNGLE_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::JUNGLE_TRAPDOOR(), $in)); $this->map(Ids::JUNGLE_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::JUNGLE_WALL_SIGN(), $in)); $this->mapLog(Ids::JUNGLE_LOG, Ids::STRIPPED_JUNGLE_LOG, fn() => Blocks::JUNGLE_LOG()); + $this->mapLog(Ids::JUNGLE_WOOD, Ids::STRIPPED_JUNGLE_WOOD, fn() => Blocks::JUNGLE_WOOD()); $this->mapSimple(Ids::JUNGLE_FENCE, fn() => Blocks::JUNGLE_FENCE()); $this->mapSimple(Ids::JUNGLE_PLANKS, fn() => Blocks::JUNGLE_PLANKS()); + $this->mapSlab(Ids::JUNGLE_SLAB, Ids::JUNGLE_DOUBLE_SLAB, fn() => Blocks::JUNGLE_SLAB()); $this->mapStairs(Ids::JUNGLE_STAIRS, fn() => Blocks::JUNGLE_STAIRS()); - //wood, planks and slabs still use the old way of storing wood type $this->map(Ids::MANGROVE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::MANGROVE_BUTTON(), $in)); $this->map(Ids::MANGROVE_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::MANGROVE_DOOR(), $in)); @@ -571,10 +574,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->map(Ids::TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::OAK_TRAPDOOR(), $in)); $this->map(Ids::WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::OAK_WALL_SIGN(), $in)); $this->mapLog(Ids::OAK_LOG, Ids::STRIPPED_OAK_LOG, fn() => Blocks::OAK_LOG()); + $this->mapLog(Ids::OAK_WOOD, Ids::STRIPPED_OAK_WOOD, fn() => Blocks::OAK_WOOD()); $this->mapSimple(Ids::OAK_FENCE, fn() => Blocks::OAK_FENCE()); $this->mapSimple(Ids::OAK_PLANKS, fn() => Blocks::OAK_PLANKS()); + $this->mapSlab(Ids::OAK_SLAB, Ids::OAK_DOUBLE_SLAB, fn() => Blocks::OAK_SLAB()); $this->mapStairs(Ids::OAK_STAIRS, fn() => Blocks::OAK_STAIRS()); - //wood, planks and slabs still use the old way of storing wood type $this->map(Ids::SPRUCE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::SPRUCE_BUTTON(), $in)); $this->map(Ids::SPRUCE_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::SPRUCE_DOOR(), $in)); @@ -584,10 +588,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->map(Ids::SPRUCE_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::SPRUCE_TRAPDOOR(), $in)); $this->map(Ids::SPRUCE_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::SPRUCE_WALL_SIGN(), $in)); $this->mapLog(Ids::SPRUCE_LOG, Ids::STRIPPED_SPRUCE_LOG, fn() => Blocks::SPRUCE_LOG()); + $this->mapLog(Ids::SPRUCE_WOOD, Ids::STRIPPED_SPRUCE_WOOD, fn() => Blocks::SPRUCE_WOOD()); $this->mapSimple(Ids::SPRUCE_FENCE, fn() => Blocks::SPRUCE_FENCE()); $this->mapSimple(Ids::SPRUCE_PLANKS, fn() => Blocks::SPRUCE_PLANKS()); + $this->mapSlab(Ids::SPRUCE_SLAB, Ids::SPRUCE_DOUBLE_SLAB, fn() => Blocks::SPRUCE_SLAB()); $this->mapStairs(Ids::SPRUCE_STAIRS, fn() => Blocks::SPRUCE_STAIRS()); - //wood, planks and slabs still use the old way of storing wood type $this->map(Ids::WARPED_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::WARPED_BUTTON(), $in)); $this->map(Ids::WARPED_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::WARPED_DOOR(), $in)); @@ -604,40 +609,17 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->mapStairs(Ids::WARPED_STAIRS, fn() => Blocks::WARPED_STAIRS()); } - private function registerLegacyWoodBlockDeserializers() : void{ - $this->mapSlab(Ids::WOODEN_SLAB, Ids::DOUBLE_WOODEN_SLAB, fn(Reader $in) => Helper::mapWoodenSlabType($in)); - - $this->map(Ids::WOOD, fn(Reader $in) : Block => Helper::decodeLog(match($woodType = $in->readString(StateNames::WOOD_TYPE)){ - StringValues::WOOD_TYPE_ACACIA => Blocks::ACACIA_WOOD(), - StringValues::WOOD_TYPE_BIRCH => Blocks::BIRCH_WOOD(), - StringValues::WOOD_TYPE_DARK_OAK => Blocks::DARK_OAK_WOOD(), - StringValues::WOOD_TYPE_JUNGLE => Blocks::JUNGLE_WOOD(), - StringValues::WOOD_TYPE_OAK => Blocks::OAK_WOOD(), - StringValues::WOOD_TYPE_SPRUCE => Blocks::SPRUCE_WOOD(), - default => throw $in->badValueException(StateNames::WOOD_TYPE, $woodType), - }, $in->readBool(StateNames::STRIPPED_BIT), $in)); - } - private function registerLeavesDeserializers() : void{ - //flattened IDs + $this->map(Ids::ACACIA_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::ACACIA_LEAVES(), $in)); $this->map(Ids::AZALEA_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::AZALEA_LEAVES(), $in)); $this->map(Ids::AZALEA_LEAVES_FLOWERED, fn(Reader $in) => Helper::decodeLeaves(Blocks::FLOWERING_AZALEA_LEAVES(), $in)); + $this->map(Ids::BIRCH_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::BIRCH_LEAVES(), $in)); $this->map(Ids::CHERRY_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::CHERRY_LEAVES(), $in)); + $this->map(Ids::DARK_OAK_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::DARK_OAK_LEAVES(), $in)); + $this->map(Ids::JUNGLE_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::JUNGLE_LEAVES(), $in)); $this->map(Ids::MANGROVE_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::MANGROVE_LEAVES(), $in)); - - //legacy mess - $this->map(Ids::LEAVES, fn(Reader $in) => Helper::decodeLeaves(match($type = $in->readString(StateNames::OLD_LEAF_TYPE)){ - StringValues::OLD_LEAF_TYPE_BIRCH => Blocks::BIRCH_LEAVES(), - StringValues::OLD_LEAF_TYPE_JUNGLE => Blocks::JUNGLE_LEAVES(), - StringValues::OLD_LEAF_TYPE_OAK => Blocks::OAK_LEAVES(), - StringValues::OLD_LEAF_TYPE_SPRUCE => Blocks::SPRUCE_LEAVES(), - default => throw $in->badValueException(StateNames::OLD_LEAF_TYPE, $type), - }, $in)); - $this->map(Ids::LEAVES2, fn(Reader $in) => Helper::decodeLeaves(match($type = $in->readString(StateNames::NEW_LEAF_TYPE)){ - StringValues::NEW_LEAF_TYPE_ACACIA => Blocks::ACACIA_LEAVES(), - StringValues::NEW_LEAF_TYPE_DARK_OAK => Blocks::DARK_OAK_LEAVES(), - default => throw $in->badValueException(StateNames::NEW_LEAF_TYPE, $type), - }, $in)); + $this->map(Ids::OAK_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::OAK_LEAVES(), $in)); + $this->map(Ids::SPRUCE_LEAVES, fn(Reader $in) => Helper::decodeLeaves(Blocks::SPRUCE_LEAVES(), $in)); } private function registerSimpleDeserializers() : void{ @@ -821,7 +803,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->mapSimple(Ids::GOLD_BLOCK, fn() => Blocks::GOLD()); $this->mapSimple(Ids::GOLD_ORE, fn() => Blocks::GOLD_ORE()); $this->mapSimple(Ids::GRANITE, fn() => Blocks::GRANITE()); - $this->mapSimple(Ids::GRASS, fn() => Blocks::GRASS()); + $this->mapSimple(Ids::GRASS_BLOCK, fn() => Blocks::GRASS()); $this->mapSimple(Ids::GRASS_PATH, fn() => Blocks::GRASS_PATH()); $this->mapSimple(Ids::GRAVEL, fn() => Blocks::GRAVEL()); $this->mapSimple(Ids::HANGING_ROOTS, fn() => Blocks::HANGING_ROOTS()); diff --git a/src/data/bedrock/block/convert/BlockStateWriter.php b/src/data/bedrock/block/convert/BlockStateWriter.php index 69efa4d0f..03e9bcf0b 100644 --- a/src/data/bedrock/block/convert/BlockStateWriter.php +++ b/src/data/bedrock/block/convert/BlockStateWriter.php @@ -257,20 +257,6 @@ final class BlockStateWriter{ return $this; } - /** @return $this */ - public function writeLegacyWoodType(WoodType $treeType) : self{ - $this->writeString(BlockStateNames::WOOD_TYPE, match($treeType){ - WoodType::OAK => StringValues::WOOD_TYPE_OAK, - WoodType::SPRUCE => StringValues::WOOD_TYPE_SPRUCE, - WoodType::BIRCH => StringValues::WOOD_TYPE_BIRCH, - WoodType::JUNGLE => StringValues::WOOD_TYPE_JUNGLE, - WoodType::ACACIA => StringValues::WOOD_TYPE_ACACIA, - WoodType::DARK_OAK => StringValues::WOOD_TYPE_DARK_OAK, - default => throw new BlockStateSerializeException("Invalid legacy wood type " . $treeType->name) - }); - return $this; - } - /** @return $this */ public function writeCoralType(CoralType $coralType) : self{ $this->writeString(BlockStateNames::CORAL_COLOR, match($coralType){ diff --git a/src/data/bedrock/item/ItemTypeNames.php b/src/data/bedrock/item/ItemTypeNames.php index 3f01ff1a8..0a205f3e9 100644 --- a/src/data/bedrock/item/ItemTypeNames.php +++ b/src/data/bedrock/item/ItemTypeNames.php @@ -74,6 +74,7 @@ final class ItemTypeNames{ public const BLEACH = "minecraft:bleach"; public const BLUE_DYE = "minecraft:blue_dye"; public const BOAT = "minecraft:boat"; + public const BOGGED_SPAWN_EGG = "minecraft:bogged_spawn_egg"; public const BONE = "minecraft:bone"; public const BONE_MEAL = "minecraft:bone_meal"; public const BOOK = "minecraft:book"; @@ -286,6 +287,8 @@ final class ItemTypeNames{ public const LEATHER_HELMET = "minecraft:leather_helmet"; public const LEATHER_HORSE_ARMOR = "minecraft:leather_horse_armor"; public const LEATHER_LEGGINGS = "minecraft:leather_leggings"; + public const LEAVES = "minecraft:leaves"; + public const LEAVES2 = "minecraft:leaves2"; public const LIGHT_BLUE_DYE = "minecraft:light_blue_dye"; public const LIGHT_GRAY_DYE = "minecraft:light_gray_dye"; public const LIME_DYE = "minecraft:lime_dye"; @@ -500,16 +503,19 @@ final class ItemTypeNames{ public const WHEAT_SEEDS = "minecraft:wheat_seeds"; public const WHITE_DYE = "minecraft:white_dye"; public const WILD_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:wild_armor_trim_smithing_template"; + public const WIND_CHARGE = "minecraft:wind_charge"; public const WITCH_SPAWN_EGG = "minecraft:witch_spawn_egg"; public const WITHER_SKELETON_SPAWN_EGG = "minecraft:wither_skeleton_spawn_egg"; public const WITHER_SPAWN_EGG = "minecraft:wither_spawn_egg"; public const WOLF_ARMOR = "minecraft:wolf_armor"; public const WOLF_SPAWN_EGG = "minecraft:wolf_spawn_egg"; + public const WOOD = "minecraft:wood"; public const WOODEN_AXE = "minecraft:wooden_axe"; public const WOODEN_DOOR = "minecraft:wooden_door"; public const WOODEN_HOE = "minecraft:wooden_hoe"; public const WOODEN_PICKAXE = "minecraft:wooden_pickaxe"; public const WOODEN_SHOVEL = "minecraft:wooden_shovel"; + public const WOODEN_SLAB = "minecraft:wooden_slab"; public const WOODEN_SWORD = "minecraft:wooden_sword"; public const WOOL = "minecraft:wool"; public const WRITABLE_BOOK = "minecraft:writable_book"; diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 5fc2168d5..c55a8716c 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -800,7 +800,7 @@ abstract class Entity{ } protected function broadcastMotion() : void{ - NetworkBroadcastUtils::broadcastPackets($this->hasSpawned, [SetActorMotionPacket::create($this->id, $this->getMotion())]); + NetworkBroadcastUtils::broadcastPackets($this->hasSpawned, [SetActorMotionPacket::create($this->id, $this->getMotion(), tick: 0)]); } public function getGravity() : float{ diff --git a/src/network/mcpe/StandardEntityEventBroadcaster.php b/src/network/mcpe/StandardEntityEventBroadcaster.php index 1651d154e..6b8a83fe1 100644 --- a/src/network/mcpe/StandardEntityEventBroadcaster.php +++ b/src/network/mcpe/StandardEntityEventBroadcaster.php @@ -87,12 +87,13 @@ final class StandardEntityEventBroadcaster implements EntityEventBroadcaster{ EffectIdMap::getInstance()->toId($effect->getType()), $effect->getAmplifier(), $effect->isVisible(), - $effect->getDuration() + $effect->getDuration(), + tick: 0 )); } public function onEntityEffectRemoved(array $recipients, Living $entity, EffectInstance $effect) : void{ - $this->sendDataPacket($recipients, MobEffectPacket::remove($entity->getId(), EffectIdMap::getInstance()->toId($effect->getType()))); + $this->sendDataPacket($recipients, MobEffectPacket::remove($entity->getId(), EffectIdMap::getInstance()->toId($effect->getType()), tick: 0)); } public function onEntityRemoved(array $recipients, Entity $entity) : void{ diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index e84609d11..c92db3133 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace pocketmine\network\mcpe\handler; use pocketmine\block\BaseSign; -use pocketmine\block\ItemFrame; use pocketmine\block\Lectern; use pocketmine\block\tile\Sign; use pocketmine\block\utils\SignText; @@ -60,7 +59,6 @@ use pocketmine\network\mcpe\protocol\ContainerClosePacket; use pocketmine\network\mcpe\protocol\EmotePacket; use pocketmine\network\mcpe\protocol\InteractPacket; use pocketmine\network\mcpe\protocol\InventoryTransactionPacket; -use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket; use pocketmine\network\mcpe\protocol\ItemStackRequestPacket; use pocketmine\network\mcpe\protocol\ItemStackResponsePacket; use pocketmine\network\mcpe\protocol\LabTablePacket; @@ -808,15 +806,6 @@ class InGamePacketHandler extends PacketHandler{ return true; } - public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool{ - $blockPosition = $packet->blockPosition; - $block = $this->player->getWorld()->getBlockAt($blockPosition->getX(), $blockPosition->getY(), $blockPosition->getZ()); - if($block instanceof ItemFrame && $block->getFramedItem() !== null){ - return $this->player->attackBlock(new Vector3($blockPosition->getX(), $blockPosition->getY(), $blockPosition->getZ()), $block->getFacing()); - } - return false; - } - public function handleBossEvent(BossEventPacket $packet) : bool{ return false; //TODO } @@ -998,11 +987,6 @@ class InGamePacketHandler extends PacketHandler{ } public function handleLecternUpdate(LecternUpdatePacket $packet) : bool{ - if($packet->dropBook){ - //Drop book is handled with an interact event on use item transaction - return true; - } - $pos = $packet->blockPosition; $chunkX = $pos->getX() >> Chunk::COORD_BIT_SIZE; $chunkZ = $pos->getZ() >> Chunk::COORD_BIT_SIZE; diff --git a/src/network/mcpe/handler/ResourcePacksPacketHandler.php b/src/network/mcpe/handler/ResourcePacksPacketHandler.php index 3d413ee5a..4528da6d5 100644 --- a/src/network/mcpe/handler/ResourcePacksPacketHandler.php +++ b/src/network/mcpe/handler/ResourcePacksPacketHandler.php @@ -80,7 +80,15 @@ class ResourcePacksPacketHandler extends PacketHandler{ ); }, $this->resourcePackManager->getResourceStack()); //TODO: support forcing server packs - $this->session->sendDataPacket(ResourcePacksInfoPacket::create($resourcePackEntries, [], $this->resourcePackManager->resourcePacksRequired(), false, false, [])); + $this->session->sendDataPacket(ResourcePacksInfoPacket::create( + resourcePackEntries: $resourcePackEntries, + behaviorPackEntries: [], + mustAccept: $this->resourcePackManager->resourcePacksRequired(), + hasAddons: false, + hasScripts: false, + forceServerPacks: false, + cdnUrls: [] + )); $this->session->getLogger()->debug("Waiting for client to accept resource packs"); } diff --git a/src/player/Player.php b/src/player/Player.php index 7a717dacd..0cefbe71f 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -1393,7 +1393,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ public function setMotion(Vector3 $motion) : bool{ if(parent::setMotion($motion)){ $this->broadcastMotion(); - $this->getNetworkSession()->sendDataPacket(SetActorMotionPacket::create($this->id, $motion)); + $this->getNetworkSession()->sendDataPacket(SetActorMotionPacket::create($this->id, $motion, tick: 0)); return true; } diff --git a/src/world/format/io/data/BedrockWorldData.php b/src/world/format/io/data/BedrockWorldData.php index bf8682547..4b57dd2d8 100644 --- a/src/world/format/io/data/BedrockWorldData.php +++ b/src/world/format/io/data/BedrockWorldData.php @@ -51,12 +51,12 @@ use function time; class BedrockWorldData extends BaseNbtWorldData{ public const CURRENT_STORAGE_VERSION = 10; - public const CURRENT_STORAGE_NETWORK_VERSION = 649; + public const CURRENT_STORAGE_NETWORK_VERSION = 662; public const CURRENT_CLIENT_VERSION_TARGET = [ 1, //major 20, //minor - 60, //patch - 4, //revision + 71, //patch + 1, //revision 0 //is beta ];