diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 406bff36c..a8ec707da 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -53,7 +53,7 @@ jobs: run: echo NAME=$(echo "${GITHUB_REPOSITORY,,}") >> $GITHUB_OUTPUT - name: Build image for tag - uses: docker/build-push-action@v5.0.0 + uses: docker/build-push-action@v5.1.0 with: push: true context: ./pocketmine-mp @@ -66,7 +66,7 @@ jobs: - name: Build image for major tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v5.0.0 + uses: docker/build-push-action@v5.1.0 with: push: true context: ./pocketmine-mp @@ -79,7 +79,7 @@ jobs: - name: Build image for minor tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v5.0.0 + uses: docker/build-push-action@v5.1.0 with: push: true context: ./pocketmine-mp @@ -92,7 +92,7 @@ jobs: - name: Build image for latest tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v5.0.0 + uses: docker/build-push-action@v5.1.0 with: push: true context: ./pocketmine-mp diff --git a/.github/workflows/discord-release-notify.yml b/.github/workflows/discord-release-notify.yml index ad30aa4f2..6081b8fd8 100644 --- a/.github/workflows/discord-release-notify.yml +++ b/.github/workflows/discord-release-notify.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup PHP and tools - uses: shivammathur/setup-php@2.27.1 + uses: shivammathur/setup-php@2.28.0 with: php-version: 8.2 diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index d4f68ee0b..9ffae467d 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -20,7 +20,7 @@ jobs: submodules: true - name: Setup PHP - uses: shivammathur/setup-php@2.27.1 + uses: shivammathur/setup-php@2.28.0 with: php-version: ${{ matrix.php-version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8bf6fd7d6..32f8be80e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: ["8.1", "8.2"] + php: ["8.1", "8.2", "8.3"] steps: - uses: actions/checkout@v4 @@ -49,7 +49,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: ["8.1", "8.2"] + php: ["8.1", "8.2", "8.3"] steps: - uses: actions/checkout@v4 @@ -84,7 +84,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: ["8.1", "8.2"] + php: ["8.1", "8.2", "8.3"] steps: - uses: actions/checkout@v4 @@ -121,7 +121,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: ["8.1", "8.2"] + php: ["8.1", "8.2", "8.3"] steps: - uses: actions/checkout@v4 @@ -173,7 +173,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup PHP and tools - uses: shivammathur/setup-php@2.27.1 + uses: shivammathur/setup-php@2.28.0 with: php-version: 8.2 tools: php-cs-fixer:3.38 diff --git a/build/php b/build/php index 9c7ea425a..6dc09c57e 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 9c7ea425ac36941fe7f9718aecb97b3375221228 +Subproject commit 6dc09c57eb2a044b3c71e65fa3760dfcaed7fa5e diff --git a/changelogs/4.26.md b/changelogs/4.26.md new file mode 100644 index 000000000..2244c6cae --- /dev/null +++ b/changelogs/4.26.md @@ -0,0 +1,16 @@ +# 4.26.0 +Released 6th December 2023. + +**For Minecraft: Bedrock Edition 1.20.50** + +This is a support release for Minecraft: Bedrock Edition 1.20.50. + +**Plugin compatibility:** Plugins for previous 4.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` namespace. +Do not update plugin minimum API versions unless you need new features added in this release. + +**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.** +Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly. + +## General +- Added support for Minecraft: Bedrock Edition 1.20.50. +- Removed support for older versions. diff --git a/changelogs/5.9.md b/changelogs/5.9.md new file mode 100644 index 000000000..2467be638 --- /dev/null +++ b/changelogs/5.9.md @@ -0,0 +1,30 @@ +# 5.9.0 +Released 6th December 2023. + +**For Minecraft: Bedrock Edition 1.20.50** + +This is a support release for Minecraft: Bedrock Edition 1.20.50. + +**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace. +Do not update plugin minimum API versions unless you need new features added in this release. + +**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.** +Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly. + +## General +- Added support for Minecraft: Bedrock Edition 1.20.50. +- Removed support for older versions. + +## Fixes +- Fixed `pitcher_plant` and `pitcher_pod` not being accepted by `StringToItemParser` (and therefore not being usable in commands). +- Rotation of items in item frames in worlds from newer versions of Bedrock is now correctly loaded. +- Fixed possible crash in block update sending if a chunk was unloaded during a previous chunk's block update syncing. +- Fixed `AsyncTask::fetchLocal()` throwing an exception if `null` was stored in the local storage. + +## Documentation +- `Server::prepareBatch()` is now correctly marked as `@internal`. +- Updated documentation for `Server::prepareBatch()` to accurately reflect its behaviour. +- Fixed incorrect path in doc comments of `EnumTrait` and `RegistryTrait`. + +## Internals +- Added PHP 8.3 to the test matrix. This has not been thoroughly tested yet, so it should only be used for testing purposes. diff --git a/composer.json b/composer.json index c7bfd7d27..1a19711e9 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.2.1000", - "pocketmine/bedrock-block-upgrade-schema": "~3.3.0+bedrock-1.20.40", - "pocketmine/bedrock-data": "~2.6.0+bedrock-1.20.40", - "pocketmine/bedrock-item-upgrade-schema": "~1.5.0+bedrock-1.20.30", - "pocketmine/bedrock-protocol": "~25.0.0+bedrock-1.20.40", + "pocketmine/bedrock-block-upgrade-schema": "~3.4.0+bedrock-1.20.50", + "pocketmine/bedrock-data": "~2.7.0+bedrock-1.20.50", + "pocketmine/bedrock-item-upgrade-schema": "~1.6.0+bedrock-1.20.50", + "pocketmine/bedrock-protocol": "~26.0.0+bedrock-1.20.50", "pocketmine/binaryutils": "^0.2.1", "pocketmine/callback-validator": "^1.0.2", "pocketmine/color": "^0.3.0", @@ -52,7 +52,7 @@ "symfony/filesystem": "~6.3.0" }, "require-dev": { - "phpstan/phpstan": "1.10.41", + "phpstan/phpstan": "1.10.47", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "~10.3.0 || ~10.2.0 || ~10.1.0" diff --git a/composer.lock b/composer.lock index 2888a3291..cc7af15d8 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": "5c19f4766fd04be0cbd38d9f4681864e", + "content-hash": "828ee775e4e3548ef3fb0d9690ca2f44", "packages": [ { "name": "adhocore/json-comment", @@ -122,16 +122,16 @@ }, { "name": "pocketmine/bedrock-block-upgrade-schema", - "version": "3.3.0", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockBlockUpgradeSchema.git", - "reference": "ee46b9367af262bbddd9f122d4d5b5b495b892e7" + "reference": "9872eb37f15080b19c2b7861085e549c48dda92d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/ee46b9367af262bbddd9f122d4d5b5b495b892e7", - "reference": "ee46b9367af262bbddd9f122d4d5b5b495b892e7", + "url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/9872eb37f15080b19c2b7861085e549c48dda92d", + "reference": "9872eb37f15080b19c2b7861085e549c48dda92d", "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.3.0" + "source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/3.4.0" }, - "time": "2023-10-16T16:11:02+00:00" + "time": "2023-11-08T15:22:06+00:00" }, { "name": "pocketmine/bedrock-data", - "version": "2.6.0+bedrock-1.20.40", + "version": "2.7.0+bedrock-1.20.50", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "37e780d28b470230bda3579b04cb50d406e3fbe6" + "reference": "36f975dfca7520b7d36b0b39429f274464c9bc13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/37e780d28b470230bda3579b04cb50d406e3fbe6", - "reference": "37e780d28b470230bda3579b04cb50d406e3fbe6", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/36f975dfca7520b7d36b0b39429f274464c9bc13", + "reference": "36f975dfca7520b7d36b0b39429f274464c9bc13", "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.40" + "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.20.50" }, - "time": "2023-10-26T10:39:13+00:00" + "time": "2023-12-06T13:59:08+00:00" }, { "name": "pocketmine/bedrock-item-upgrade-schema", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockItemUpgradeSchema.git", - "reference": "3edc9ebbad9a4f2d9c8f53b3a5ba44d4a792ad93" + "reference": "d374e5fd8302977675dcd2a42733abd3ee476ca1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/3edc9ebbad9a4f2d9c8f53b3a5ba44d4a792ad93", - "reference": "3edc9ebbad9a4f2d9c8f53b3a5ba44d4a792ad93", + "url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/d374e5fd8302977675dcd2a42733abd3ee476ca1", + "reference": "d374e5fd8302977675dcd2a42733abd3ee476ca1", "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.5.0" + "source": "https://github.com/pmmp/BedrockItemUpgradeSchema/tree/1.6.0" }, - "time": "2023-09-01T19:58:57+00:00" + "time": "2023-11-08T18:12:14+00:00" }, { "name": "pocketmine/bedrock-protocol", - "version": "25.0.0+bedrock-1.20.40", + "version": "26.0.0+bedrock-1.20.50", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "69c36c96f6835e93fc278071aa2bb9829abe5cf8" + "reference": "f278a0b6d4fa1e2e0408a125f323a3118b1968df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/69c36c96f6835e93fc278071aa2bb9829abe5cf8", - "reference": "69c36c96f6835e93fc278071aa2bb9829abe5cf8", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/f278a0b6d4fa1e2e0408a125f323a3118b1968df", + "reference": "f278a0b6d4fa1e2e0408a125f323a3118b1968df", "shasum": "" }, "require": { @@ -223,10 +223,10 @@ "ramsey/uuid": "^4.1" }, "require-dev": { - "phpstan/phpstan": "1.10.33", + "phpstan/phpstan": "1.10.39", "phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.0.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^9.5 || ^10.0" }, "type": "library", "autoload": { @@ -241,9 +241,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/25.0.0+bedrock-1.20.40" + "source": "https://github.com/pmmp/BedrockProtocol/tree/26.0.0+bedrock-1.20.50" }, - "time": "2023-10-26T11:03:10+00:00" + "time": "2023-12-06T14:08:37+00:00" }, { "name": "pocketmine/binaryutils", @@ -830,16 +830,16 @@ }, { "name": "ramsey/uuid", - "version": "4.7.4", + "version": "4.7.5", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "60a4c63ab724854332900504274f6150ff26d286" + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286", - "reference": "60a4c63ab724854332900504274f6150ff26d286", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", "shasum": "" }, "require": { @@ -906,7 +906,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.7.4" + "source": "https://github.com/ramsey/uuid/tree/4.7.5" }, "funding": [ { @@ -918,7 +918,7 @@ "type": "tidelift" } ], - "time": "2023-04-15T23:01:58+00:00" + "time": "2023-11-08T05:53:05+00:00" }, { "name": "symfony/filesystem", @@ -1378,16 +1378,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.41", + "version": "1.10.47", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c6174523c2a69231df55bdc65b61655e72876d76" + "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6174523c2a69231df55bdc65b61655e72876d76", - "reference": "c6174523c2a69231df55bdc65b61655e72876d76", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", + "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", "shasum": "" }, "require": { @@ -1436,7 +1436,7 @@ "type": "tidelift" } ], - "time": "2023-11-05T12:57:57+00:00" + "time": "2023-12-01T15:19:17+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -1541,16 +1541,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.7", + "version": "10.1.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" + "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", - "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/a56a9ab2f680246adcf3db43f38ddf1765774735", + "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735", "shasum": "" }, "require": { @@ -1607,7 +1607,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.9" }, "funding": [ { @@ -1615,7 +1615,7 @@ "type": "github" } ], - "time": "2023-10-04T15:34:17+00:00" + "time": "2023-11-23T12:23:20+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2878,16 +2878,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -2916,7 +2916,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -2924,7 +2924,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], diff --git a/src/VersionInfo.php b/src/VersionInfo.php index e0f4ca4f3..4459f9551 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,7 +31,7 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "5.8.3"; + public const BASE_VERSION = "5.9.1"; public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; diff --git a/src/data/bedrock/block/BlockStateData.php b/src/data/bedrock/block/BlockStateData.php index 54f13ba56..1417fa014 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 - (40 << 8) | //patch - (3); //revision + (50 << 8) | //patch + (1); //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 0e1b29e27..9b28e936d 100644 --- a/src/data/bedrock/block/BlockStateNames.php +++ b/src/data/bedrock/block/BlockStateNames.php @@ -66,6 +66,7 @@ final class BlockStateNames{ public const CORAL_HANG_TYPE_BIT = "coral_hang_type_bit"; public const COVERED_BIT = "covered_bit"; public const CRACKED_STATE = "cracked_state"; + public const CRAFTING = "crafting"; public const DAMAGE = "damage"; public const DEAD_BIT = "dead_bit"; public const DEPRECATED = "deprecated"; @@ -109,6 +110,7 @@ final class BlockStateNames{ 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"; public const OUTPUT_SUBTRACT_BIT = "output_subtract_bit"; public const PERSISTENT_BIT = "persistent_bit"; @@ -136,7 +138,6 @@ final class BlockStateNames{ public const STONE_SLAB_TYPE_2 = "stone_slab_type_2"; public const STONE_SLAB_TYPE_3 = "stone_slab_type_3"; public const STONE_SLAB_TYPE_4 = "stone_slab_type_4"; - public const STONE_TYPE = "stone_type"; public const STRIPPED_BIT = "stripped_bit"; public const STRUCTURE_BLOCK_TYPE = "structure_block_type"; public const STRUCTURE_VOID_TYPE = "structure_void_type"; diff --git a/src/data/bedrock/block/BlockStateStringValues.php b/src/data/bedrock/block/BlockStateStringValues.php index 712ff7079..4a05fa33e 100644 --- a/src/data/bedrock/block/BlockStateStringValues.php +++ b/src/data/bedrock/block/BlockStateStringValues.php @@ -168,6 +168,19 @@ final class BlockStateStringValues{ 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"; + public const ORIENTATION_DOWN_WEST = "down_west"; + public const ORIENTATION_EAST_UP = "east_up"; + public const ORIENTATION_NORTH_UP = "north_up"; + public const ORIENTATION_SOUTH_UP = "south_up"; + public const ORIENTATION_UP_EAST = "up_east"; + public const ORIENTATION_UP_NORTH = "up_north"; + public const ORIENTATION_UP_SOUTH = "up_south"; + public const ORIENTATION_UP_WEST = "up_west"; + public const ORIENTATION_WEST_UP = "west_up"; + public const PILLAR_AXIS_X = "x"; public const PILLAR_AXIS_Y = "y"; public const PILLAR_AXIS_Z = "z"; @@ -241,14 +254,6 @@ final class BlockStateStringValues{ public const STONE_SLAB_TYPE_4_SMOOTH_QUARTZ = "smooth_quartz"; public const STONE_SLAB_TYPE_4_STONE = "stone"; - public const STONE_TYPE_ANDESITE = "andesite"; - public const STONE_TYPE_ANDESITE_SMOOTH = "andesite_smooth"; - public const STONE_TYPE_DIORITE = "diorite"; - public const STONE_TYPE_DIORITE_SMOOTH = "diorite_smooth"; - public const STONE_TYPE_GRANITE = "granite"; - public const STONE_TYPE_GRANITE_SMOOTH = "granite_smooth"; - public const STONE_TYPE_STONE = "stone"; - public const STRUCTURE_BLOCK_TYPE_CORNER = "corner"; public const STRUCTURE_BLOCK_TYPE_DATA = "data"; public const STRUCTURE_BLOCK_TYPE_EXPORT = "export"; diff --git a/src/data/bedrock/block/BlockTypeNames.php b/src/data/bedrock/block/BlockTypeNames.php index 0fa106049..fdca40a3a 100644 --- a/src/data/bedrock/block/BlockTypeNames.php +++ b/src/data/bedrock/block/BlockTypeNames.php @@ -37,6 +37,7 @@ final class BlockTypeNames{ public const ACACIA_FENCE_GATE = "minecraft:acacia_fence_gate"; public const ACACIA_HANGING_SIGN = "minecraft:acacia_hanging_sign"; 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_STAIRS = "minecraft:acacia_stairs"; public const ACACIA_STANDING_SIGN = "minecraft:acacia_standing_sign"; @@ -48,6 +49,7 @@ final class BlockTypeNames{ public const AMETHYST_BLOCK = "minecraft:amethyst_block"; public const AMETHYST_CLUSTER = "minecraft:amethyst_cluster"; public const ANCIENT_DEBRIS = "minecraft:ancient_debris"; + public const ANDESITE = "minecraft:andesite"; public const ANDESITE_STAIRS = "minecraft:andesite_stairs"; public const ANVIL = "minecraft:anvil"; public const AZALEA = "minecraft:azalea"; @@ -90,6 +92,7 @@ final class BlockTypeNames{ public const BIRCH_FENCE_GATE = "minecraft:birch_fence_gate"; public const BIRCH_HANGING_SIGN = "minecraft:birch_hanging_sign"; 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_STAIRS = "minecraft:birch_stairs"; public const BIRCH_STANDING_SIGN = "minecraft:birch_standing_sign"; @@ -185,9 +188,12 @@ final class BlockTypeNames{ public const CHERRY_WOOD = "minecraft:cherry_wood"; public const CHEST = "minecraft:chest"; public const CHISELED_BOOKSHELF = "minecraft:chiseled_bookshelf"; + public const CHISELED_COPPER = "minecraft:chiseled_copper"; public const CHISELED_DEEPSLATE = "minecraft:chiseled_deepslate"; public const CHISELED_NETHER_BRICKS = "minecraft:chiseled_nether_bricks"; public const CHISELED_POLISHED_BLACKSTONE = "minecraft:chiseled_polished_blackstone"; + public const CHISELED_TUFF = "minecraft:chiseled_tuff"; + public const CHISELED_TUFF_BRICKS = "minecraft:chiseled_tuff_bricks"; public const CHORUS_FLOWER = "minecraft:chorus_flower"; public const CHORUS_PLANT = "minecraft:chorus_plant"; public const CLAY = "minecraft:clay"; @@ -208,7 +214,11 @@ final class BlockTypeNames{ public const COMPOSTER = "minecraft:composter"; public const CONDUIT = "minecraft:conduit"; public const COPPER_BLOCK = "minecraft:copper_block"; + public const COPPER_BULB = "minecraft:copper_bulb"; + public const COPPER_DOOR = "minecraft:copper_door"; + public const COPPER_GRATE = "minecraft:copper_grate"; public const COPPER_ORE = "minecraft:copper_ore"; + public const COPPER_TRAPDOOR = "minecraft:copper_trapdoor"; public const CORAL_BLOCK = "minecraft:coral_block"; public const CORAL_FAN = "minecraft:coral_fan"; public const CORAL_FAN_DEAD = "minecraft:coral_fan_dead"; @@ -219,6 +229,7 @@ final class BlockTypeNames{ public const CRACKED_DEEPSLATE_TILES = "minecraft:cracked_deepslate_tiles"; public const CRACKED_NETHER_BRICKS = "minecraft:cracked_nether_bricks"; public const CRACKED_POLISHED_BLACKSTONE_BRICKS = "minecraft:cracked_polished_blackstone_bricks"; + public const CRAFTER = "minecraft:crafter"; public const CRAFTING_TABLE = "minecraft:crafting_table"; public const CRIMSON_BUTTON = "minecraft:crimson_button"; public const CRIMSON_DOOR = "minecraft:crimson_door"; @@ -259,6 +270,7 @@ final class BlockTypeNames{ 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_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_STAIRS = "minecraft:dark_oak_stairs"; public const DARK_OAK_TRAPDOOR = "minecraft:dark_oak_trapdoor"; @@ -297,6 +309,7 @@ final class BlockTypeNames{ public const DETECTOR_RAIL = "minecraft:detector_rail"; public const DIAMOND_BLOCK = "minecraft:diamond_block"; public const DIAMOND_ORE = "minecraft:diamond_ore"; + public const DIORITE = "minecraft:diorite"; public const DIORITE_STAIRS = "minecraft:diorite_stairs"; public const DIRT = "minecraft:dirt"; public const DIRT_WITH_ROOTS = "minecraft:dirt_with_roots"; @@ -442,7 +455,12 @@ final class BlockTypeNames{ public const END_ROD = "minecraft:end_rod"; public const END_STONE = "minecraft:end_stone"; public const ENDER_CHEST = "minecraft:ender_chest"; + public const EXPOSED_CHISELED_COPPER = "minecraft:exposed_chiseled_copper"; public const EXPOSED_COPPER = "minecraft:exposed_copper"; + public const EXPOSED_COPPER_BULB = "minecraft:exposed_copper_bulb"; + public const EXPOSED_COPPER_DOOR = "minecraft:exposed_copper_door"; + public const EXPOSED_COPPER_GRATE = "minecraft:exposed_copper_grate"; + public const EXPOSED_COPPER_TRAPDOOR = "minecraft:exposed_copper_trapdoor"; public const EXPOSED_CUT_COPPER = "minecraft:exposed_cut_copper"; public const EXPOSED_CUT_COPPER_SLAB = "minecraft:exposed_cut_copper_slab"; public const EXPOSED_CUT_COPPER_STAIRS = "minecraft:exposed_cut_copper_stairs"; @@ -470,6 +488,7 @@ final class BlockTypeNames{ public const GOLD_BLOCK = "minecraft:gold_block"; public const GOLD_ORE = "minecraft:gold_ore"; 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_PATH = "minecraft:grass_path"; @@ -527,6 +546,7 @@ final class BlockTypeNames{ public const JUNGLE_FENCE_GATE = "minecraft:jungle_fence_gate"; public const JUNGLE_HANGING_SIGN = "minecraft:jungle_hanging_sign"; 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_STAIRS = "minecraft:jungle_stairs"; public const JUNGLE_STANDING_SIGN = "minecraft:jungle_standing_sign"; @@ -651,6 +671,7 @@ final class BlockTypeNames{ public const OAK_FENCE = "minecraft:oak_fence"; public const OAK_HANGING_SIGN = "minecraft:oak_hanging_sign"; public const OAK_LOG = "minecraft:oak_log"; + public const OAK_PLANKS = "minecraft:oak_planks"; public const OAK_STAIRS = "minecraft:oak_stairs"; public const OBSERVER = "minecraft:observer"; public const OBSIDIAN = "minecraft:obsidian"; @@ -666,7 +687,12 @@ final class BlockTypeNames{ public const ORANGE_STAINED_GLASS_PANE = "minecraft:orange_stained_glass_pane"; public const ORANGE_TERRACOTTA = "minecraft:orange_terracotta"; public const ORANGE_WOOL = "minecraft:orange_wool"; + public const OXIDIZED_CHISELED_COPPER = "minecraft:oxidized_chiseled_copper"; public const OXIDIZED_COPPER = "minecraft:oxidized_copper"; + public const OXIDIZED_COPPER_BULB = "minecraft:oxidized_copper_bulb"; + public const OXIDIZED_COPPER_DOOR = "minecraft:oxidized_copper_door"; + public const OXIDIZED_COPPER_GRATE = "minecraft:oxidized_copper_grate"; + public const OXIDIZED_COPPER_TRAPDOOR = "minecraft:oxidized_copper_trapdoor"; public const OXIDIZED_CUT_COPPER = "minecraft:oxidized_cut_copper"; public const OXIDIZED_CUT_COPPER_SLAB = "minecraft:oxidized_cut_copper_slab"; public const OXIDIZED_CUT_COPPER_STAIRS = "minecraft:oxidized_cut_copper_stairs"; @@ -690,9 +716,9 @@ final class BlockTypeNames{ public const PISTON_ARM_COLLISION = "minecraft:piston_arm_collision"; public const PITCHER_CROP = "minecraft:pitcher_crop"; public const PITCHER_PLANT = "minecraft:pitcher_plant"; - public const PLANKS = "minecraft:planks"; public const PODZOL = "minecraft:podzol"; public const POINTED_DRIPSTONE = "minecraft:pointed_dripstone"; + public const POLISHED_ANDESITE = "minecraft:polished_andesite"; public const POLISHED_ANDESITE_STAIRS = "minecraft:polished_andesite_stairs"; public const POLISHED_BASALT = "minecraft:polished_basalt"; public const POLISHED_BLACKSTONE = "minecraft:polished_blackstone"; @@ -712,8 +738,15 @@ final class BlockTypeNames{ public const POLISHED_DEEPSLATE_SLAB = "minecraft:polished_deepslate_slab"; public const POLISHED_DEEPSLATE_STAIRS = "minecraft:polished_deepslate_stairs"; public const POLISHED_DEEPSLATE_WALL = "minecraft:polished_deepslate_wall"; + public const POLISHED_DIORITE = "minecraft:polished_diorite"; public const POLISHED_DIORITE_STAIRS = "minecraft:polished_diorite_stairs"; + public const POLISHED_GRANITE = "minecraft:polished_granite"; public const POLISHED_GRANITE_STAIRS = "minecraft:polished_granite_stairs"; + public const POLISHED_TUFF = "minecraft:polished_tuff"; + public const POLISHED_TUFF_DOUBLE_SLAB = "minecraft:polished_tuff_double_slab"; + public const POLISHED_TUFF_SLAB = "minecraft:polished_tuff_slab"; + public const POLISHED_TUFF_STAIRS = "minecraft:polished_tuff_stairs"; + public const POLISHED_TUFF_WALL = "minecraft:polished_tuff_wall"; public const PORTAL = "minecraft:portal"; public const POTATOES = "minecraft:potatoes"; public const POWDER_SNOW = "minecraft:powder_snow"; @@ -816,6 +849,7 @@ final class BlockTypeNames{ public const SPRUCE_FENCE_GATE = "minecraft:spruce_fence_gate"; public const SPRUCE_HANGING_SIGN = "minecraft:spruce_hanging_sign"; 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_STAIRS = "minecraft:spruce_stairs"; public const SPRUCE_STANDING_SIGN = "minecraft:spruce_standing_sign"; @@ -870,6 +904,15 @@ final class BlockTypeNames{ public const TRIPWIRE_HOOK = "minecraft:tripwire_hook"; public const TUBE_CORAL = "minecraft:tube_coral"; public const TUFF = "minecraft:tuff"; + public const TUFF_BRICK_DOUBLE_SLAB = "minecraft:tuff_brick_double_slab"; + public const TUFF_BRICK_SLAB = "minecraft:tuff_brick_slab"; + public const TUFF_BRICK_STAIRS = "minecraft:tuff_brick_stairs"; + public const TUFF_BRICK_WALL = "minecraft:tuff_brick_wall"; + public const TUFF_BRICKS = "minecraft:tuff_bricks"; + public const TUFF_DOUBLE_SLAB = "minecraft:tuff_double_slab"; + public const TUFF_SLAB = "minecraft:tuff_slab"; + public const TUFF_STAIRS = "minecraft:tuff_stairs"; + public const TUFF_WALL = "minecraft:tuff_wall"; public const TURTLE_EGG = "minecraft:turtle_egg"; public const TWISTING_VINES = "minecraft:twisting_vines"; public const UNDERWATER_TORCH = "minecraft:underwater_torch"; @@ -903,27 +946,52 @@ final class BlockTypeNames{ public const WARPED_WART_BLOCK = "minecraft:warped_wart_block"; public const WATER = "minecraft:water"; public const WATERLILY = "minecraft:waterlily"; + public const WAXED_CHISELED_COPPER = "minecraft:waxed_chiseled_copper"; public const WAXED_COPPER = "minecraft:waxed_copper"; + public const WAXED_COPPER_BULB = "minecraft:waxed_copper_bulb"; + public const WAXED_COPPER_DOOR = "minecraft:waxed_copper_door"; + public const WAXED_COPPER_GRATE = "minecraft:waxed_copper_grate"; + public const WAXED_COPPER_TRAPDOOR = "minecraft:waxed_copper_trapdoor"; public const WAXED_CUT_COPPER = "minecraft:waxed_cut_copper"; public const WAXED_CUT_COPPER_SLAB = "minecraft:waxed_cut_copper_slab"; public const WAXED_CUT_COPPER_STAIRS = "minecraft:waxed_cut_copper_stairs"; public const WAXED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_double_cut_copper_slab"; + public const WAXED_EXPOSED_CHISELED_COPPER = "minecraft:waxed_exposed_chiseled_copper"; public const WAXED_EXPOSED_COPPER = "minecraft:waxed_exposed_copper"; + public const WAXED_EXPOSED_COPPER_BULB = "minecraft:waxed_exposed_copper_bulb"; + public const WAXED_EXPOSED_COPPER_DOOR = "minecraft:waxed_exposed_copper_door"; + public const WAXED_EXPOSED_COPPER_GRATE = "minecraft:waxed_exposed_copper_grate"; + public const WAXED_EXPOSED_COPPER_TRAPDOOR = "minecraft:waxed_exposed_copper_trapdoor"; public const WAXED_EXPOSED_CUT_COPPER = "minecraft:waxed_exposed_cut_copper"; public const WAXED_EXPOSED_CUT_COPPER_SLAB = "minecraft:waxed_exposed_cut_copper_slab"; public const WAXED_EXPOSED_CUT_COPPER_STAIRS = "minecraft:waxed_exposed_cut_copper_stairs"; public const WAXED_EXPOSED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_exposed_double_cut_copper_slab"; + public const WAXED_OXIDIZED_CHISELED_COPPER = "minecraft:waxed_oxidized_chiseled_copper"; public const WAXED_OXIDIZED_COPPER = "minecraft:waxed_oxidized_copper"; + public const WAXED_OXIDIZED_COPPER_BULB = "minecraft:waxed_oxidized_copper_bulb"; + public const WAXED_OXIDIZED_COPPER_DOOR = "minecraft:waxed_oxidized_copper_door"; + public const WAXED_OXIDIZED_COPPER_GRATE = "minecraft:waxed_oxidized_copper_grate"; + public const WAXED_OXIDIZED_COPPER_TRAPDOOR = "minecraft:waxed_oxidized_copper_trapdoor"; public const WAXED_OXIDIZED_CUT_COPPER = "minecraft:waxed_oxidized_cut_copper"; public const WAXED_OXIDIZED_CUT_COPPER_SLAB = "minecraft:waxed_oxidized_cut_copper_slab"; public const WAXED_OXIDIZED_CUT_COPPER_STAIRS = "minecraft:waxed_oxidized_cut_copper_stairs"; public const WAXED_OXIDIZED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_oxidized_double_cut_copper_slab"; + public const WAXED_WEATHERED_CHISELED_COPPER = "minecraft:waxed_weathered_chiseled_copper"; public const WAXED_WEATHERED_COPPER = "minecraft:waxed_weathered_copper"; + public const WAXED_WEATHERED_COPPER_BULB = "minecraft:waxed_weathered_copper_bulb"; + public const WAXED_WEATHERED_COPPER_DOOR = "minecraft:waxed_weathered_copper_door"; + public const WAXED_WEATHERED_COPPER_GRATE = "minecraft:waxed_weathered_copper_grate"; + public const WAXED_WEATHERED_COPPER_TRAPDOOR = "minecraft:waxed_weathered_copper_trapdoor"; public const WAXED_WEATHERED_CUT_COPPER = "minecraft:waxed_weathered_cut_copper"; public const WAXED_WEATHERED_CUT_COPPER_SLAB = "minecraft:waxed_weathered_cut_copper_slab"; public const WAXED_WEATHERED_CUT_COPPER_STAIRS = "minecraft:waxed_weathered_cut_copper_stairs"; public const WAXED_WEATHERED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_weathered_double_cut_copper_slab"; + public const WEATHERED_CHISELED_COPPER = "minecraft:weathered_chiseled_copper"; public const WEATHERED_COPPER = "minecraft:weathered_copper"; + public const WEATHERED_COPPER_BULB = "minecraft:weathered_copper_bulb"; + public const WEATHERED_COPPER_DOOR = "minecraft:weathered_copper_door"; + public const WEATHERED_COPPER_GRATE = "minecraft:weathered_copper_grate"; + public const WEATHERED_COPPER_TRAPDOOR = "minecraft:weathered_copper_trapdoor"; public const WEATHERED_CUT_COPPER = "minecraft:weathered_cut_copper"; public const WEATHERED_CUT_COPPER_SLAB = "minecraft:weathered_cut_copper_slab"; public const WEATHERED_CUT_COPPER_STAIRS = "minecraft:weathered_cut_copper_stairs"; diff --git a/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php b/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php index c0b9a9fca..f70162ac5 100644 --- a/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php +++ b/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php @@ -521,7 +521,8 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $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->mapSimple(Blocks::ACACIA_FENCE(), Ids::ACACIA_FENCE); - //wood, planks and slabs still use the old way of storing wood type + $this->mapSimple(Blocks::ACACIA_PLANKS(), Ids::ACACIA_PLANKS); + //wood and slabs still use the old way of storing wood type $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))); @@ -532,8 +533,9 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $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->mapSimple(Blocks::BIRCH_FENCE(), Ids::BIRCH_FENCE); + $this->mapSimple(Blocks::BIRCH_PLANKS(), Ids::BIRCH_PLANKS); $this->mapStairs(Blocks::BIRCH_STAIRS(), Ids::BIRCH_STAIRS); - //wood, planks and slabs still use the old way of storing wood type + //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))); @@ -582,8 +584,9 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $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->mapSimple(Blocks::DARK_OAK_FENCE(), Ids::DARK_OAK_FENCE); + $this->mapSimple(Blocks::DARK_OAK_PLANKS(), Ids::DARK_OAK_PLANKS); $this->mapStairs(Blocks::DARK_OAK_STAIRS(), Ids::DARK_OAK_STAIRS); - //wood, planks and slabs still use the old way of storing wood type + //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))); @@ -594,8 +597,9 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $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->mapSimple(Blocks::JUNGLE_FENCE(), Ids::JUNGLE_FENCE); + $this->mapSimple(Blocks::JUNGLE_PLANKS(), Ids::JUNGLE_PLANKS); $this->mapStairs(Blocks::JUNGLE_STAIRS(), Ids::JUNGLE_STAIRS); - //wood, planks and slabs still use the old way of storing wood type + //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))); @@ -630,20 +634,22 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $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->mapSimple(Blocks::OAK_FENCE(), Ids::OAK_FENCE); + $this->mapSimple(Blocks::OAK_PLANKS(), Ids::OAK_PLANKS); $this->mapStairs(Blocks::OAK_STAIRS(), Ids::OAK_STAIRS); - //wood, planks and slabs still use the old way of storing wood type + //wood and slabs still use the old way of storing wood type - $this->mapSimple(Blocks::SPRUCE_FENCE(), Ids::SPRUCE_FENCE); - $this->mapLog(Blocks::SPRUCE_LOG(), Ids::SPRUCE_LOG, Ids::STRIPPED_SPRUCE_LOG); $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))); $this->map(Blocks::SPRUCE_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block, new Writer(Ids::SPRUCE_FENCE_GATE))); $this->map(Blocks::SPRUCE_PRESSURE_PLATE(), fn(WoodenPressurePlate $block) => Helper::encodeSimplePressurePlate($block, new Writer(Ids::SPRUCE_PRESSURE_PLATE))); $this->map(Blocks::SPRUCE_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block, new Writer(Ids::SPRUCE_STANDING_SIGN))); - $this->mapStairs(Blocks::SPRUCE_STAIRS(), Ids::SPRUCE_STAIRS); $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))); - //wood, planks and slabs still use the old way of storing wood type + $this->mapLog(Blocks::SPRUCE_LOG(), Ids::SPRUCE_LOG, Ids::STRIPPED_SPRUCE_LOG); + $this->mapSimple(Blocks::SPRUCE_FENCE(), Ids::SPRUCE_FENCE); + $this->mapSimple(Blocks::SPRUCE_PLANKS(), Ids::SPRUCE_PLANKS); + $this->mapStairs(Blocks::SPRUCE_STAIRS(), Ids::SPRUCE_STAIRS); + //wood and slabs still use the old way of storing wood type $this->map(Blocks::WARPED_BUTTON(), fn(Button $block) => Helper::encodeButton($block, new Writer(Ids::WARPED_BUTTON))); $this->map(Blocks::WARPED_DOOR(), fn(Door $block) => Helper::encodeDoor($block, new Writer(Ids::WARPED_DOOR))); @@ -661,18 +667,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ } private function registerLegacyWoodBlockSerializers() : void{ - foreach([ - StringValues::WOOD_TYPE_ACACIA => Blocks::ACACIA_PLANKS(), - StringValues::WOOD_TYPE_BIRCH => Blocks::BIRCH_PLANKS(), - StringValues::WOOD_TYPE_DARK_OAK => Blocks::DARK_OAK_PLANKS(), - StringValues::WOOD_TYPE_JUNGLE => Blocks::JUNGLE_PLANKS(), - StringValues::WOOD_TYPE_OAK => Blocks::OAK_PLANKS(), - StringValues::WOOD_TYPE_SPRUCE => Blocks::SPRUCE_PLANKS(), - ] as $woodType => $block){ - $this->map($block, fn() => Writer::create(Ids::PLANKS) - ->writeString(StateNames::WOOD_TYPE, $woodType)); - } - foreach([ StringValues::WOOD_TYPE_ACACIA => Blocks::ACACIA_SLAB(), StringValues::WOOD_TYPE_BIRCH => Blocks::BIRCH_SLAB(), @@ -716,6 +710,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapSimple(Blocks::AIR(), Ids::AIR); $this->mapSimple(Blocks::AMETHYST(), Ids::AMETHYST_BLOCK); $this->mapSimple(Blocks::ANCIENT_DEBRIS(), Ids::ANCIENT_DEBRIS); + $this->mapSimple(Blocks::ANDESITE(), Ids::ANDESITE); $this->mapSimple(Blocks::BARRIER(), Ids::BARRIER); $this->mapSimple(Blocks::BEACON(), Ids::BEACON); $this->mapSimple(Blocks::BLACKSTONE(), Ids::BLACKSTONE); @@ -758,6 +753,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapSimple(Blocks::DEEPSLATE_TILES(), Ids::DEEPSLATE_TILES); $this->mapSimple(Blocks::DIAMOND(), Ids::DIAMOND_BLOCK); $this->mapSimple(Blocks::DIAMOND_ORE(), Ids::DIAMOND_ORE); + $this->mapSimple(Blocks::DIORITE(), Ids::DIORITE); $this->mapSimple(Blocks::DRAGON_EGG(), Ids::DRAGON_EGG); $this->mapSimple(Blocks::DRIED_KELP(), Ids::DRIED_KELP_BLOCK); $this->mapSimple(Blocks::ELEMENT_ACTINIUM(), Ids::ELEMENT_89); @@ -892,6 +888,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapSimple(Blocks::GLOWSTONE(), Ids::GLOWSTONE); $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_PATH(), Ids::GRASS_PATH); $this->mapSimple(Blocks::GRAVEL(), Ids::GRAVEL); @@ -933,9 +930,12 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapSimple(Blocks::PACKED_ICE(), Ids::PACKED_ICE); $this->mapSimple(Blocks::PACKED_MUD(), Ids::PACKED_MUD); $this->mapSimple(Blocks::PODZOL(), Ids::PODZOL); + $this->mapSimple(Blocks::POLISHED_ANDESITE(), Ids::POLISHED_ANDESITE); $this->mapSimple(Blocks::POLISHED_BLACKSTONE(), Ids::POLISHED_BLACKSTONE); $this->mapSimple(Blocks::POLISHED_BLACKSTONE_BRICKS(), Ids::POLISHED_BLACKSTONE_BRICKS); $this->mapSimple(Blocks::POLISHED_DEEPSLATE(), Ids::POLISHED_DEEPSLATE); + $this->mapSimple(Blocks::POLISHED_DIORITE(), Ids::POLISHED_DIORITE); + $this->mapSimple(Blocks::POLISHED_GRANITE(), Ids::POLISHED_GRANITE); $this->mapSimple(Blocks::QUARTZ_BRICKS(), Ids::QUARTZ_BRICKS); $this->mapSimple(Blocks::RAW_COPPER(), Ids::RAW_COPPER_BLOCK); $this->mapSimple(Blocks::RAW_GOLD(), Ids::RAW_GOLD_BLOCK); @@ -957,6 +957,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapSimple(Blocks::SOUL_SAND(), Ids::SOUL_SAND); $this->mapSimple(Blocks::SOUL_SOIL(), Ids::SOUL_SOIL); $this->mapSimple(Blocks::SPORE_BLOSSOM(), Ids::SPORE_BLOSSOM); + $this->mapSimple(Blocks::STONE(), Ids::STONE); $this->mapSimple(Blocks::TINTED_GLASS(), Ids::TINTED_GLASS); $this->mapSimple(Blocks::TORCHFLOWER(), Ids::TORCHFLOWER); $this->mapSimple(Blocks::TUFF(), Ids::TUFF); @@ -985,7 +986,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ }) ->writeBlockFace($block->getFacing()) ); - $this->map(Blocks::ANDESITE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_ANDESITE)); $this->map(Blocks::ANDESITE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab3($block, StringValues::STONE_SLAB_TYPE_3_ANDESITE)); $this->map(Blocks::ANDESITE_STAIRS(), fn(Stair $block) => Helper::encodeStairs($block, new Writer(Ids::ANDESITE_STAIRS))); $this->map(Blocks::ANDESITE_WALL(), fn(Wall $block) => Helper::encodeLegacyWall($block, StringValues::WALL_BLOCK_TYPE_ANDESITE)); @@ -1268,7 +1268,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ ->writeBool(StateNames::RAIL_DATA_BIT, $block->isActivated()) ->writeInt(StateNames::RAIL_DIRECTION, $block->getShape()); }); - $this->map(Blocks::DIORITE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_DIORITE)); $this->map(Blocks::DIORITE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab3($block, StringValues::STONE_SLAB_TYPE_3_DIORITE)); $this->mapStairs(Blocks::DIORITE_STAIRS(), Ids::DIORITE_STAIRS); $this->map(Blocks::DIORITE_WALL(), fn(Wall $block) => Helper::encodeLegacyWall($block, StringValues::WALL_BLOCK_TYPE_DIORITE)); @@ -1335,7 +1334,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ ->writeFacingFlags($block->getFaces()); }); $this->map(Blocks::GLOWING_ITEM_FRAME(), fn(ItemFrame $block) => Helper::encodeItemFrame($block, Ids::GLOW_FRAME)); - $this->map(Blocks::GRANITE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_GRANITE)); $this->map(Blocks::GRANITE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab3($block, StringValues::STONE_SLAB_TYPE_3_GRANITE)); $this->mapStairs(Blocks::GRANITE_STAIRS(), Ids::GRANITE_STAIRS); $this->map(Blocks::GRANITE_WALL(), fn(Wall $block) => Helper::encodeLegacyWall($block, StringValues::WALL_BLOCK_TYPE_GRANITE)); @@ -1473,7 +1471,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ ->writeInt(StateNames::GROWTH, $block->getAge() + 1 + PitcherCrop::MAX_AGE) ->writeBool(StateNames::UPPER_BLOCK_BIT, $block->isTop()); }); - $this->map(Blocks::POLISHED_ANDESITE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_ANDESITE_SMOOTH)); $this->map(Blocks::POLISHED_ANDESITE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab3($block, StringValues::STONE_SLAB_TYPE_3_POLISHED_ANDESITE)); $this->mapStairs(Blocks::POLISHED_ANDESITE_STAIRS(), Ids::POLISHED_ANDESITE_STAIRS); $this->map(Blocks::POLISHED_BASALT(), function(SimplePillar $block) : Writer{ @@ -1491,10 +1488,8 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ $this->mapSlab(Blocks::POLISHED_DEEPSLATE_SLAB(), Ids::POLISHED_DEEPSLATE_SLAB, Ids::POLISHED_DEEPSLATE_DOUBLE_SLAB); $this->mapStairs(Blocks::POLISHED_DEEPSLATE_STAIRS(), Ids::POLISHED_DEEPSLATE_STAIRS); $this->map(Blocks::POLISHED_DEEPSLATE_WALL(), fn(Wall $block) => Helper::encodeWall($block, new Writer(Ids::POLISHED_DEEPSLATE_WALL))); - $this->map(Blocks::POLISHED_DIORITE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_DIORITE_SMOOTH)); $this->map(Blocks::POLISHED_DIORITE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab3($block, StringValues::STONE_SLAB_TYPE_3_POLISHED_DIORITE)); $this->mapStairs(Blocks::POLISHED_DIORITE_STAIRS(), Ids::POLISHED_DIORITE_STAIRS); - $this->map(Blocks::POLISHED_GRANITE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_GRANITE_SMOOTH)); $this->map(Blocks::POLISHED_GRANITE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab3($block, StringValues::STONE_SLAB_TYPE_3_POLISHED_GRANITE)); $this->mapStairs(Blocks::POLISHED_GRANITE_STAIRS(), Ids::POLISHED_GRANITE_STAIRS); $this->map(Blocks::POPPY(), fn() => Helper::encodeRedFlower(StringValues::FLOWER_TYPE_POPPY)); @@ -1630,7 +1625,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{ return Writer::create(Ids::HARD_STAINED_GLASS_PANE) ->writeColor($block->getColor()); }); - $this->map(Blocks::STONE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_STONE)); $this->map(Blocks::STONECUTTER(), fn(Stonecutter $block) => Writer::create(Ids::STONECUTTER_BLOCK) ->writeCardinalHorizontalFacing($block->getFacing())); $this->map(Blocks::STONE_BRICKS(), fn() => Helper::encodeStoneBricks(StringValues::STONE_BRICK_TYPE_DEFAULT)); diff --git a/src/data/bedrock/block/convert/BlockStateSerializerHelper.php b/src/data/bedrock/block/convert/BlockStateSerializerHelper.php index 2822324e5..2b7e89b57 100644 --- a/src/data/bedrock/block/convert/BlockStateSerializerHelper.php +++ b/src/data/bedrock/block/convert/BlockStateSerializerHelper.php @@ -228,11 +228,6 @@ final class BlockStateSerializerHelper{ ->writeFacingWithoutUp($facing === Facing::UP ? Facing::DOWN : $facing); } - public static function encodeStone(string $type) : BlockStateWriter{ - return BlockStateWriter::create(Ids::STONE) - ->writeString(BlockStateNames::STONE_TYPE, $type); - } - public static function encodeStoneBricks(string $type) : BlockStateWriter{ return BlockStateWriter::create(Ids::STONEBRICK) ->writeString(BlockStateNames::STONE_BRICK_TYPE, $type); diff --git a/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php b/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php index 9af7a17b6..18e9b3e32 100644 --- a/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php +++ b/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php @@ -427,6 +427,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $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->mapSimple(Ids::ACACIA_FENCE, fn() => Blocks::ACACIA_FENCE()); + $this->mapSimple(Ids::ACACIA_PLANKS, fn() => Blocks::ACACIA_PLANKS()); $this->mapStairs(Ids::ACACIA_STAIRS, fn() => Blocks::ACACIA_STAIRS()); //wood, planks and slabs still use the old way of storing wood type @@ -439,6 +440,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $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->mapSimple(Ids::BIRCH_FENCE, fn() => Blocks::BIRCH_FENCE()); + $this->mapSimple(Ids::BIRCH_PLANKS, fn() => Blocks::BIRCH_PLANKS()); $this->mapStairs(Ids::BIRCH_STAIRS, fn() => Blocks::BIRCH_STAIRS()); //wood, planks and slabs still use the old way of storing wood type @@ -483,6 +485,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $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->mapSimple(Ids::DARK_OAK_FENCE, fn() => Blocks::DARK_OAK_FENCE()); + $this->mapSimple(Ids::DARK_OAK_PLANKS, fn() => Blocks::DARK_OAK_PLANKS()); $this->mapStairs(Ids::DARK_OAK_STAIRS, fn() => Blocks::DARK_OAK_STAIRS()); //wood, planks and slabs still use the old way of storing wood type @@ -495,6 +498,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $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->mapSimple(Ids::JUNGLE_FENCE, fn() => Blocks::JUNGLE_FENCE()); + $this->mapSimple(Ids::JUNGLE_PLANKS, fn() => Blocks::JUNGLE_PLANKS()); $this->mapStairs(Ids::JUNGLE_STAIRS, fn() => Blocks::JUNGLE_STAIRS()); //wood, planks and slabs still use the old way of storing wood type @@ -526,6 +530,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $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->mapSimple(Ids::OAK_FENCE, fn() => Blocks::OAK_FENCE()); + $this->mapSimple(Ids::OAK_PLANKS, fn() => Blocks::OAK_PLANKS()); $this->mapStairs(Ids::OAK_STAIRS, fn() => Blocks::OAK_STAIRS()); //wood, planks and slabs still use the old way of storing wood type @@ -538,6 +543,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $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->mapSimple(Ids::SPRUCE_FENCE, fn() => Blocks::SPRUCE_FENCE()); + $this->mapSimple(Ids::SPRUCE_PLANKS, fn() => Blocks::SPRUCE_PLANKS()); $this->mapStairs(Ids::SPRUCE_STAIRS, fn() => Blocks::SPRUCE_STAIRS()); //wood, planks and slabs still use the old way of storing wood type @@ -557,18 +563,6 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ } private function registerLegacyWoodBlockDeserializers() : void{ - - $this->map(Ids::PLANKS, function(Reader $in) : Block{ - return match($woodName = $in->readString(StateNames::WOOD_TYPE)){ - StringValues::WOOD_TYPE_OAK => Blocks::OAK_PLANKS(), - StringValues::WOOD_TYPE_SPRUCE => Blocks::SPRUCE_PLANKS(), - StringValues::WOOD_TYPE_BIRCH => Blocks::BIRCH_PLANKS(), - StringValues::WOOD_TYPE_JUNGLE => Blocks::JUNGLE_PLANKS(), - StringValues::WOOD_TYPE_ACACIA => Blocks::ACACIA_PLANKS(), - StringValues::WOOD_TYPE_DARK_OAK => Blocks::DARK_OAK_PLANKS(), - default => throw $in->badValueException(StateNames::WOOD_TYPE, $woodName), - }; - }); $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)){ @@ -608,6 +602,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->mapSimple(Ids::AIR, fn() => Blocks::AIR()); $this->mapSimple(Ids::AMETHYST_BLOCK, fn() => Blocks::AMETHYST()); $this->mapSimple(Ids::ANCIENT_DEBRIS, fn() => Blocks::ANCIENT_DEBRIS()); + $this->mapSimple(Ids::ANDESITE, fn() => Blocks::ANDESITE()); $this->mapSimple(Ids::BARRIER, fn() => Blocks::BARRIER()); $this->mapSimple(Ids::BEACON, fn() => Blocks::BEACON()); $this->mapSimple(Ids::BLACKSTONE, fn() => Blocks::BLACKSTONE()); @@ -648,6 +643,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->mapSimple(Ids::DEEPSLATE_TILES, fn() => Blocks::DEEPSLATE_TILES()); $this->mapSimple(Ids::DIAMOND_BLOCK, fn() => Blocks::DIAMOND()); $this->mapSimple(Ids::DIAMOND_ORE, fn() => Blocks::DIAMOND_ORE()); + $this->mapSimple(Ids::DIORITE, fn() => Blocks::DIORITE()); $this->mapSimple(Ids::DRAGON_EGG, fn() => Blocks::DRAGON_EGG()); $this->mapSimple(Ids::DRIED_KELP_BLOCK, fn() => Blocks::DRIED_KELP()); $this->mapSimple(Ids::ELEMENT_0, fn() => Blocks::ELEMENT_ZERO()); @@ -782,6 +778,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->mapSimple(Ids::GLOWSTONE, fn() => Blocks::GLOWSTONE()); $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_PATH, fn() => Blocks::GRASS_PATH()); $this->mapSimple(Ids::GRAVEL, fn() => Blocks::GRAVEL()); @@ -820,9 +817,12 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->mapSimple(Ids::PACKED_ICE, fn() => Blocks::PACKED_ICE()); $this->mapSimple(Ids::PACKED_MUD, fn() => Blocks::PACKED_MUD()); $this->mapSimple(Ids::PODZOL, fn() => Blocks::PODZOL()); + $this->mapSimple(Ids::POLISHED_ANDESITE, fn() => Blocks::POLISHED_ANDESITE()); $this->mapSimple(Ids::POLISHED_BLACKSTONE, fn() => Blocks::POLISHED_BLACKSTONE()); $this->mapSimple(Ids::POLISHED_BLACKSTONE_BRICKS, fn() => Blocks::POLISHED_BLACKSTONE_BRICKS()); $this->mapSimple(Ids::POLISHED_DEEPSLATE, fn() => Blocks::POLISHED_DEEPSLATE()); + $this->mapSimple(Ids::POLISHED_DIORITE, fn() => Blocks::POLISHED_DIORITE()); + $this->mapSimple(Ids::POLISHED_GRANITE, fn() => Blocks::POLISHED_GRANITE()); $this->mapSimple(Ids::QUARTZ_BRICKS, fn() => Blocks::QUARTZ_BRICKS()); $this->mapSimple(Ids::QUARTZ_ORE, fn() => Blocks::NETHER_QUARTZ_ORE()); $this->mapSimple(Ids::RAW_COPPER_BLOCK, fn() => Blocks::RAW_COPPER()); @@ -844,6 +844,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ $this->mapSimple(Ids::SOUL_SAND, fn() => Blocks::SOUL_SAND()); $this->mapSimple(Ids::SOUL_SOIL, fn() => Blocks::SOUL_SOIL()); $this->mapSimple(Ids::SPORE_BLOSSOM, fn() => Blocks::SPORE_BLOSSOM()); + $this->mapSimple(Ids::STONE, fn() => Blocks::STONE()); $this->mapSimple(Ids::STONECUTTER, fn() => Blocks::LEGACY_STONECUTTER()); $this->mapSimple(Ids::TINTED_GLASS, fn() => Blocks::TINTED_GLASS()); $this->mapSimple(Ids::TORCHFLOWER, fn() => Blocks::TORCHFLOWER()); @@ -1528,18 +1529,6 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{ return Blocks::BANNER() ->setRotation($in->readBoundedInt(StateNames::GROUND_SIGN_DIRECTION, 0, 15)); }); - $this->map(Ids::STONE, function(Reader $in) : Block{ - return match($type = $in->readString(StateNames::STONE_TYPE)){ - StringValues::STONE_TYPE_ANDESITE => Blocks::ANDESITE(), - StringValues::STONE_TYPE_ANDESITE_SMOOTH => Blocks::POLISHED_ANDESITE(), - StringValues::STONE_TYPE_DIORITE => Blocks::DIORITE(), - StringValues::STONE_TYPE_DIORITE_SMOOTH => Blocks::POLISHED_DIORITE(), - StringValues::STONE_TYPE_GRANITE => Blocks::GRANITE(), - StringValues::STONE_TYPE_GRANITE_SMOOTH => Blocks::POLISHED_GRANITE(), - StringValues::STONE_TYPE_STONE => Blocks::STONE(), - default => throw $in->badValueException(StateNames::STONE_TYPE, $type), - }; - }); $this->mapStairs(Ids::STONE_BRICK_STAIRS, fn() => Blocks::STONE_BRICK_STAIRS()); $this->map(Ids::STONE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::STONE_BUTTON(), $in)); $this->map(Ids::STONE_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::STONE_PRESSURE_PLATE(), $in)); diff --git a/src/data/bedrock/item/ItemTypeNames.php b/src/data/bedrock/item/ItemTypeNames.php index 85f01106a..c1534a0f0 100644 --- a/src/data/bedrock/item/ItemTypeNames.php +++ b/src/data/bedrock/item/ItemTypeNames.php @@ -134,6 +134,7 @@ final class ItemTypeNames{ public const COOKED_RABBIT = "minecraft:cooked_rabbit"; public const COOKED_SALMON = "minecraft:cooked_salmon"; public const COOKIE = "minecraft:cookie"; + public const COPPER_DOOR = "minecraft:copper_door"; public const COPPER_INGOT = "minecraft:copper_ingot"; public const CORAL = "minecraft:coral"; public const COW_SPAWN_EGG = "minecraft:cow_spawn_egg"; @@ -150,6 +151,7 @@ final class ItemTypeNames{ public const DARK_OAK_DOOR = "minecraft:dark_oak_door"; public const DARK_OAK_HANGING_SIGN = "minecraft:dark_oak_hanging_sign"; public const DARK_OAK_SIGN = "minecraft:dark_oak_sign"; + public const DEBUG_STICK = "minecraft:debug_stick"; public const DIAMOND = "minecraft:diamond"; public const DIAMOND_AXE = "minecraft:diamond_axe"; public const DIAMOND_BOOTS = "minecraft:diamond_boots"; @@ -186,6 +188,7 @@ final class ItemTypeNames{ public const EVOKER_SPAWN_EGG = "minecraft:evoker_spawn_egg"; public const EXPERIENCE_BOTTLE = "minecraft:experience_bottle"; public const EXPLORER_POTTERY_SHERD = "minecraft:explorer_pottery_sherd"; + public const EXPOSED_COPPER_DOOR = "minecraft:exposed_copper_door"; public const EYE_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:eye_armor_trim_smithing_template"; public const FEATHER = "minecraft:feather"; public const FENCE = "minecraft:fence"; @@ -347,6 +350,7 @@ final class ItemTypeNames{ public const OAK_SIGN = "minecraft:oak_sign"; public const OCELOT_SPAWN_EGG = "minecraft:ocelot_spawn_egg"; public const ORANGE_DYE = "minecraft:orange_dye"; + public const OXIDIZED_COPPER_DOOR = "minecraft:oxidized_copper_door"; public const PAINTING = "minecraft:painting"; public const PANDA_SPAWN_EGG = "minecraft:panda_spawn_egg"; public const PAPER = "minecraft:paper"; @@ -360,6 +364,7 @@ final class ItemTypeNames{ public const PILLAGER_SPAWN_EGG = "minecraft:pillager_spawn_egg"; public const PINK_DYE = "minecraft:pink_dye"; public const PITCHER_POD = "minecraft:pitcher_pod"; + public const PLANKS = "minecraft:planks"; public const PLENTY_POTTERY_SHERD = "minecraft:plenty_pottery_sherd"; public const POISONOUS_POTATO = "minecraft:poisonous_potato"; public const POLAR_BEAR_SPAWN_EGG = "minecraft:polar_bear_spawn_egg"; @@ -479,7 +484,12 @@ final class ItemTypeNames{ public const WARPED_HANGING_SIGN = "minecraft:warped_hanging_sign"; public const WARPED_SIGN = "minecraft:warped_sign"; public const WATER_BUCKET = "minecraft:water_bucket"; + public const WAXED_COPPER_DOOR = "minecraft:waxed_copper_door"; + public const WAXED_EXPOSED_COPPER_DOOR = "minecraft:waxed_exposed_copper_door"; + public const WAXED_OXIDIZED_COPPER_DOOR = "minecraft:waxed_oxidized_copper_door"; + public const WAXED_WEATHERED_COPPER_DOOR = "minecraft:waxed_weathered_copper_door"; public const WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:wayfinder_armor_trim_smithing_template"; + public const WEATHERED_COPPER_DOOR = "minecraft:weathered_copper_door"; public const WHEAT = "minecraft:wheat"; public const WHEAT_SEEDS = "minecraft:wheat_seeds"; public const WHITE_DYE = "minecraft:white_dye"; diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 32e788c6a..8c3449d41 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -57,7 +57,6 @@ use pocketmine\network\mcpe\protocol\BossEventPacket; use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket; use pocketmine\network\mcpe\protocol\CommandRequestPacket; use pocketmine\network\mcpe\protocol\ContainerClosePacket; -use pocketmine\network\mcpe\protocol\CraftingEventPacket; use pocketmine\network\mcpe\protocol\EmotePacket; use pocketmine\network\mcpe\protocol\InteractPacket; use pocketmine\network\mcpe\protocol\InventoryTransactionPacket; @@ -731,10 +730,6 @@ class InGamePacketHandler extends PacketHandler{ return true; //this packet is useless } - public function handleCraftingEvent(CraftingEventPacket $packet) : bool{ - return true; //this is a broken useless packet, so we don't use it - } - public function handleBlockActorData(BlockActorDataPacket $packet) : bool{ $pos = new Vector3($packet->blockPosition->getX(), $packet->blockPosition->getY(), $packet->blockPosition->getZ()); if($pos->distanceSquared($this->player->getLocation()) > 10000){ diff --git a/src/scheduler/AsyncTask.php b/src/scheduler/AsyncTask.php index ba5cc424c..b4c3ce20d 100644 --- a/src/scheduler/AsyncTask.php +++ b/src/scheduler/AsyncTask.php @@ -28,6 +28,7 @@ use pmmp\thread\Thread as NativeThread; use pmmp\thread\ThreadSafe; use pmmp\thread\ThreadSafeArray; use pocketmine\thread\NonThreadSafeValue; +use function array_key_exists; use function assert; use function igbinary_serialize; use function igbinary_unserialize; @@ -230,7 +231,7 @@ abstract class AsyncTask extends Runnable{ */ protected function fetchLocal(string $key){ $id = spl_object_id($this); - if(!isset(self::$threadLocalStorage[$id][$key])){ + if(!isset(self::$threadLocalStorage[$id]) || !array_key_exists($key, self::$threadLocalStorage[$id])){ throw new \InvalidArgumentException("No matching thread-local data found on this thread"); } diff --git a/src/world/World.php b/src/world/World.php index 47c569d72..fbfa05b71 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1016,8 +1016,12 @@ class World implements ChunkManager{ continue; } World::getXZ($index, $chunkX, $chunkZ); + if(!$this->isChunkLoaded($chunkX, $chunkZ)){ + //a previous chunk may have caused this one to be unloaded by a ChunkListener + continue; + } if(count($blocks) > 512){ - $chunk = $this->getChunk($chunkX, $chunkZ); + $chunk = $this->getChunk($chunkX, $chunkZ) ?? throw new AssumptionFailedError("We already checked that the chunk is loaded"); foreach($this->getChunkPlayers($chunkX, $chunkZ) as $p){ $p->onChunkChanged($chunkX, $chunkZ, $chunk); } diff --git a/src/world/format/io/data/BedrockWorldData.php b/src/world/format/io/data/BedrockWorldData.php index d92576f21..cb5468a52 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 = 622; + public const CURRENT_STORAGE_NETWORK_VERSION = 630; public const CURRENT_CLIENT_VERSION_TARGET = [ 1, //major 20, //minor - 40, //patch - 1, //revision + 50, //patch + 3, //revision 0 //is beta ]; diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index 1e5d83dda..51454a708 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -32,7 +32,7 @@ parameters: - message: "#^Cannot access offset 'git' on mixed\\.$#" - count: 2 + count: 1 path: ../../../src/VersionInfo.php - @@ -807,7 +807,7 @@ parameters: - message: "#^Cannot access offset string on mixed\\.$#" - count: 3 + count: 2 path: ../../../src/utils/Config.php - @@ -965,11 +965,6 @@ parameters: count: 2 path: ../../../src/world/World.php - - - message: "#^Parameter \\#3 \\$chunk of method pocketmine\\\\player\\\\Player\\:\\:onChunkChanged\\(\\) expects pocketmine\\\\world\\\\format\\\\Chunk, pocketmine\\\\world\\\\format\\\\Chunk\\|null given\\.$#" - count: 1 - path: ../../../src/world/World.php - - message: "#^Parameter \\#3 \\$y of method pocketmine\\\\block\\\\Block\\:\\:position\\(\\) expects int, float\\|int given\\.$#" count: 2 diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index 7b6b7b426..b3bf3dadd 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -20,21 +20,6 @@ parameters: count: 1 path: ../../../src/entity/projectile/Projectile.php - - - message: "#^Match arm comparison between 1\\|2\\|3\\|4 and 0 is always false\\.$#" - count: 1 - path: ../../../src/network/mcpe/handler/InGamePacketHandler.php - - - - message: "#^Match arm comparison between 4 and 4 is always true\\.$#" - count: 1 - path: ../../../src/network/mcpe/handler/InGamePacketHandler.php - - - - message: "#^Match arm is unreachable because previous comparison is always true\\.$#" - count: 1 - path: ../../../src/network/mcpe/handler/InGamePacketHandler.php - - message: "#^Property pocketmine\\\\network\\\\mcpe\\\\raklib\\\\PthreadsChannelWriter\\:\\:\\$buffer is never read, only written\\.$#" count: 1 diff --git a/tests/phpunit/scheduler/AsyncPoolTest.php b/tests/phpunit/scheduler/AsyncPoolTest.php index a8a15146e..54c8ccafd 100644 --- a/tests/phpunit/scheduler/AsyncPoolTest.php +++ b/tests/phpunit/scheduler/AsyncPoolTest.php @@ -121,4 +121,23 @@ class AsyncPoolTest extends TestCase{ usleep(50 * 1000); } } + + public function testNullComplexDataFetch() : void{ + $this->pool->submitTask(new class extends AsyncTask{ + public function __construct(){ + $this->storeLocal("null", null); + } + + public function onRun() : void{ + //dummy + } + + public function onCompletion() : void{ + AsyncPoolTest::assertNull($this->fetchLocal("null")); + } + }); + while($this->pool->collectTasks()){ + usleep(50 * 1000); + } + } }