mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Merge branch 'stable' into minor-next
This commit is contained in:
commit
833f9401f9
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -176,7 +176,7 @@ jobs:
|
||||
uses: shivammathur/setup-php@2.25.2
|
||||
with:
|
||||
php-version: 8.1
|
||||
tools: php-cs-fixer:3.16
|
||||
tools: php-cs-fixer:3.17
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
@ -44,6 +44,7 @@ use function fwrite;
|
||||
use function is_string;
|
||||
use function ksort;
|
||||
use function mb_strtoupper;
|
||||
use function preg_replace;
|
||||
use function sort;
|
||||
use function strrpos;
|
||||
use function strtoupper;
|
||||
@ -138,7 +139,7 @@ function generateBlockStateNames(BlockPaletteReport $data) : void{
|
||||
|
||||
fwrite($output, generateClassHeader(BlockStateNames::class));
|
||||
foreach(Utils::stringifyKeys($data->seenStateValues) as $state => $values){
|
||||
$constName = mb_strtoupper($state, 'US-ASCII');
|
||||
$constName = mb_strtoupper(preg_replace("/^minecraft:/", "", $state) ?? throw new AssumptionFailedError("This regex is not invalid"), 'US-ASCII');
|
||||
fwrite($output, "\tpublic const $constName = \"$state\";\n");
|
||||
}
|
||||
|
||||
@ -158,7 +159,7 @@ function generateBlockStringValues(BlockPaletteReport $data) : void{
|
||||
continue;
|
||||
}
|
||||
$anyWritten = true;
|
||||
$constName = mb_strtoupper($stateName . "_" . $value, 'US-ASCII');
|
||||
$constName = mb_strtoupper(preg_replace("/^minecraft:/", "", $stateName) . "_" . $value, 'US-ASCII');
|
||||
fwrite($output, "\tpublic const $constName = \"$value\";\n");
|
||||
}
|
||||
if($anyWritten){
|
||||
|
24
changelogs/4.22.md
Normal file
24
changelogs/4.22.md
Normal file
@ -0,0 +1,24 @@
|
||||
# 4.22.0
|
||||
Released 7th June 2023.
|
||||
|
||||
**For Minecraft: Bedrock Edition 1.20.0**
|
||||
|
||||
This is a support release for Minecraft: Bedrock Edition 1.20.0.
|
||||
|
||||
**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.
|
||||
|
||||
## Interim releases
|
||||
If you're upgrading from 4.20.x directly to 4.22.x, please also read the following changelogs, as the interim releases contain important changes:
|
||||
- [4.21.0](https://github.com/pmmp/PocketMine-MP/blob/4.22.0/changelogs/4.21.md#4210) - PHP 8.1 minimum version, minor performance improvements
|
||||
|
||||
## General
|
||||
- Added support for Minecraft: Bedrock Edition 1.20.0.
|
||||
- Removed support for older versions.
|
||||
|
||||
## Fixes
|
||||
- Removed deprecated `ReflectionProperty::setAccessible()` calls.
|
||||
- Fixed jukebox music not stopping when destroyed by an explosion.
|
22
changelogs/5.1.md
Normal file
22
changelogs/5.1.md
Normal file
@ -0,0 +1,22 @@
|
||||
# 5.1.0
|
||||
Released 7th June 2023.
|
||||
|
||||
**For Minecraft: Bedrock Edition 1.20.0**
|
||||
|
||||
This is a support release for Minecraft: Bedrock Edition 1.20.0.
|
||||
|
||||
**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` 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.0.
|
||||
- Removed support for older versions.
|
||||
|
||||
# 5.1.1
|
||||
Released 7th June 2023.
|
||||
|
||||
## Fixes
|
||||
- Fixed blockstates being saved with the wrong version ID for 1.20.0.
|
@ -34,10 +34,10 @@
|
||||
"adhocore/json-comment": "^1.1",
|
||||
"fgrosse/phpasn1": "^2.3",
|
||||
"pocketmine/netresearch-jsonmapper": "~v4.2.999",
|
||||
"pocketmine/bedrock-block-upgrade-schema": "~2.1.0+bedrock-1.19.80",
|
||||
"pocketmine/bedrock-data": "~2.2.0+bedrock-1.19.80",
|
||||
"pocketmine/bedrock-item-upgrade-schema": "~1.2.0+bedrock-1.19.80",
|
||||
"pocketmine/bedrock-protocol": "~21.0.0+bedrock-1.19.80",
|
||||
"pocketmine/bedrock-block-upgrade-schema": "~2.2.0+bedrock-1.20.0",
|
||||
"pocketmine/bedrock-data": "~2.3.0+bedrock-1.20.0",
|
||||
"pocketmine/bedrock-item-upgrade-schema": "~1.3.0+bedrock-1.20.0",
|
||||
"pocketmine/bedrock-protocol": "~22.0.0+bedrock-1.20.0",
|
||||
"pocketmine/binaryutils": "^0.2.1",
|
||||
"pocketmine/callback-validator": "^1.0.2",
|
||||
"pocketmine/color": "^0.3.0",
|
||||
@ -53,7 +53,7 @@
|
||||
"symfony/filesystem": "^6.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "1.10.15",
|
||||
"phpstan/phpstan": "1.10.16",
|
||||
"phpstan/phpstan-phpunit": "^1.1.0",
|
||||
"phpstan/phpstan-strict-rules": "^1.2.0",
|
||||
"phpunit/phpunit": "^10.1"
|
||||
|
72
composer.lock
generated
72
composer.lock
generated
@ -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": "f48120203fe576d1ef1b7eddd8460d8f",
|
||||
"content-hash": "5483e35c09044ab9d989cec8fdf4a399",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/json-comment",
|
||||
@ -198,16 +198,16 @@
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/bedrock-block-upgrade-schema",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/BedrockBlockUpgradeSchema.git",
|
||||
"reference": "1c07ced86be7d185551082441b5a2b9b7fbd6b21"
|
||||
"reference": "79bb3ad542ef19e828fdf1fa6adc54f1fa4b3bb5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/1c07ced86be7d185551082441b5a2b9b7fbd6b21",
|
||||
"reference": "1c07ced86be7d185551082441b5a2b9b7fbd6b21",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/79bb3ad542ef19e828fdf1fa6adc54f1fa4b3bb5",
|
||||
"reference": "79bb3ad542ef19e828fdf1fa6adc54f1fa4b3bb5",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@ -218,22 +218,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/2.1.0"
|
||||
"source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/2.2.0"
|
||||
},
|
||||
"time": "2023-04-19T17:58:49+00:00"
|
||||
"time": "2023-05-04T21:49:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/bedrock-data",
|
||||
"version": "2.2.0+bedrock-1.19.80",
|
||||
"version": "2.3.0+bedrock-1.20.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/BedrockData.git",
|
||||
"reference": "33dd83601442b377af42ac91473278243cafd576"
|
||||
"reference": "b3dd3f4b8e3b6759c5d84de6ec85bb20b668c3a9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockData/zipball/33dd83601442b377af42ac91473278243cafd576",
|
||||
"reference": "33dd83601442b377af42ac91473278243cafd576",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockData/zipball/b3dd3f4b8e3b6759c5d84de6ec85bb20b668c3a9",
|
||||
"reference": "b3dd3f4b8e3b6759c5d84de6ec85bb20b668c3a9",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@ -244,22 +244,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.19.80"
|
||||
"source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.20.0"
|
||||
},
|
||||
"time": "2023-04-26T20:00:35+00:00"
|
||||
"time": "2023-06-07T19:06:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/bedrock-item-upgrade-schema",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/BedrockItemUpgradeSchema.git",
|
||||
"reference": "dd804c3f2b1e8990434812627e62eb5bde9670a5"
|
||||
"reference": "b16c59cfae08833f180dd82f88de7c1f43bc67c9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/dd804c3f2b1e8990434812627e62eb5bde9670a5",
|
||||
"reference": "dd804c3f2b1e8990434812627e62eb5bde9670a5",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/b16c59cfae08833f180dd82f88de7c1f43bc67c9",
|
||||
"reference": "b16c59cfae08833f180dd82f88de7c1f43bc67c9",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@ -270,22 +270,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.2.0"
|
||||
"source": "https://github.com/pmmp/BedrockItemUpgradeSchema/tree/1.3.0"
|
||||
},
|
||||
"time": "2023-04-19T18:16:14+00:00"
|
||||
"time": "2023-05-18T15:34:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/bedrock-protocol",
|
||||
"version": "21.0.1+bedrock-1.19.80",
|
||||
"version": "22.0.0+bedrock-1.20.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pmmp/BedrockProtocol.git",
|
||||
"reference": "981ea2e76e207a25c1361df858c639feba5cf348"
|
||||
"reference": "ceff28a0bd5d248f37fb97be3e836d536e37526e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/981ea2e76e207a25c1361df858c639feba5cf348",
|
||||
"reference": "981ea2e76e207a25c1361df858c639feba5cf348",
|
||||
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/ceff28a0bd5d248f37fb97be3e836d536e37526e",
|
||||
"reference": "ceff28a0bd5d248f37fb97be3e836d536e37526e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -317,9 +317,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/21.0.1+bedrock-1.19.80"
|
||||
"source": "https://github.com/pmmp/BedrockProtocol/tree/22.0.0+bedrock-1.20.0"
|
||||
},
|
||||
"time": "2023-04-26T21:00:01+00:00"
|
||||
"time": "2023-06-07T19:22:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pocketmine/binaryutils",
|
||||
@ -1454,16 +1454,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.15",
|
||||
"version": "1.10.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd"
|
||||
"reference": "352bdbb960bb523e3d71b834862589f910921c23"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd",
|
||||
"reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/352bdbb960bb523e3d71b834862589f910921c23",
|
||||
"reference": "352bdbb960bb523e3d71b834862589f910921c23",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1512,7 +1512,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-05-09T15:28:01+00:00"
|
||||
"time": "2023-06-05T08:21:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-phpunit",
|
||||
@ -1937,16 +1937,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "10.2.0",
|
||||
"version": "10.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "3aad97fde1f3e490e2b316ba56bc4680310e3c3f"
|
||||
"reference": "599b33294350e8f51163119d5670512f98b0490d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3aad97fde1f3e490e2b316ba56bc4680310e3c3f",
|
||||
"reference": "3aad97fde1f3e490e2b316ba56bc4680310e3c3f",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/599b33294350e8f51163119d5670512f98b0490d",
|
||||
"reference": "599b33294350e8f51163119d5670512f98b0490d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2018,7 +2018,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.0"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2034,7 +2034,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-06-02T05:42:13+00:00"
|
||||
"time": "2023-06-05T05:15:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
|
@ -41,9 +41,9 @@ final class BlockStateData{
|
||||
*/
|
||||
public const CURRENT_VERSION =
|
||||
(1 << 24) | //major
|
||||
(19 << 16) | //minor
|
||||
(80 << 8) | //patch
|
||||
(11); //revision
|
||||
(20 << 16) | //minor
|
||||
(0 << 8) | //patch
|
||||
(33); //revision
|
||||
|
||||
public const TAG_NAME = "name";
|
||||
public const TAG_STATES = "states";
|
||||
|
@ -98,6 +98,7 @@ final class BlockStateNames{
|
||||
public const LEVER_DIRECTION = "lever_direction";
|
||||
public const LIQUID_DEPTH = "liquid_depth";
|
||||
public const LIT = "lit";
|
||||
public const CARDINAL_DIRECTION = "minecraft:cardinal_direction";
|
||||
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";
|
||||
@ -122,6 +123,7 @@ final class BlockStateNames{
|
||||
public const SAND_STONE_TYPE = "sand_stone_type";
|
||||
public const SAND_TYPE = "sand_type";
|
||||
public const SAPLING_TYPE = "sapling_type";
|
||||
public const SCULK_SENSOR_PHASE = "sculk_sensor_phase";
|
||||
public const SEA_GRASS_TYPE = "sea_grass_type";
|
||||
public const SPONGE_TYPE = "sponge_type";
|
||||
public const STABILITY = "stability";
|
||||
|
@ -131,6 +131,11 @@ final class BlockStateStringValues{
|
||||
public const LEVER_DIRECTION_UP_NORTH_SOUTH = "up_north_south";
|
||||
public const LEVER_DIRECTION_WEST = "west";
|
||||
|
||||
public const CARDINAL_DIRECTION_EAST = "east";
|
||||
public const CARDINAL_DIRECTION_NORTH = "north";
|
||||
public const CARDINAL_DIRECTION_SOUTH = "south";
|
||||
public const CARDINAL_DIRECTION_WEST = "west";
|
||||
|
||||
public const MONSTER_EGG_STONE_TYPE_CHISELED_STONE_BRICK = "chiseled_stone_brick";
|
||||
public const MONSTER_EGG_STONE_TYPE_COBBLESTONE = "cobblestone";
|
||||
public const MONSTER_EGG_STONE_TYPE_CRACKED_STONE_BRICK = "cracked_stone_brick";
|
||||
|
@ -97,6 +97,7 @@ final class BlockTypeNames{
|
||||
public const BIRCH_WALL_SIGN = "minecraft:birch_wall_sign";
|
||||
public const BLACK_CANDLE = "minecraft:black_candle";
|
||||
public const BLACK_CANDLE_CAKE = "minecraft:black_candle_cake";
|
||||
public const BLACK_CARPET = "minecraft:black_carpet";
|
||||
public const BLACK_GLAZED_TERRACOTTA = "minecraft:black_glazed_terracotta";
|
||||
public const BLACK_WOOL = "minecraft:black_wool";
|
||||
public const BLACKSTONE = "minecraft:blackstone";
|
||||
@ -107,22 +108,26 @@ final class BlockTypeNames{
|
||||
public const BLAST_FURNACE = "minecraft:blast_furnace";
|
||||
public const BLUE_CANDLE = "minecraft:blue_candle";
|
||||
public const BLUE_CANDLE_CAKE = "minecraft:blue_candle_cake";
|
||||
public const BLUE_CARPET = "minecraft:blue_carpet";
|
||||
public const BLUE_GLAZED_TERRACOTTA = "minecraft:blue_glazed_terracotta";
|
||||
public const BLUE_ICE = "minecraft:blue_ice";
|
||||
public const BLUE_WOOL = "minecraft:blue_wool";
|
||||
public const BONE_BLOCK = "minecraft:bone_block";
|
||||
public const BOOKSHELF = "minecraft:bookshelf";
|
||||
public const BORDER_BLOCK = "minecraft:border_block";
|
||||
public const BRAIN_CORAL = "minecraft:brain_coral";
|
||||
public const BREWING_STAND = "minecraft:brewing_stand";
|
||||
public const BRICK_BLOCK = "minecraft:brick_block";
|
||||
public const BRICK_STAIRS = "minecraft:brick_stairs";
|
||||
public const BROWN_CANDLE = "minecraft:brown_candle";
|
||||
public const BROWN_CANDLE_CAKE = "minecraft:brown_candle_cake";
|
||||
public const BROWN_CARPET = "minecraft:brown_carpet";
|
||||
public const BROWN_GLAZED_TERRACOTTA = "minecraft:brown_glazed_terracotta";
|
||||
public const BROWN_MUSHROOM = "minecraft:brown_mushroom";
|
||||
public const BROWN_MUSHROOM_BLOCK = "minecraft:brown_mushroom_block";
|
||||
public const BROWN_WOOL = "minecraft:brown_wool";
|
||||
public const BUBBLE_COLUMN = "minecraft:bubble_column";
|
||||
public const BUBBLE_CORAL = "minecraft:bubble_coral";
|
||||
public const BUDDING_AMETHYST = "minecraft:budding_amethyst";
|
||||
public const CACTUS = "minecraft:cactus";
|
||||
public const CAKE = "minecraft:cake";
|
||||
@ -132,7 +137,6 @@ final class BlockTypeNames{
|
||||
public const CAMPFIRE = "minecraft:campfire";
|
||||
public const CANDLE = "minecraft:candle";
|
||||
public const CANDLE_CAKE = "minecraft:candle_cake";
|
||||
public const CARPET = "minecraft:carpet";
|
||||
public const CARROTS = "minecraft:carrots";
|
||||
public const CARTOGRAPHY_TABLE = "minecraft:cartography_table";
|
||||
public const CARVED_PUMPKIN = "minecraft:carved_pumpkin";
|
||||
@ -189,7 +193,6 @@ final class BlockTypeNames{
|
||||
public const CONDUIT = "minecraft:conduit";
|
||||
public const COPPER_BLOCK = "minecraft:copper_block";
|
||||
public const COPPER_ORE = "minecraft:copper_ore";
|
||||
public const CORAL = "minecraft:coral";
|
||||
public const CORAL_BLOCK = "minecraft:coral_block";
|
||||
public const CORAL_FAN = "minecraft:coral_fan";
|
||||
public const CORAL_FAN_DEAD = "minecraft:coral_fan_dead";
|
||||
@ -225,6 +228,7 @@ final class BlockTypeNames{
|
||||
public const CUT_COPPER_STAIRS = "minecraft:cut_copper_stairs";
|
||||
public const CYAN_CANDLE = "minecraft:cyan_candle";
|
||||
public const CYAN_CANDLE_CAKE = "minecraft:cyan_candle_cake";
|
||||
public const CYAN_CARPET = "minecraft:cyan_carpet";
|
||||
public const CYAN_GLAZED_TERRACOTTA = "minecraft:cyan_glazed_terracotta";
|
||||
public const CYAN_WOOL = "minecraft:cyan_wool";
|
||||
public const DARK_OAK_BUTTON = "minecraft:dark_oak_button";
|
||||
@ -241,6 +245,11 @@ final class BlockTypeNames{
|
||||
public const DARKOAK_WALL_SIGN = "minecraft:darkoak_wall_sign";
|
||||
public const DAYLIGHT_DETECTOR = "minecraft:daylight_detector";
|
||||
public const DAYLIGHT_DETECTOR_INVERTED = "minecraft:daylight_detector_inverted";
|
||||
public const DEAD_BRAIN_CORAL = "minecraft:dead_brain_coral";
|
||||
public const DEAD_BUBBLE_CORAL = "minecraft:dead_bubble_coral";
|
||||
public const DEAD_FIRE_CORAL = "minecraft:dead_fire_coral";
|
||||
public const DEAD_HORN_CORAL = "minecraft:dead_horn_coral";
|
||||
public const DEAD_TUBE_CORAL = "minecraft:dead_tube_coral";
|
||||
public const DEADBUSH = "minecraft:deadbush";
|
||||
public const DECORATED_POT = "minecraft:decorated_pot";
|
||||
public const DEEPSLATE = "minecraft:deepslate";
|
||||
@ -419,6 +428,7 @@ final class BlockTypeNames{
|
||||
public const FARMLAND = "minecraft:farmland";
|
||||
public const FENCE_GATE = "minecraft:fence_gate";
|
||||
public const FIRE = "minecraft:fire";
|
||||
public const FIRE_CORAL = "minecraft:fire_coral";
|
||||
public const FLETCHING_TABLE = "minecraft:fletching_table";
|
||||
public const FLOWER_POT = "minecraft:flower_pot";
|
||||
public const FLOWERING_AZALEA = "minecraft:flowering_azalea";
|
||||
@ -444,10 +454,12 @@ final class BlockTypeNames{
|
||||
public const GRAVEL = "minecraft:gravel";
|
||||
public const GRAY_CANDLE = "minecraft:gray_candle";
|
||||
public const GRAY_CANDLE_CAKE = "minecraft:gray_candle_cake";
|
||||
public const GRAY_CARPET = "minecraft:gray_carpet";
|
||||
public const GRAY_GLAZED_TERRACOTTA = "minecraft:gray_glazed_terracotta";
|
||||
public const GRAY_WOOL = "minecraft:gray_wool";
|
||||
public const GREEN_CANDLE = "minecraft:green_candle";
|
||||
public const GREEN_CANDLE_CAKE = "minecraft:green_candle_cake";
|
||||
public const GREEN_CARPET = "minecraft:green_carpet";
|
||||
public const GREEN_GLAZED_TERRACOTTA = "minecraft:green_glazed_terracotta";
|
||||
public const GREEN_WOOL = "minecraft:green_wool";
|
||||
public const GRINDSTONE = "minecraft:grindstone";
|
||||
@ -462,6 +474,7 @@ final class BlockTypeNames{
|
||||
public const HONEY_BLOCK = "minecraft:honey_block";
|
||||
public const HONEYCOMB_BLOCK = "minecraft:honeycomb_block";
|
||||
public const HOPPER = "minecraft:hopper";
|
||||
public const HORN_CORAL = "minecraft:horn_coral";
|
||||
public const ICE = "minecraft:ice";
|
||||
public const INFESTED_DEEPSLATE = "minecraft:infested_deepslate";
|
||||
public const INFO_UPDATE = "minecraft:info_update";
|
||||
@ -492,7 +505,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 LAVA_CAULDRON = "minecraft:lava_cauldron";
|
||||
public const LEAVES = "minecraft:leaves";
|
||||
public const LEAVES2 = "minecraft:leaves2";
|
||||
public const LECTERN = "minecraft:lectern";
|
||||
@ -500,15 +512,18 @@ final class BlockTypeNames{
|
||||
public const LIGHT_BLOCK = "minecraft:light_block";
|
||||
public const LIGHT_BLUE_CANDLE = "minecraft:light_blue_candle";
|
||||
public const LIGHT_BLUE_CANDLE_CAKE = "minecraft:light_blue_candle_cake";
|
||||
public const LIGHT_BLUE_CARPET = "minecraft:light_blue_carpet";
|
||||
public const LIGHT_BLUE_GLAZED_TERRACOTTA = "minecraft:light_blue_glazed_terracotta";
|
||||
public const LIGHT_BLUE_WOOL = "minecraft:light_blue_wool";
|
||||
public const LIGHT_GRAY_CANDLE = "minecraft:light_gray_candle";
|
||||
public const LIGHT_GRAY_CANDLE_CAKE = "minecraft:light_gray_candle_cake";
|
||||
public const LIGHT_GRAY_CARPET = "minecraft:light_gray_carpet";
|
||||
public const LIGHT_GRAY_WOOL = "minecraft:light_gray_wool";
|
||||
public const LIGHT_WEIGHTED_PRESSURE_PLATE = "minecraft:light_weighted_pressure_plate";
|
||||
public const LIGHTNING_ROD = "minecraft:lightning_rod";
|
||||
public const LIME_CANDLE = "minecraft:lime_candle";
|
||||
public const LIME_CANDLE_CAKE = "minecraft:lime_candle_cake";
|
||||
public const LIME_CARPET = "minecraft:lime_carpet";
|
||||
public const LIME_GLAZED_TERRACOTTA = "minecraft:lime_glazed_terracotta";
|
||||
public const LIME_WOOL = "minecraft:lime_wool";
|
||||
public const LIT_BLAST_FURNACE = "minecraft:lit_blast_furnace";
|
||||
@ -522,6 +537,7 @@ final class BlockTypeNames{
|
||||
public const LOOM = "minecraft:loom";
|
||||
public const MAGENTA_CANDLE = "minecraft:magenta_candle";
|
||||
public const MAGENTA_CANDLE_CAKE = "minecraft:magenta_candle_cake";
|
||||
public const MAGENTA_CARPET = "minecraft:magenta_carpet";
|
||||
public const MAGENTA_GLAZED_TERRACOTTA = "minecraft:magenta_glazed_terracotta";
|
||||
public const MAGENTA_WOOL = "minecraft:magenta_wool";
|
||||
public const MAGMA = "minecraft:magma";
|
||||
@ -583,6 +599,7 @@ final class BlockTypeNames{
|
||||
public const OCHRE_FROGLIGHT = "minecraft:ochre_froglight";
|
||||
public const ORANGE_CANDLE = "minecraft:orange_candle";
|
||||
public const ORANGE_CANDLE_CAKE = "minecraft:orange_candle_cake";
|
||||
public const ORANGE_CARPET = "minecraft:orange_carpet";
|
||||
public const ORANGE_GLAZED_TERRACOTTA = "minecraft:orange_glazed_terracotta";
|
||||
public const ORANGE_WOOL = "minecraft:orange_wool";
|
||||
public const OXIDIZED_COPPER = "minecraft:oxidized_copper";
|
||||
@ -595,11 +612,14 @@ final class BlockTypeNames{
|
||||
public const PEARLESCENT_FROGLIGHT = "minecraft:pearlescent_froglight";
|
||||
public const PINK_CANDLE = "minecraft:pink_candle";
|
||||
public const PINK_CANDLE_CAKE = "minecraft:pink_candle_cake";
|
||||
public const PINK_CARPET = "minecraft:pink_carpet";
|
||||
public const PINK_GLAZED_TERRACOTTA = "minecraft:pink_glazed_terracotta";
|
||||
public const PINK_PETALS = "minecraft:pink_petals";
|
||||
public const PINK_WOOL = "minecraft:pink_wool";
|
||||
public const PISTON = "minecraft:piston";
|
||||
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";
|
||||
@ -636,6 +656,7 @@ final class BlockTypeNames{
|
||||
public const PUMPKIN_STEM = "minecraft:pumpkin_stem";
|
||||
public const PURPLE_CANDLE = "minecraft:purple_candle";
|
||||
public const PURPLE_CANDLE_CAKE = "minecraft:purple_candle_cake";
|
||||
public const PURPLE_CARPET = "minecraft:purple_carpet";
|
||||
public const PURPLE_GLAZED_TERRACOTTA = "minecraft:purple_glazed_terracotta";
|
||||
public const PURPLE_WOOL = "minecraft:purple_wool";
|
||||
public const PURPUR_BLOCK = "minecraft:purpur_block";
|
||||
@ -650,6 +671,7 @@ final class BlockTypeNames{
|
||||
public const RAW_IRON_BLOCK = "minecraft:raw_iron_block";
|
||||
public const RED_CANDLE = "minecraft:red_candle";
|
||||
public const RED_CANDLE_CAKE = "minecraft:red_candle_cake";
|
||||
public const RED_CARPET = "minecraft:red_carpet";
|
||||
public const RED_FLOWER = "minecraft:red_flower";
|
||||
public const RED_GLAZED_TERRACOTTA = "minecraft:red_glazed_terracotta";
|
||||
public const RED_MUSHROOM = "minecraft:red_mushroom";
|
||||
@ -696,6 +718,7 @@ final class BlockTypeNames{
|
||||
public const SMOOTH_RED_SANDSTONE_STAIRS = "minecraft:smooth_red_sandstone_stairs";
|
||||
public const SMOOTH_SANDSTONE_STAIRS = "minecraft:smooth_sandstone_stairs";
|
||||
public const SMOOTH_STONE = "minecraft:smooth_stone";
|
||||
public const SNIFFER_EGG = "minecraft:sniffer_egg";
|
||||
public const SNOW = "minecraft:snow";
|
||||
public const SNOW_LAYER = "minecraft:snow_layer";
|
||||
public const SOUL_CAMPFIRE = "minecraft:soul_campfire";
|
||||
@ -767,6 +790,7 @@ final class BlockTypeNames{
|
||||
public const TRAPPED_CHEST = "minecraft:trapped_chest";
|
||||
public const TRIP_WIRE = "minecraft:trip_wire";
|
||||
public const TRIPWIRE_HOOK = "minecraft:tripwire_hook";
|
||||
public const TUBE_CORAL = "minecraft:tube_coral";
|
||||
public const TUFF = "minecraft:tuff";
|
||||
public const TURTLE_EGG = "minecraft:turtle_egg";
|
||||
public const TWISTING_VINES = "minecraft:twisting_vines";
|
||||
@ -831,6 +855,7 @@ final class BlockTypeNames{
|
||||
public const WHEAT = "minecraft:wheat";
|
||||
public const WHITE_CANDLE = "minecraft:white_candle";
|
||||
public const WHITE_CANDLE_CAKE = "minecraft:white_candle_cake";
|
||||
public const WHITE_CARPET = "minecraft:white_carpet";
|
||||
public const WHITE_GLAZED_TERRACOTTA = "minecraft:white_glazed_terracotta";
|
||||
public const WHITE_WOOL = "minecraft:white_wool";
|
||||
public const WITHER_ROSE = "minecraft:wither_rose";
|
||||
@ -841,6 +866,7 @@ final class BlockTypeNames{
|
||||
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";
|
||||
public const YELLOW_FLOWER = "minecraft:yellow_flower";
|
||||
public const YELLOW_GLAZED_TERRACOTTA = "minecraft:yellow_glazed_terracotta";
|
||||
public const YELLOW_WOOL = "minecraft:yellow_wool";
|
||||
|
@ -191,6 +191,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
public function __construct(){
|
||||
$this->registerCandleSerializers();
|
||||
$this->registerFlatColorBlockSerializers();
|
||||
$this->registerFlatCoralSerializers();
|
||||
$this->registerCauldronSerializers();
|
||||
$this->registerWoodBlockSerializers();
|
||||
$this->registerSimpleSerializers();
|
||||
@ -347,14 +348,47 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
DyeColor::YELLOW() => Ids::YELLOW_WOOL,
|
||||
default => throw new AssumptionFailedError("Unhandled dye colour " . $color->name())
|
||||
}));
|
||||
|
||||
$this->map(Blocks::CARPET(), fn(Carpet $block) => Writer::create(match($color = $block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_CARPET,
|
||||
DyeColor::BLUE() => Ids::BLUE_CARPET,
|
||||
DyeColor::BROWN() => Ids::BROWN_CARPET,
|
||||
DyeColor::CYAN() => Ids::CYAN_CARPET,
|
||||
DyeColor::GRAY() => Ids::GRAY_CARPET,
|
||||
DyeColor::GREEN() => Ids::GREEN_CARPET,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_CARPET,
|
||||
DyeColor::LIGHT_GRAY() => Ids::LIGHT_GRAY_CARPET,
|
||||
DyeColor::LIME() => Ids::LIME_CARPET,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_CARPET,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_CARPET,
|
||||
DyeColor::PINK() => Ids::PINK_CARPET,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_CARPET,
|
||||
DyeColor::RED() => Ids::RED_CARPET,
|
||||
DyeColor::WHITE() => Ids::WHITE_CARPET,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_CARPET,
|
||||
default => throw new AssumptionFailedError("Unhandled dye colour " . $color->name())
|
||||
}));
|
||||
}
|
||||
|
||||
private function registerFlatCoralSerializers() : void{
|
||||
$this->map(Blocks::CORAL(), fn(Coral $block) => Writer::create(
|
||||
match($coralType = $block->getCoralType()){
|
||||
CoralType::BRAIN() => $block->isDead() ? Ids::DEAD_BRAIN_CORAL : Ids::BRAIN_CORAL,
|
||||
CoralType::BUBBLE() => $block->isDead() ? Ids::DEAD_BUBBLE_CORAL : Ids::BUBBLE_CORAL,
|
||||
CoralType::FIRE() => $block->isDead() ? Ids::DEAD_FIRE_CORAL : Ids::FIRE_CORAL,
|
||||
CoralType::HORN() => $block->isDead() ? Ids::DEAD_HORN_CORAL : Ids::HORN_CORAL,
|
||||
CoralType::TUBE() => $block->isDead() ? Ids::DEAD_TUBE_CORAL : Ids::TUBE_CORAL,
|
||||
default => throw new AssumptionFailedError("Unhandled coral type " . $coralType->name())
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private function registerCauldronSerializers() : void{
|
||||
$this->map(Blocks::CAULDRON(), fn() => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, 0, new Writer(Ids::CAULDRON)));
|
||||
$this->map(Blocks::LAVA_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_LAVA, $b->getFillLevel(), new Writer(Ids::LAVA_CAULDRON)));
|
||||
$this->map(Blocks::CAULDRON(), fn() => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, 0));
|
||||
$this->map(Blocks::LAVA_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_LAVA, $b->getFillLevel()));
|
||||
//potion cauldrons store their real information in the block actor data
|
||||
$this->map(Blocks::POTION_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, $b->getFillLevel(), new Writer(Ids::CAULDRON)));
|
||||
$this->map(Blocks::WATER_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, $b->getFillLevel(), new Writer(Ids::CAULDRON)));
|
||||
$this->map(Blocks::POTION_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, $b->getFillLevel()));
|
||||
$this->map(Blocks::WATER_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, $b->getFillLevel()));
|
||||
}
|
||||
|
||||
private function registerWoodBlockSerializers() : void{
|
||||
@ -759,14 +793,10 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
return Writer::create(Ids::CAKE)
|
||||
->writeInt(StateNames::BITE_COUNTER, $block->getBites());
|
||||
});
|
||||
$this->map(Blocks::CARPET(), function(Carpet $block) : Writer{
|
||||
return Writer::create(Ids::CARPET)
|
||||
->writeColor($block->getColor());
|
||||
});
|
||||
$this->map(Blocks::CARROTS(), fn(Carrot $block) => Helper::encodeCrops($block, new Writer(Ids::CARROTS)));
|
||||
$this->map(Blocks::CARVED_PUMPKIN(), function(CarvedPumpkin $block) : Writer{
|
||||
return Writer::create(Ids::CARVED_PUMPKIN)
|
||||
->writeLegacyHorizontalFacing($block->getFacing());
|
||||
->writeCardinalHorizontalFacing($block->getFacing());
|
||||
});
|
||||
$this->map(Blocks::CAVE_VINES(), function(CaveVines $block) : Writer{
|
||||
//I have no idea why this only has 3 IDs - there are 4 in Java and 4 visually distinct states in Bedrock
|
||||
@ -889,11 +919,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
return Writer::create(Ids::CONCRETE_POWDER)
|
||||
->writeColor($block->getColor());
|
||||
});
|
||||
$this->map(Blocks::CORAL(), function(Coral $block) : Writer{
|
||||
return Writer::create(Ids::CORAL)
|
||||
->writeBool(StateNames::DEAD_BIT, $block->isDead())
|
||||
->writeCoralType($block->getCoralType());
|
||||
});
|
||||
$this->map(Blocks::CORAL_BLOCK(), function(CoralBlock $block) : Writer{
|
||||
return Writer::create(Ids::CORAL_BLOCK)
|
||||
->writeBool(StateNames::DEAD_BIT, $block->isDead())
|
||||
@ -1123,7 +1148,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
$this->map(Blocks::LILY_OF_THE_VALLEY(), fn() => Helper::encodeRedFlower(StringValues::FLOWER_TYPE_LILY_OF_THE_VALLEY));
|
||||
$this->map(Blocks::LIT_PUMPKIN(), function(LitPumpkin $block) : Writer{
|
||||
return Writer::create(Ids::LIT_PUMPKIN)
|
||||
->writeLegacyHorizontalFacing($block->getFacing());
|
||||
->writeCardinalHorizontalFacing($block->getFacing());
|
||||
});
|
||||
$this->map(Blocks::LOOM(), function(Loom $block) : Writer{
|
||||
return Writer::create(Ids::LOOM)
|
||||
@ -1246,7 +1271,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
$this->map(Blocks::PRISMARINE_WALL(), fn(Wall $block) => Helper::encodeLegacyWall($block, StringValues::WALL_BLOCK_TYPE_PRISMARINE));
|
||||
$this->map(Blocks::PUMPKIN(), function() : Writer{
|
||||
return Writer::create(Ids::PUMPKIN)
|
||||
->writeLegacyHorizontalFacing(Facing::SOUTH); //no longer used
|
||||
->writeCardinalHorizontalFacing(Facing::SOUTH); //no longer used
|
||||
});
|
||||
$this->map(Blocks::PUMPKIN_STEM(), fn(PumpkinStem $block) => Helper::encodeStem($block, new Writer(Ids::PUMPKIN_STEM)));
|
||||
$this->map(Blocks::PURPLE_TORCH(), fn(Torch $block) => Helper::encodeColoredTorch($block, true, Writer::create(Ids::COLORED_TORCH_BP)));
|
||||
|
@ -209,6 +209,20 @@ final class BlockStateReader{
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by pumpkins as of 1.20.0.23 beta
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public function readCardinalHorizontalFacing() : int{
|
||||
return match($raw = $this->readString(BlockStateNames::CARDINAL_DIRECTION)){
|
||||
StringValues::CARDINAL_DIRECTION_NORTH => Facing::NORTH,
|
||||
StringValues::CARDINAL_DIRECTION_SOUTH => Facing::SOUTH,
|
||||
StringValues::CARDINAL_DIRECTION_WEST => Facing::WEST,
|
||||
StringValues::CARDINAL_DIRECTION_EAST => Facing::EAST,
|
||||
default => throw $this->badValueException(BlockStateNames::CARDINAL_DIRECTION, $raw)
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readColor() : DyeColor{
|
||||
// * color (StringTag) = black, blue, brown, cyan, gray, green, light_blue, lime, magenta, orange, pink, purple, red, silver, white, yellow
|
||||
|
@ -93,8 +93,8 @@ final class BlockStateSerializerHelper{
|
||||
->writeTorchFacing($block->getFacing());
|
||||
}
|
||||
|
||||
public static function encodeCauldron(string $liquid, int $fillLevel, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
public static function encodeCauldron(string $liquid, int $fillLevel) : BlockStateWriter{
|
||||
return Writer::create(Ids::CAULDRON)
|
||||
->writeString(BlockStateNames::CAULDRON_LIQUID, $liquid)
|
||||
->writeInt(BlockStateNames::FILL_LEVEL, $fillLevel);
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
public function __construct(){
|
||||
$this->registerCandleDeserializers();
|
||||
$this->registerFlatColorBlockDeserializers();
|
||||
$this->registerFlatCoralDeserializers();
|
||||
$this->registerCauldronDeserializers();
|
||||
$this->registerWoodBlockDeserializers();
|
||||
$this->registerSimpleDeserializers();
|
||||
@ -220,6 +221,48 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
] as $id => $color){
|
||||
$this->mapSimple($id, fn() => Blocks::WOOL()->setColor($color));
|
||||
}
|
||||
|
||||
foreach([
|
||||
Ids::BLACK_CARPET => DyeColor::BLACK(),
|
||||
Ids::BLUE_CARPET => DyeColor::BLUE(),
|
||||
Ids::BROWN_CARPET => DyeColor::BROWN(),
|
||||
Ids::CYAN_CARPET => DyeColor::CYAN(),
|
||||
Ids::GRAY_CARPET => DyeColor::GRAY(),
|
||||
Ids::GREEN_CARPET => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_CARPET => DyeColor::LIGHT_BLUE(),
|
||||
Ids::LIGHT_GRAY_CARPET => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_CARPET => DyeColor::LIME(),
|
||||
Ids::MAGENTA_CARPET => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_CARPET => DyeColor::ORANGE(),
|
||||
Ids::PINK_CARPET => DyeColor::PINK(),
|
||||
Ids::PURPLE_CARPET => DyeColor::PURPLE(),
|
||||
Ids::RED_CARPET => DyeColor::RED(),
|
||||
Ids::WHITE_CARPET => DyeColor::WHITE(),
|
||||
Ids::YELLOW_CARPET => DyeColor::YELLOW(),
|
||||
] as $id => $color){
|
||||
$this->mapSimple($id, fn() => Blocks::CARPET()->setColor($color));
|
||||
}
|
||||
}
|
||||
|
||||
private function registerFlatCoralDeserializers() : void{
|
||||
foreach([
|
||||
Ids::BRAIN_CORAL => CoralType::BRAIN(),
|
||||
Ids::BUBBLE_CORAL => CoralType::BUBBLE(),
|
||||
Ids::FIRE_CORAL => CoralType::FIRE(),
|
||||
Ids::HORN_CORAL => CoralType::HORN(),
|
||||
Ids::TUBE_CORAL => CoralType::TUBE(),
|
||||
] as $id => $coralType){
|
||||
$this->mapSimple($id, fn() => Blocks::CORAL()->setCoralType($coralType)->setDead(false));
|
||||
}
|
||||
foreach([
|
||||
Ids::DEAD_BRAIN_CORAL => CoralType::BRAIN(),
|
||||
Ids::DEAD_BUBBLE_CORAL => CoralType::BUBBLE(),
|
||||
Ids::DEAD_FIRE_CORAL => CoralType::FIRE(),
|
||||
Ids::DEAD_HORN_CORAL => CoralType::HORN(),
|
||||
Ids::DEAD_TUBE_CORAL => CoralType::TUBE(),
|
||||
] as $id => $coralType){
|
||||
$this->mapSimple($id, fn() => Blocks::CORAL()->setCoralType($coralType)->setDead(true));
|
||||
}
|
||||
}
|
||||
|
||||
private function registerCauldronDeserializers() : void{
|
||||
@ -238,7 +281,6 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
})->setFillLevel($level);
|
||||
};
|
||||
$this->map(Ids::CAULDRON, $deserializer);
|
||||
$this->map(Ids::LAVA_CAULDRON, $deserializer);
|
||||
}
|
||||
|
||||
private function registerWoodBlockDeserializers() : void{
|
||||
@ -621,14 +663,10 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
return Blocks::CAKE()
|
||||
->setBites($in->readBoundedInt(StateNames::BITE_COUNTER, 0, 6));
|
||||
});
|
||||
$this->map(Ids::CARPET, function(Reader $in) : Block{
|
||||
return Blocks::CARPET()
|
||||
->setColor($in->readColor());
|
||||
});
|
||||
$this->map(Ids::CARROTS, fn(Reader $in) => Helper::decodeCrops(Blocks::CARROTS(), $in));
|
||||
$this->map(Ids::CARVED_PUMPKIN, function(Reader $in) : Block{
|
||||
return Blocks::CARVED_PUMPKIN()
|
||||
->setFacing($in->readLegacyHorizontalFacing());
|
||||
->setFacing($in->readCardinalHorizontalFacing());
|
||||
});
|
||||
$this->map(Ids::CAVE_VINES, function(Reader $in) : CaveVines{
|
||||
return Blocks::CAVE_VINES()
|
||||
@ -700,11 +738,6 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
$this->map(Ids::CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::NONE()));
|
||||
$this->mapSlab(Ids::CUT_COPPER_SLAB, Ids::DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::NONE()));
|
||||
$this->mapStairs(Ids::CUT_COPPER_STAIRS, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_STAIRS(), CopperOxidation::NONE()));
|
||||
$this->map(Ids::CORAL, function(Reader $in) : Block{
|
||||
return Blocks::CORAL()
|
||||
->setCoralType($in->readCoralType())
|
||||
->setDead($in->readBool(StateNames::DEAD_BIT));
|
||||
});
|
||||
$this->map(Ids::CORAL_BLOCK, function(Reader $in) : Block{
|
||||
return Blocks::CORAL_BLOCK()
|
||||
->setCoralType($in->readCoralType())
|
||||
@ -926,7 +959,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
});
|
||||
$this->map(Ids::LIT_PUMPKIN, function(Reader $in) : Block{
|
||||
return Blocks::LIT_PUMPKIN()
|
||||
->setFacing($in->readLegacyHorizontalFacing());
|
||||
->setFacing($in->readCardinalHorizontalFacing());
|
||||
});
|
||||
$this->map(Ids::LIT_REDSTONE_LAMP, function() : Block{
|
||||
return Blocks::REDSTONE_LAMP()
|
||||
@ -1047,7 +1080,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
$this->mapStairs(Ids::PRISMARINE_BRICKS_STAIRS, fn() => Blocks::PRISMARINE_BRICKS_STAIRS());
|
||||
$this->mapStairs(Ids::PRISMARINE_STAIRS, fn() => Blocks::PRISMARINE_STAIRS());
|
||||
$this->map(Ids::PUMPKIN, function(Reader $in) : Block{
|
||||
$in->ignored(StateNames::DIRECTION); //obsolete
|
||||
$in->ignored(StateNames::CARDINAL_DIRECTION); //obsolete
|
||||
return Blocks::PUMPKIN();
|
||||
});
|
||||
$this->map(Ids::PUMPKIN_STEM, fn(Reader $in) => Helper::decodeStem(Blocks::PUMPKIN_STEM(), $in));
|
||||
|
@ -165,6 +165,20 @@ final class BlockStateWriter{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by pumpkins as of 1.20.0.23 beta
|
||||
* @return $this
|
||||
*/
|
||||
public function writeCardinalHorizontalFacing(int $value) : self{
|
||||
return $this->writeString(BlockStateNames::CARDINAL_DIRECTION, match($value){
|
||||
Facing::SOUTH => StringValues::CARDINAL_DIRECTION_SOUTH,
|
||||
Facing::WEST => StringValues::CARDINAL_DIRECTION_WEST,
|
||||
Facing::NORTH => StringValues::CARDINAL_DIRECTION_NORTH,
|
||||
Facing::EAST => StringValues::CARDINAL_DIRECTION_EAST,
|
||||
default => throw new BlockStateSerializeException("Invalid horizontal facing $value")
|
||||
});
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeColor(DyeColor $color) : self{
|
||||
$this->writeString(BlockStateNames::COLOR, match($color->id()){
|
||||
|
@ -139,6 +139,6 @@ final class StandardEntityEventBroadcaster implements EntityEventBroadcaster{
|
||||
}
|
||||
|
||||
public function onEmote(array $recipients, Human $from, string $emoteId) : void{
|
||||
$this->sendDataPacket($recipients, EmotePacket::create($from->getId(), $emoteId, EmotePacket::FLAG_SERVER));
|
||||
$this->sendDataPacket($recipients, EmotePacket::create($from->getId(), $emoteId, "", "", EmotePacket::FLAG_SERVER));
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,10 @@ use function time;
|
||||
class ProcessLoginTask extends AsyncTask{
|
||||
private const TLS_KEY_ON_COMPLETION = "completion";
|
||||
|
||||
public const MOJANG_ROOT_PUBLIC_KEY = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8ELkixyLcwlZryUQcu1TvPOmI2B7vX83ndnWRUaXm74wFfa5f/lwQNTfrLVHa2PmenpGI6JhIMUJaWZrjmMj90NoKNFSNBuKdm8rYiXsfaz3K36x/1U26HpG0ZxK/V1V";
|
||||
public const MOJANG_OLD_ROOT_PUBLIC_KEY = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8ELkixyLcwlZryUQcu1TvPOmI2B7vX83ndnWRUaXm74wFfa5f/lwQNTfrLVHa2PmenpGI6JhIMUJaWZrjmMj90NoKNFSNBuKdm8rYiXsfaz3K36x/1U26HpG0ZxK/V1V";
|
||||
public const MOJANG_OLD_KEY_EXPIRY = 1688169600; //2023-07-01 00:00:00 UTC - there is no official date for the changeover to the new key, so this is a guess
|
||||
|
||||
public const MOJANG_ROOT_PUBLIC_KEY = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAECRXueJeTDqNRRgJi/vlRufByu/2G0i2Ebt6YMar5QX/R0DIIyrJMcUpruK4QveTfJSTp3Shlq4Gk34cD/4GUWwkv0DVuzeuB+tXija7HBxii03NHDbPAD0AKnLr2wdAp";
|
||||
|
||||
private const CLOCK_DRIFT_MAX = 60;
|
||||
|
||||
@ -159,7 +162,7 @@ class ProcessLoginTask extends AsyncTask{
|
||||
throw new VerifyLoginException($e->getMessage(), null, 0, $e);
|
||||
}
|
||||
|
||||
if($headers->x5u === self::MOJANG_ROOT_PUBLIC_KEY){
|
||||
if($headers->x5u === self::MOJANG_ROOT_PUBLIC_KEY || (time() < self::MOJANG_OLD_KEY_EXPIRY && $headers->x5u === self::MOJANG_OLD_ROOT_PUBLIC_KEY)){
|
||||
$this->authenticated = true; //we're signed into xbox live
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ use pocketmine\network\mcpe\protocol\types\CacheableNbt;
|
||||
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||
use pocketmine\network\mcpe\protocol\types\Experiments;
|
||||
use pocketmine\network\mcpe\protocol\types\LevelSettings;
|
||||
use pocketmine\network\mcpe\protocol\types\NetworkPermissions;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerMovementSettings;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerMovementType;
|
||||
use pocketmine\network\mcpe\protocol\types\SpawnSettings;
|
||||
@ -106,6 +107,7 @@ class PreSpawnPacketHandler extends PacketHandler{
|
||||
Uuid::fromString(Uuid::NIL),
|
||||
false,
|
||||
false,
|
||||
new NetworkPermissions(disableClientSounds: true),
|
||||
[],
|
||||
0,
|
||||
$typeConverter->getItemTypeDictionary()->getEntries(),
|
||||
|
@ -50,12 +50,12 @@ use function time;
|
||||
class BedrockWorldData extends BaseNbtWorldData{
|
||||
|
||||
public const CURRENT_STORAGE_VERSION = 10;
|
||||
public const CURRENT_STORAGE_NETWORK_VERSION = 582;
|
||||
public const CURRENT_STORAGE_NETWORK_VERSION = 589;
|
||||
public const CURRENT_CLIENT_VERSION_TARGET = [
|
||||
1, //major
|
||||
19, //minor
|
||||
80, //patch
|
||||
0, //revision
|
||||
20, //minor
|
||||
0, //patch
|
||||
1, //revision
|
||||
0 //is beta
|
||||
];
|
||||
|
||||
|
@ -1196,7 +1196,7 @@ parameters:
|
||||
path: ../../phpunit/event/HandlerListManagerTest.php
|
||||
|
||||
-
|
||||
message: "#^Property pocketmine\\\\event\\\\HandlerListManagerTest\\:\\:\\$resolveParentFunc \\(Closure\\(ReflectionClass\\<pocketmine\\\\event\\\\Event\\>\\)\\: ReflectionClass\\<pocketmine\\\\event\\\\Event\\>\\|null\\) does not accept Closure\\|null\\.$#"
|
||||
message: "#^Property pocketmine\\\\event\\\\HandlerListManagerTest\\:\\:\\$resolveParentFunc \\(Closure\\(ReflectionClass\\<pocketmine\\\\event\\\\Event\\>\\)\\: \\(ReflectionClass\\<pocketmine\\\\event\\\\Event\\>\\|null\\)\\) does not accept Closure\\|null\\.$#"
|
||||
count: 1
|
||||
path: ../../phpunit/event/HandlerListManagerTest.php
|
||||
|
||||
|
45
tests/phpunit/data/bedrock/block/BlockStateDataTest.php
Normal file
45
tests/phpunit/data/bedrock/block/BlockStateDataTest.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpunit\data\bedrock\block;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use pocketmine\data\bedrock\block\BlockStateData;
|
||||
use pocketmine\data\bedrock\block\upgrade\BlockStateUpgradeSchemaUtils;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use const PHP_INT_MAX;
|
||||
use const pocketmine\BEDROCK_BLOCK_UPGRADE_SCHEMA_PATH;
|
||||
|
||||
final class BlockStateDataTest extends TestCase{
|
||||
|
||||
public function testCurrentVersion() : void{
|
||||
foreach(BlockStateUpgradeSchemaUtils::loadSchemas(
|
||||
Path::join(BEDROCK_BLOCK_UPGRADE_SCHEMA_PATH, 'nbt_upgrade_schema'),
|
||||
PHP_INT_MAX
|
||||
) as $schema){
|
||||
$expected = BlockStateData::CURRENT_VERSION;
|
||||
$actual = $schema->getVersionId();
|
||||
self::assertLessThanOrEqual($expected, $actual, "Schema version $actual is newer than the current version $expected");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user