From 1da7e3586bc59d256c365f4f6d18037ca853b7c9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Oct 2023 20:45:44 +0100 Subject: [PATCH 01/18] Updated composer dependencies --- composer.json | 2 +- composer.lock | 90 +++++++++++++++++++++++++-------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/composer.json b/composer.json index 10f10e6cae7..4b485f30d38 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ "webmozart/path-util": "~2.3.0" }, "require-dev": { - "phpstan/phpstan": "1.10.35", + "phpstan/phpstan": "1.10.38", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^10.1" diff --git a/composer.lock b/composer.lock index 81f584bde7d..084f2f551fe 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": "544d6f936592b418497d61fec8058656", + "content-hash": "c8e65401c1bbfdae28c7a9069df35963", "packages": [ { "name": "adhocore/json-comment", @@ -224,16 +224,16 @@ }, { "name": "pocketmine/bedrock-data", - "version": "2.5.0+bedrock-1.20.30", + "version": "2.5.1+bedrock-1.20.30", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "e920209393a8bf6cb15fb40c3f3149aaf8e1a2b9" + "reference": "8f9d96047a731c37b18b28c2bfcdfa2705bb303f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/e920209393a8bf6cb15fb40c3f3149aaf8e1a2b9", - "reference": "e920209393a8bf6cb15fb40c3f3149aaf8e1a2b9", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/8f9d96047a731c37b18b28c2bfcdfa2705bb303f", + "reference": "8f9d96047a731c37b18b28c2bfcdfa2705bb303f", "shasum": "" }, "type": "library", @@ -244,9 +244,9 @@ "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.30" + "source": "https://github.com/pmmp/BedrockData/tree/2.5.1+bedrock-1.20.30" }, - "time": "2023-09-20T16:34:21+00:00" + "time": "2023-09-27T11:40:15+00:00" }, { "name": "pocketmine/bedrock-item-upgrade-schema", @@ -1738,16 +1738,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.35", + "version": "1.10.38", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", "shasum": "" }, "require": { @@ -1796,20 +1796,20 @@ "type": "tidelift" } ], - "time": "2023-09-19T15:27:56+00:00" + "time": "2023-10-06T14:19:14+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "1.3.14", + "version": "1.3.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "614acc10c522e319639bf38b0698a4a566665f04" + "reference": "70ecacc64fe8090d8d2a33db5a51fe8e88acd93a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/614acc10c522e319639bf38b0698a4a566665f04", - "reference": "614acc10c522e319639bf38b0698a4a566665f04", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/70ecacc64fe8090d8d2a33db5a51fe8e88acd93a", + "reference": "70ecacc64fe8090d8d2a33db5a51fe8e88acd93a", "shasum": "" }, "require": { @@ -1846,9 +1846,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.14" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.15" }, - "time": "2023-08-25T09:46:39+00:00" + "time": "2023-10-09T18:58:39+00:00" }, { "name": "phpstan/phpstan-strict-rules", @@ -1901,16 +1901,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.6", + "version": "10.1.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364" + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", "shasum": "" }, "require": { @@ -1967,7 +1967,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.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" }, "funding": [ { @@ -1975,7 +1975,7 @@ "type": "github" } ], - "time": "2023-09-19T04:59:03+00:00" + "time": "2023-10-04T15:34:17+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2222,16 +2222,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.3.5", + "version": "10.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503" + "reference": "62bd7af13d282deeb95650077d28ba3600ca321c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/747c3b2038f1139e3dcd9886a3f5a948648b7503", - "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/62bd7af13d282deeb95650077d28ba3600ca321c", + "reference": "62bd7af13d282deeb95650077d28ba3600ca321c", "shasum": "" }, "require": { @@ -2271,7 +2271,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.3-dev" + "dev-main": "10.4-dev" } }, "autoload": { @@ -2303,7 +2303,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.3.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.1" }, "funding": [ { @@ -2319,7 +2319,7 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:42:37+00:00" + "time": "2023-10-08T05:01:11+00:00" }, { "name": "sebastian/cli-parser", @@ -2567,16 +2567,16 @@ }, { "name": "sebastian/complexity", - "version": "3.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a" + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c70b73893e10757af9c6a48929fa6a333b56a97a", - "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", "shasum": "" }, "require": { @@ -2589,7 +2589,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" } }, "autoload": { @@ -2613,7 +2613,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0" }, "funding": [ { @@ -2621,7 +2621,7 @@ "type": "github" } ], - "time": "2023-08-31T09:55:53+00:00" + "time": "2023-09-28T11:50:59+00:00" }, { "name": "sebastian/diff", @@ -2756,16 +2756,16 @@ }, { "name": "sebastian/exporter", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344" + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", "shasum": "" }, "require": { @@ -2779,7 +2779,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2822,7 +2822,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" }, "funding": [ { @@ -2830,7 +2830,7 @@ "type": "github" } ], - "time": "2023-09-18T07:15:37+00:00" + "time": "2023-09-24T13:22:09+00:00" }, { "name": "sebastian/global-state", From edea793a9849550ee7d8b99c9594a10d6b391ac5 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Oct 2023 21:25:53 +0100 Subject: [PATCH 02/18] Downgrade PHPUnit to 10.3 until sebastianbergmann/phpunit#5539 is fixed --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 4b485f30d38..752779c2d02 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,7 @@ "phpstan/phpstan": "1.10.38", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "~10.3.0 || ~10.2.0 || ~10.1.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 084f2f551fe..95bfc94abcc 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": "c8e65401c1bbfdae28c7a9069df35963", + "content-hash": "4f353f6d6fedade4ebfa82aa34f9cb21", "packages": [ { "name": "adhocore/json-comment", @@ -2222,16 +2222,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.4.1", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "62bd7af13d282deeb95650077d28ba3600ca321c" + "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/62bd7af13d282deeb95650077d28ba3600ca321c", - "reference": "62bd7af13d282deeb95650077d28ba3600ca321c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/747c3b2038f1139e3dcd9886a3f5a948648b7503", + "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503", "shasum": "" }, "require": { @@ -2271,7 +2271,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.4-dev" + "dev-main": "10.3-dev" } }, "autoload": { @@ -2303,7 +2303,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.4.1" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.5" }, "funding": [ { @@ -2319,7 +2319,7 @@ "type": "tidelift" } ], - "time": "2023-10-08T05:01:11+00:00" + "time": "2023-09-19T05:42:37+00:00" }, { "name": "sebastian/cli-parser", From 224a69b11af4b37e46cd38b53b3018fa88b40429 Mon Sep 17 00:00:00 2001 From: Hugo_ <55756021+Dhaiven@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:22:20 +0200 Subject: [PATCH 03/18] Sign can be a fuel (#6095) --- src/block/BaseSign.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/block/BaseSign.php b/src/block/BaseSign.php index d7a22f3b8ab..2c9f8cda2e9 100644 --- a/src/block/BaseSign.php +++ b/src/block/BaseSign.php @@ -271,4 +271,8 @@ public function updateText(Player $author, SignText $text) : bool{ public function asItem() : Item{ return ($this->asItemCallback)(); } + + public function getFuelTime() : int{ + return $this->woodType->isFlammable() ? 200 : 0; + } } From c14eb63f9b8cf734fc7c75b624af55d90822851f Mon Sep 17 00:00:00 2001 From: Hugo_ <55756021+Dhaiven@users.noreply.github.com> Date: Tue, 17 Oct 2023 17:30:35 +0200 Subject: [PATCH 04/18] Wooden Button can be a fuel (#6099) --- src/block/WoodenButton.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/block/WoodenButton.php b/src/block/WoodenButton.php index d1123ec2d6b..7ba8a7af0d1 100644 --- a/src/block/WoodenButton.php +++ b/src/block/WoodenButton.php @@ -35,4 +35,8 @@ protected function getActivationTime() : int{ public function hasEntityCollision() : bool{ return false; //TODO: arrows activate wooden buttons } + + public function getFuelTime() : int{ + return $this->woodType->isFlammable() ? 100 : 0; + } } From 7b5c30bc2c0c9bcc3654df239c2e1918a61a3ce5 Mon Sep 17 00:00:00 2001 From: Hugo_ <55756021+Dhaiven@users.noreply.github.com> Date: Tue, 17 Oct 2023 23:10:08 +0200 Subject: [PATCH 05/18] WoodenDoor can be a fuel (#6101) --- src/block/WoodenDoor.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/block/WoodenDoor.php b/src/block/WoodenDoor.php index e398812cd0e..96f349e4969 100644 --- a/src/block/WoodenDoor.php +++ b/src/block/WoodenDoor.php @@ -27,4 +27,8 @@ class WoodenDoor extends Door{ use WoodTypeTrait; + + public function getFuelTime() : int{ + return $this->woodType->isFlammable() ? 200 : 0; + } } From 932116fa524e4cf553834583c9c6ab479501a09a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 18 Oct 2023 10:22:37 +0100 Subject: [PATCH 06/18] Server: re-added @see reference that somehow got deleted this is useful when clicking through references in the call stack. --- src/Server.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Server.php b/src/Server.php index 2f1e9a53bd5..9adc8e794ee 100644 --- a/src/Server.php +++ b/src/Server.php @@ -570,6 +570,7 @@ public function createPlayer(NetworkSession $session, PlayerInfo $playerInfo, bo $playerPromiseResolver = new PromiseResolver(); $createPlayer = function(Location $location) use ($playerPromiseResolver, $class, $session, $playerInfo, $authenticated, $offlinePlayerData) : void{ + /** @see Player::__construct() */ $player = new $class($this, $session, $playerInfo, $authenticated, $location, $offlinePlayerData); if(!$player->hasPlayedBefore()){ $player->onGround = true; //TODO: this hack is needed for new players in-air ticks - they don't get detected as on-ground until they move From b4d55e4384e8f63b64db23a4fad8d1cb9da1d320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Le=C3=B3n?= <58715544+JavierLeon9966@users.noreply.github.com> Date: Wed, 18 Oct 2023 06:40:01 -0300 Subject: [PATCH 07/18] Fixed dirt and grass block interactions when clicking on sides other than the top (#6071) --- src/block/Dirt.php | 7 ++++++- src/block/Grass.php | 33 ++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/block/Dirt.php b/src/block/Dirt.php index 539454b4157..fd6dc9d0975 100644 --- a/src/block/Dirt.php +++ b/src/block/Dirt.php @@ -59,7 +59,12 @@ public function setDirtType(DirtType $dirtType) : self{ public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ $world = $this->position->getWorld(); - if($face === Facing::UP && $item instanceof Hoe){ + if($face !== Facing::DOWN && $item instanceof Hoe){ + $up = $this->getSide(Facing::UP); + if($up->getTypeId() !== BlockTypeIds::AIR){ + return true; + } + $item->applyDamage(1); $newBlock = $this->dirtType->equals(DirtType::NORMAL()) ? VanillaBlocks::FARMLAND() : VanillaBlocks::DIRT(); diff --git a/src/block/Grass.php b/src/block/Grass.php index 709dc6a9de2..f3fd96a3407 100644 --- a/src/block/Grass.php +++ b/src/block/Grass.php @@ -82,7 +82,7 @@ public function onRandomTick() : void{ } public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ - if($face !== Facing::UP){ + if($this->getSide(Facing::UP)->getTypeId() !== BlockTypeIds::AIR){ return false; } $world = $this->position->getWorld(); @@ -91,20 +91,23 @@ public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player TallGrassObject::growGrass($world, $this->position, new Random(mt_rand()), 8, 2); return true; - }elseif($item instanceof Hoe){ - $item->applyDamage(1); - $newBlock = VanillaBlocks::FARMLAND(); - $world->addSound($this->position->add(0.5, 0.5, 0.5), new ItemUseOnBlockSound($newBlock)); - $world->setBlock($this->position, $newBlock); - - return true; - }elseif($item instanceof Shovel && $this->getSide(Facing::UP)->getTypeId() === BlockTypeIds::AIR){ - $item->applyDamage(1); - $newBlock = VanillaBlocks::GRASS_PATH(); - $world->addSound($this->position->add(0.5, 0.5, 0.5), new ItemUseOnBlockSound($newBlock)); - $world->setBlock($this->position, $newBlock); - - return true; + } + if($face !== Facing::DOWN){ + if($item instanceof Hoe){ + $item->applyDamage(1); + $newBlock = VanillaBlocks::FARMLAND(); + $world->addSound($this->position->add(0.5, 0.5, 0.5), new ItemUseOnBlockSound($newBlock)); + $world->setBlock($this->position, $newBlock); + + return true; + }elseif($item instanceof Shovel){ + $item->applyDamage(1); + $newBlock = VanillaBlocks::GRASS_PATH(); + $world->addSound($this->position->add(0.5, 0.5, 0.5), new ItemUseOnBlockSound($newBlock)); + $world->setBlock($this->position, $newBlock); + + return true; + } } return false; From b3390458b42772e3ca0ba20c240d102597871b35 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:58:27 +0100 Subject: [PATCH 08/18] Bump phpstan/phpstan from 1.10.38 to 1.10.39 (#6103) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.38 to 1.10.39. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.38...1.10.39) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 61c5d06648b..6b73c15554e 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "symfony/filesystem": "~6.3.0" }, "require-dev": { - "phpstan/phpstan": "1.10.38", + "phpstan/phpstan": "1.10.39", "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 061eb245b9a..92f4d028531 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": "2282bf7835c1ced757460b083813e092", + "content-hash": "6c48ad06b67c3aa3890f004b197d17bc", "packages": [ { "name": "adhocore/json-comment", @@ -1378,16 +1378,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.38", + "version": "1.10.39", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d9dedb0413f678b4d03cbc2279a48f91592c97c4", + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4", "shasum": "" }, "require": { @@ -1436,7 +1436,7 @@ "type": "tidelift" } ], - "time": "2023-10-06T14:19:14+00:00" + "time": "2023-10-17T15:46:26+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -2964,5 +2964,5 @@ "platform-overrides": { "php": "8.1.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From 7dd3a70d2ea218d5e4f480697fcaa1426446f44e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 20 Oct 2023 10:16:49 +0100 Subject: [PATCH 09/18] Revert "World: discard tiles on load if they aren't the correct type or no tile is expected" This reverts commit 8f804f6f342e650156767372bac2d42b55297361. This change is too disruptive, since popular plugins like ExtendedBlocks and ExtendedBlocksConverter relied on custom tiles. Deleting them at this stage would prevent these plugins from working, making it impossible to upgrade old data. An alternative solution to this problem will need to be developed. --- src/world/World.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index 1103ae8f9e1..903cc60e2b1 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -2873,15 +2873,7 @@ private function initChunk(int $chunkX, int $chunkZ, ChunkData $chunkData) : voi }elseif($this->getTile($tilePosition) !== null){ $logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Another tile is already at that position"); }else{ - $block = $this->getBlockAt($tilePosition->getFloorX(), $tilePosition->getFloorY(), $tilePosition->getFloorZ()); - $expectedClass = $block->getIdInfo()->getTileClass(); - if($expectedClass === null){ - $logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Block at that position (" . $block->getName() . ") does not expect a tile"); - }elseif(!($tile instanceof $expectedClass)){ - $logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Tile is of wrong type (expected $expectedClass but have " . get_class($tile) . ")"); - }else{ - $this->addTile($tile); - } + $this->addTile($tile); } } From 8fa5c7cdab4ae09b2259ea062938593d871574a7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 20 Oct 2023 10:28:46 +0100 Subject: [PATCH 10/18] World: do not apply fake state properties from tile if the block doesn't expect this tile type This was causing a variety of crashes due to incorrect tiles, presumably from PM3 worlds. --- src/world/World.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index 903cc60e2b1..8265aa38418 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1102,19 +1102,22 @@ public function createBlockUpdatePackets(array $blocks) : array{ $blockPosition = BlockPosition::fromVector3($b); $tile = $this->getTileAt($b->x, $b->y, $b->z); - if($tile instanceof Spawnable && count($fakeStateProperties = $tile->getRenderUpdateBugWorkaroundStateProperties($fullBlock)) > 0){ - $originalStateData = $blockTranslator->internalIdToNetworkStateData($fullBlock->getStateId()); - $fakeStateData = new BlockStateData( - $originalStateData->getName(), - array_merge($originalStateData->getStates(), $fakeStateProperties), - $originalStateData->getVersion() - ); - $packets[] = UpdateBlockPacket::create( - $blockPosition, - $blockTranslator->getBlockStateDictionary()->lookupStateIdFromData($fakeStateData) ?? throw new AssumptionFailedError("Unmapped fake blockstate data: " . $fakeStateData->toNbt()), - UpdateBlockPacket::FLAG_NETWORK, - UpdateBlockPacket::DATA_LAYER_NORMAL - ); + if($tile instanceof Spawnable){ + $expectedClass = $fullBlock->getIdInfo()->getTileClass(); + if($expectedClass !== null && $tile instanceof $expectedClass && count($fakeStateProperties = $tile->getRenderUpdateBugWorkaroundStateProperties($fullBlock)) > 0){ + $originalStateData = $blockTranslator->internalIdToNetworkStateData($fullBlock->getStateId()); + $fakeStateData = new BlockStateData( + $originalStateData->getName(), + array_merge($originalStateData->getStates(), $fakeStateProperties), + $originalStateData->getVersion() + ); + $packets[] = UpdateBlockPacket::create( + $blockPosition, + $blockTranslator->getBlockStateDictionary()->lookupStateIdFromData($fakeStateData) ?? throw new AssumptionFailedError("Unmapped fake blockstate data: " . $fakeStateData->toNbt()), + UpdateBlockPacket::FLAG_NETWORK, + UpdateBlockPacket::DATA_LAYER_NORMAL + ); + } } $packets[] = UpdateBlockPacket::create( $blockPosition, From decc18830217d89127c4d0c1ad1bf53550b3709e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 20 Oct 2023 10:30:50 +0100 Subject: [PATCH 11/18] Release 5.6.1 --- changelogs/5.6.md | 14 ++++++++++++++ src/VersionInfo.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/changelogs/5.6.md b/changelogs/5.6.md index d4914f527ff..257289a4a8f 100644 --- a/changelogs/5.6.md +++ b/changelogs/5.6.md @@ -18,3 +18,17 @@ Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if ## Fixes - Fixed support conditions for hanging roots, cave vines and dead bushes. - Fixed connection conditions for fences, glass panes, iron bars, and walls. + +# 5.6.1 +Released 20th October 2023. + +## Performance +- Improved performance of cactus growth by disabling neighbour updates when only the age property was updated. While this isn't a perfect solution, it provides significant performance gains for servers with large cactus farms. + +## Fixes +- Fixed `tools/generate-bedrock-data-from-packets.php` incorrectly interpreting network meta as blockstates in some cases (broken crafting recipes). +- Fixed crafting recipes involving beds, skulls and some other items not working correctly (incorrectly interpreted data). +- Fixed crashes when flower pot or cauldron blockentities exist in places where they shouldn't (leftovers from upgraded PM3 worlds). +- Fixed `Entity->broadcastSound()` not firing `WorldSoundEvent` (bypassing internal sound system). +- Fixed wooden signs, buttons and doors not being able to be used as furnace fuel. +- Fixed bone meal and tools only working when used on the top side of dirt and grass. Bone meal now works from any side, and tools work on any side except the bottom. diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 38854ac9c5a..37703b32d66 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -32,7 +32,7 @@ final class VersionInfo{ public const NAME = "PocketMine-MP"; public const BASE_VERSION = "5.6.1"; - public const IS_DEVELOPMENT_BUILD = true; + public const IS_DEVELOPMENT_BUILD = false; public const BUILD_CHANNEL = "stable"; /** From 1c5d3b43be265e0e1e78465bf93a49a5e1364a08 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 20 Oct 2023 10:30:50 +0100 Subject: [PATCH 12/18] 5.6.2 is next --- src/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 37703b32d66..9088094a247 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "5.6.1"; - public const IS_DEVELOPMENT_BUILD = false; + public const BASE_VERSION = "5.6.2"; + public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; /** From 450ad4220211405238adb0e6e05e649bc041dc31 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 20 Oct 2023 11:37:58 +0100 Subject: [PATCH 13/18] Added some new recommendations to CONTRIBUTING.md --- CONTRIBUTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6b47a7fad45..a17d291663c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,6 +117,19 @@ It's your responsibility to ensure your code matches the formatting and styling If you use PhpStorm, a `Project` code style is provided, which you can use to automatically format new code. You can also use [`php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to format your code. +#### Use `final` and `private` wherever possible +- Changing from `private` to `protected` or `final` to non-`final` doesn't break backwards compatibility, but the opposite does. +- `private` and `final` also enable certain performance optimizations which are otherwise not possible. +- `private` members can be freely changed, added and removed in the future, so it's ideal for internal functions. Abusing `protected` makes internal improvements inconvenient. +- "Let's leave it protected/public in case someone needs it for ... idk what" is **not a valid reason to expose things**. If there isn't a clear reason for something to be accessible from the outside, don't expose it. +- **This is a lesson learned through years of experience.** You may not like it, but it's for the best. + +#### Immutable things are almost always preferred +- Do not add unnecessary setters or public writable properties to classes. As above, "Let's leave it in case someone needs it" is **not a valid reason to expose things**. +- Mutable classes and properties are unpredictable, since code has no way to know if the object it's working with might be randomly modified by another part of the code. This makes it harder to maintain code and debug issues. +- Most classes exist only to hold some data. These are called "data transfer objects" (DTOs). These types of classes should pretty much always be immutable. +- Make use of `final`, `private` and `readonly` modifiers. + ### Recommendations - **Do not edit code directly on github.com.** We recommend learning how to use [`git`](https://git-scm.com). `git` allows you to "clone" a repository onto your computer, so that you can make changes using an IDE. From e4888d71028feb604b330b7a14c6b178bb97dec9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 20 Oct 2023 12:12:14 +0100 Subject: [PATCH 14/18] =?UTF-8?q?=C3=82CONTRIBUTING.md:=20restructure,=20r?= =?UTF-8?q?eword=20and=20reorganize=20[ci=20skip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 92 ++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a17d291663c..3490542c5b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,58 +88,58 @@ Depending on the changes, maintainers might ask you to make changes to the PR to ### Requirements The following are required as a minimum for pull requests. PRs that don't meet these requirements will be declined unless updated to meet them. -#### Licensing -PocketMine-MP is licensed under [LGPLv3 license](LICENSE). -By proposing a pull request, you agree to your code being distributed within PocketMine-MP under the same license. -If you take code from other projects, that code MUST be licensed under an LGPL-compatible license. - -#### PRs should be about exactly ONE thing -If you want to make multiple changes, those changes should each be contributed as separate pull requests. **DO NOT** mix unrelated changes. - -#### PRs must not include unnecessary/unrelated changes -Do not include changes which aren't strictly necessary. This makes it harder to review a PR, because the code diff becomes larger and harder to review. -This means: -- don't reformat or rearrange existing code -- don't change things that aren't related to the PR's objective -- don't rewrite existing code just to make it "look nicer" -- don't change PhpDocs to native types in code you didn't write - -#### Tests must be provided -Where possible, PHPUnit tests should be written for new or changed code. -If that's not possible (e.g. for in-game functionality), the code must be tested manually and details of the tests done must be provided. -**Simply saying "Tested" is not acceptable** and will lead to your PR being declined. - -#### Comments and documentation must be written in American English -English is the shared languages of all current maintainers. - -#### Code must be in the PocketMine-MP style -It's your responsibility to ensure your code matches the formatting and styling of the rest of the code. -If you use PhpStorm, a `Project` code style is provided, which you can use to automatically format new code. -You can also use [`php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to format your code. - -#### Use `final` and `private` wherever possible -- Changing from `private` to `protected` or `final` to non-`final` doesn't break backwards compatibility, but the opposite does. -- `private` and `final` also enable certain performance optimizations which are otherwise not possible. -- `private` members can be freely changed, added and removed in the future, so it's ideal for internal functions. Abusing `protected` makes internal improvements inconvenient. -- "Let's leave it protected/public in case someone needs it for ... idk what" is **not a valid reason to expose things**. If there isn't a clear reason for something to be accessible from the outside, don't expose it. -- **This is a lesson learned through years of experience.** You may not like it, but it's for the best. - -#### Immutable things are almost always preferred -- Do not add unnecessary setters or public writable properties to classes. As above, "Let's leave it in case someone needs it" is **not a valid reason to expose things**. -- Mutable classes and properties are unpredictable, since code has no way to know if the object it's working with might be randomly modified by another part of the code. This makes it harder to maintain code and debug issues. -- Most classes exist only to hold some data. These are called "data transfer objects" (DTOs). These types of classes should pretty much always be immutable. -- Make use of `final`, `private` and `readonly` modifiers. +- **All code must be licensed under the [LGPLv3 license](LICENSE)** as per PocketMine-MP's own license, or a compatible license. + - By proposing a pull request, you agree to your code being distributed within PocketMine-MP under the same license. + - If you take code from other projects, that code MUST be licensed under an LGPL-compatible license. +- **PRs should be about ONE thing** + - If you want to make multiple changes, those changes should each be contributed as separate pull requests. **DO NOT** mix unrelated changes. + - **Do not include unnecessary changes.** This makes the code diff larger and more noisy, making it harder to review. + - Don't change things that aren't related to the PR's objective + - Don't reformat or rearrange existing code without a good reason related to the PR's objective + - Don't rewrite existing code just to make it "look nicer" + - Don't change PhpDocs to native types in code you didn't write, unless that's the objective of the PR +- **Test code changes, and tell us what tests have been done.** + - Where possible, PHPUnit tests should be written for new or changed code. If that's not possible (e.g. for in-game functionality), the code must be tested manually and details of the tests done must be provided. + - **Simply saying "Tested" is not acceptable** and could lead to your PR being declined. +- **Code, comments and documentation must be written in American English.** English is the shared languages of all current maintainers. +- **Code must be in the PocketMine-MP style.** + - It's your responsibility to ensure your code matches the formatting and styling of the rest of the code. + - If you use PhpStorm, a `Project` code style is provided, which you can use to automatically format new code. + - You can also use [`php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to format your code. +- **Use `final` and `private` wherever possible**. + - Changing from `private` to `protected` or `final` to non-`final` doesn't break backwards compatibility, but the opposite does. + - `private` and `final` also enable certain performance optimizations which are otherwise not possible. + - `private` members can be freely changed, added and removed in the future, so it's ideal for internal functions. Abusing `protected` makes internal improvements inconvenient. + - "Let's leave it protected/public in case someone needs it for ... idk what" is **not a valid reason to expose things**. If there isn't a clear reason for something to be accessible from the outside, don't expose it. + - **This is a lesson learned through years of experience.** You may not like it, but it's for the best. +- **Immutable things are almost always preferred.** + - Do not add unnecessary setters or public writable properties to classes. As above, "Let's leave it in case someone needs it" is **not a valid reason to expose things**. + - Mutable classes and properties are unpredictable, since code has no way to know if the object it's working with might be randomly modified by another part of the code. This makes it harder to maintain code and debug issues. + - Most classes exist only to hold some data. These are called "data transfer objects" (DTOs). These types of classes should pretty much always be immutable. + - Make use of `final`, `private` and `readonly` modifiers. ### Recommendations - +- **Be patient.** Reviewing pull requests takes a lot of time and energy, and maintainers are often unavailable or busy. Your PR might not receive attention for a while. + - Remember, PRs with small diffs are much easier to review. Small PRs are generally reviewed and merged much faster than large ones. +- **Start small.** Try fixing minor bugs or doing something isolated (e.g. adding a new block or item) before attempting larger changes. + - This helps you get familiar with the codebase, the contribution process, and the expectations of maintainers. + - Check out the [issues page]() for something that you could tackle without too much effort. +- **Do not copy-paste other people's code**. Many PRs involve discussion about the changes, and changes are often requested by reviewers. If you don't understand the code you're copy-pasting, your PR is likely to fail. - **Do not edit code directly on github.com.** We recommend learning how to use [`git`](https://git-scm.com). `git` allows you to "clone" a repository onto your computer, so that you can make changes using an IDE. - **Use an IDE, not a text editor.** We recommend PhpStorm or VSCode. +- **Do not make large pull requests without an RFC.** + - Large changes should be discussed beforehand using the [RFC / Change Proposal](#rfcs--change-proposals) process. + - Large changes are much harder to review, and are more likely to be declined if maintainers don't have a good idea what you're trying to do in advance. - **Create a new branch on your fork for each pull request.** This allows you to use the same fork to make multiple pull requests at the same time. +- **Make your PR diff as small as possible.** Smaller PRs are **much more likely** to be accepted, as they are easier to review. + - Avoid moving code around in files if possible. + - Don't make random CS changes. This makes the diff noisier and harder to review. - **Use descriptive commit titles.** You can see an example [here](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). -- **Do not include multiple unrelated changes in one commit.** An atomic style for commits is preferred - this means that changes included in a commit should be part of a single distinct change set. See [this link](https://www.freshconsulting.com/atomic-commits/) for more information on atomic commits. See the [documentation on `git add`](https://git-scm.com/docs/git-add) for information on how to isolate local changes for committing. -- **Your pull request will be checked and discussed in due time.** Since the team is scattered all around the world, your PR may not receive any attention for some time. -- **Do not make large pull requests without an RFC.** Large changes should be discussed beforehand using the [RFC / Change Proposal](#rfcs--change-proposals) process. Large changes are much harder to review and are more likely to be declined if maintainers don't have a good idea what you're trying to do in advance. -- **Do not copy-paste code**. There are potential license issues implicit with copy-pasting, and copy-paste usually indicates a lack of understanding of the actual code. Copy-pasted code is obvious a mile off and **any PR like this is likely to be closed**. If you want to use somebody else's code from a Git repository, **use [GIT's cherry-pick feature](https://git-scm.com/docs/git-cherry-pick)** to cherry-pick the commit. +- **Split unrelated changes into multiple commits.** + - An atomic style for commits is preferred - this means that changes included in a commit should be part of a single distinct change set. + - If you need to use "and" or "multiple changes" in your commit message, the commit probably needs to be split up. There are exceptions, but this is a good rule of thumb. + - See [this link](https://www.freshconsulting.com/atomic-commits/) for more information on atomic commits. + - See the [documentation on `git add -i` or `git add -p`](https://git-scm.com/docs/git-add) for information on how to split up local changes for committing. **Thanks for contributing to PocketMine-MP!** From 73b1fba53c49c83ee987f6ce84743e87fb0eb065 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 23 Oct 2023 11:46:08 +0100 Subject: [PATCH 15/18] Fixed Promise calling rejection handler given after being successfully resolved closes #6110 this is a weird use case, but it should work nonetheless. --- src/promise/Promise.php | 11 +++++-- src/promise/PromiseResolver.php | 8 ++--- src/promise/PromiseSharedData.php | 6 ++-- tests/phpunit/promise/PromiseTest.php | 42 +++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 tests/phpunit/promise/PromiseTest.php diff --git a/src/promise/Promise.php b/src/promise/Promise.php index e7188197c7d..bafec097978 100644 --- a/src/promise/Promise.php +++ b/src/promise/Promise.php @@ -41,8 +41,11 @@ public function __construct(private PromiseSharedData $shared){} * @phpstan-param \Closure() : void $onFailure */ public function onCompletion(\Closure $onSuccess, \Closure $onFailure) : void{ - if($this->shared->resolved){ - $this->shared->result === null ? $onFailure() : $onSuccess($this->shared->result); + $state = $this->shared->state; + if($state === true){ + $onSuccess($this->shared->result); + }elseif($state === false){ + $onFailure(); }else{ $this->shared->onSuccess[spl_object_id($onSuccess)] = $onSuccess; $this->shared->onFailure[spl_object_id($onFailure)] = $onFailure; @@ -50,6 +53,8 @@ public function onCompletion(\Closure $onSuccess, \Closure $onFailure) : void{ } public function isResolved() : bool{ - return $this->shared->resolved; + //TODO: perhaps this should return true when rejected? currently there's no way to tell if a promise was + //rejected or just hasn't been resolved yet + return $this->shared->state === true; } } diff --git a/src/promise/PromiseResolver.php b/src/promise/PromiseResolver.php index 97b181d0b25..2019f261d03 100644 --- a/src/promise/PromiseResolver.php +++ b/src/promise/PromiseResolver.php @@ -41,10 +41,10 @@ public function __construct(){ * @phpstan-param TValue $value */ public function resolve(mixed $value) : void{ - if($this->shared->resolved){ + if($this->shared->state !== null){ throw new \LogicException("Promise has already been resolved/rejected"); } - $this->shared->resolved = true; + $this->shared->state = true; $this->shared->result = $value; foreach($this->shared->onSuccess as $c){ $c($value); @@ -54,10 +54,10 @@ public function resolve(mixed $value) : void{ } public function reject() : void{ - if($this->shared->resolved){ + if($this->shared->state !== null){ throw new \LogicException("Promise has already been resolved/rejected"); } - $this->shared->resolved = true; + $this->shared->state = false; foreach($this->shared->onFailure as $c){ $c(); } diff --git a/src/promise/PromiseSharedData.php b/src/promise/PromiseSharedData.php index be667eadb46..8bc2691f46c 100644 --- a/src/promise/PromiseSharedData.php +++ b/src/promise/PromiseSharedData.php @@ -41,8 +41,8 @@ final class PromiseSharedData{ */ public array $onFailure = []; - public bool $resolved = false; + public ?bool $state = null; - /** @phpstan-var TValue|null */ - public mixed $result = null; + /** @phpstan-var TValue */ + public mixed $result; } diff --git a/tests/phpunit/promise/PromiseTest.php b/tests/phpunit/promise/PromiseTest.php new file mode 100644 index 00000000000..7198f4f619e --- /dev/null +++ b/tests/phpunit/promise/PromiseTest.php @@ -0,0 +1,42 @@ +resolve(null); + $resolver->getPromise()->onCompletion( + function(mixed $value) : void{ + self::assertNull($value); + }, + function() : void{ + self::fail("Promise should not be rejected"); + } + ); + } +} From 9fcc9f433829c1f35716857e0861b50dae915618 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 23 Oct 2023 12:24:02 +0100 Subject: [PATCH 16/18] StringToItemParser: added missing blocks closes #6108 --- src/item/StringToItemParser.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/item/StringToItemParser.php b/src/item/StringToItemParser.php index d482e4bef9a..50e34744dd5 100644 --- a/src/item/StringToItemParser.php +++ b/src/item/StringToItemParser.php @@ -205,6 +205,7 @@ private static function registerBlocks(self $result) : void{ $result->registerBlock("carpet", fn() => Blocks::CARPET()); $result->registerBlock("carrot_block", fn() => Blocks::CARROTS()); $result->registerBlock("carrots", fn() => Blocks::CARROTS()); + $result->registerBlock("cartography_table", fn() => Blocks::CARTOGRAPHY_TABLE()); $result->registerBlock("carved_pumpkin", fn() => Blocks::CARVED_PUMPKIN()); $result->registerBlock("cauldron", fn() => Blocks::CAULDRON()); $result->registerBlock("cave_vines", fn() => Blocks::CAVE_VINES()); @@ -975,6 +976,7 @@ private static function registerBlocks(self $result) : void{ $result->registerBlock("slime", fn() => Blocks::SLIME()); $result->registerBlock("slime_block", fn() => Blocks::SLIME()); $result->registerBlock("small_dripleaf", fn() => Blocks::SMALL_DRIPLEAF()); + $result->registerBlock("smithing_table", fn() => Blocks::SMITHING_TABLE()); $result->registerBlock("smoker", fn() => Blocks::SMOKER()); $result->registerBlock("smooth_basalt", fn() => Blocks::SMOOTH_BASALT()); $result->registerBlock("smooth_quartz", fn() => Blocks::SMOOTH_QUARTZ()); @@ -1047,6 +1049,8 @@ private static function registerBlocks(self $result) : void{ $result->registerBlock("stripped_acacia_wood", fn() => Blocks::ACACIA_WOOD()->setStripped(true)); $result->registerBlock("stripped_birch_log", fn() => Blocks::BIRCH_LOG()->setStripped(true)); $result->registerBlock("stripped_birch_wood", fn() => Blocks::BIRCH_WOOD()->setStripped(true)); + $result->registerBlock("stripped_cherry_log", fn() => Blocks::CHERRY_LOG()->setStripped(true)); + $result->registerBlock("stripped_cherry_wood", fn() => Blocks::CHERRY_WOOD()->setStripped(true)); $result->registerBlock("stripped_crimson_hyphae", fn() => Blocks::CRIMSON_HYPHAE()->setStripped(true)); $result->registerBlock("stripped_crimson_stem", fn() => Blocks::CRIMSON_STEM()->setStripped(true)); $result->registerBlock("stripped_dark_oak_log", fn() => Blocks::DARK_OAK_LOG()->setStripped(true)); From 438cfa3cdc419c62ee6d708125510980aff191c5 Mon Sep 17 00:00:00 2001 From: Elysio Martins <77900181+Refaltor77@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:52:51 +0200 Subject: [PATCH 17/18] Update RuntimeBlockStateRegistry.php --- src/block/RuntimeBlockStateRegistry.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/block/RuntimeBlockStateRegistry.php b/src/block/RuntimeBlockStateRegistry.php index 78be658bc15..bb339200db8 100644 --- a/src/block/RuntimeBlockStateRegistry.php +++ b/src/block/RuntimeBlockStateRegistry.php @@ -89,9 +89,6 @@ public function __construct(){ public function register(Block $block) : void{ $typeId = $block->getTypeId(); - if(isset($this->typeIndex[$typeId])){ - throw new \InvalidArgumentException("Block ID $typeId is already used by another block"); - } $this->typeIndex[$typeId] = clone $block; From c55f9423aaaba09031b8aef63f2276e2001578ff Mon Sep 17 00:00:00 2001 From: theohdg2 <66752727+theohdg2@users.noreply.github.com> Date: Thu, 26 Oct 2023 21:59:03 +0200 Subject: [PATCH 18/18] 1.20.40 (#1) * Changes for 1.20.40 * 1.20.40 changes (PM4) * Update PHPStan * Release 4.25.0 * 4.25.1 is next * Release 5.7.0 * 5.7.1 is next --------- Co-authored-by: Dylan K. Taylor --- changelogs/4.25.md | 16 ++++++++ changelogs/5.7.md | 20 ++++++++++ composer.json | 6 +-- composer.lock | 40 +++++++++---------- src/VersionInfo.php | 2 +- src/data/bedrock/block/BlockStateData.php | 4 +- .../convert/BlockObjectToStateSerializer.php | 8 ++-- .../BlockStateToObjectDeserializer.php | 8 ++-- src/network/mcpe/NetworkSession.php | 2 +- src/world/format/io/data/BedrockWorldData.php | 6 +-- 10 files changed, 74 insertions(+), 38 deletions(-) create mode 100644 changelogs/4.25.md create mode 100644 changelogs/5.7.md diff --git a/changelogs/4.25.md b/changelogs/4.25.md new file mode 100644 index 00000000000..032c09ce8fe --- /dev/null +++ b/changelogs/4.25.md @@ -0,0 +1,16 @@ +# 4.25.0 +Released 26th October 2023. + +**For Minecraft: Bedrock Edition 1.20.40** + +This is a support release for Minecraft: Bedrock Edition 1.20.40. + +**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.40. +- Removed support for older versions. diff --git a/changelogs/5.7.md b/changelogs/5.7.md new file mode 100644 index 00000000000..65830c22040 --- /dev/null +++ b/changelogs/5.7.md @@ -0,0 +1,20 @@ +# 5.7.0 +Released 26th October 2023. + +**For Minecraft: Bedrock Edition 1.20.40** + +This is a support release for Minecraft: Bedrock Edition 1.20.40. + +**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.40. +- Removed support for older versions. + +## Fixes +- Fixed `cartography_table`, `smithing_table`, `stripped_cherry_log` and `stripped_cherry_wood` not working in `StringToItemParser`. +- Fixed `Promise::onCompletion()` always calling the reject handler if the promise was already completed. diff --git a/composer.json b/composer.json index 6b73c15554e..1775f4e4dd4 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.2.0+bedrock-1.20.30", - "pocketmine/bedrock-data": "~2.5.0+bedrock-1.20.30", + "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": "~24.0.0+bedrock-1.20.30", + "pocketmine/bedrock-protocol": "~25.0.0+bedrock-1.20.40", "pocketmine/binaryutils": "^0.2.1", "pocketmine/callback-validator": "^1.0.2", "pocketmine/color": "^0.3.0", diff --git a/composer.lock b/composer.lock index 92f4d028531..cdb41d563ed 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": "6c48ad06b67c3aa3890f004b197d17bc", + "content-hash": "feefde772166966ee8065e613fe9a56e", "packages": [ { "name": "adhocore/json-comment", @@ -122,16 +122,16 @@ }, { "name": "pocketmine/bedrock-block-upgrade-schema", - "version": "3.2.0", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockBlockUpgradeSchema.git", - "reference": "874e1c0c9b7b620744d08b59c78354fe9f028dfa" + "reference": "ee46b9367af262bbddd9f122d4d5b5b495b892e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/874e1c0c9b7b620744d08b59c78354fe9f028dfa", - "reference": "874e1c0c9b7b620744d08b59c78354fe9f028dfa", + "url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/ee46b9367af262bbddd9f122d4d5b5b495b892e7", + "reference": "ee46b9367af262bbddd9f122d4d5b5b495b892e7", "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.2.0" + "source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/3.3.0" }, - "time": "2023-09-20T17:03:43+00:00" + "time": "2023-10-16T16:11:02+00:00" }, { "name": "pocketmine/bedrock-data", - "version": "2.5.1+bedrock-1.20.30", + "version": "2.6.0+bedrock-1.20.40", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "8f9d96047a731c37b18b28c2bfcdfa2705bb303f" + "reference": "37e780d28b470230bda3579b04cb50d406e3fbe6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/8f9d96047a731c37b18b28c2bfcdfa2705bb303f", - "reference": "8f9d96047a731c37b18b28c2bfcdfa2705bb303f", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/37e780d28b470230bda3579b04cb50d406e3fbe6", + "reference": "37e780d28b470230bda3579b04cb50d406e3fbe6", "shasum": "" }, "type": "library", @@ -168,9 +168,9 @@ "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/2.5.1+bedrock-1.20.30" + "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.20.40" }, - "time": "2023-09-27T11:40:15+00:00" + "time": "2023-10-26T10:39:13+00:00" }, { "name": "pocketmine/bedrock-item-upgrade-schema", @@ -200,16 +200,16 @@ }, { "name": "pocketmine/bedrock-protocol", - "version": "24.0.0+bedrock-1.20.30", + "version": "25.0.0+bedrock-1.20.40", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "38a516274aa6641b0da38011af35a5587fc87895" + "reference": "69c36c96f6835e93fc278071aa2bb9829abe5cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/38a516274aa6641b0da38011af35a5587fc87895", - "reference": "38a516274aa6641b0da38011af35a5587fc87895", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/69c36c96f6835e93fc278071aa2bb9829abe5cf8", + "reference": "69c36c96f6835e93fc278071aa2bb9829abe5cf8", "shasum": "" }, "require": { @@ -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/24.0.0+bedrock-1.20.30" + "source": "https://github.com/pmmp/BedrockProtocol/tree/25.0.0+bedrock-1.20.40" }, - "time": "2023-09-20T16:57:53+00:00" + "time": "2023-10-26T11:03:10+00:00" }, { "name": "pocketmine/binaryutils", @@ -2964,5 +2964,5 @@ "platform-overrides": { "php": "8.1.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 9088094a247..e6cae5059ce 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,7 +31,7 @@ final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "5.6.2"; + public const BASE_VERSION = "5.7.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 c5712cf6c7a..54f13ba5602 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 - (30 << 8) | //patch - (50); //revision + (40 << 8) | //patch + (3); //revision public const TAG_NAME = "name"; public const TAG_STATES = "states"; diff --git a/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php b/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php index cf3535097ec..0f64fb17b2b 100644 --- a/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php +++ b/src/data/bedrock/block/convert/BlockObjectToStateSerializer.php @@ -1113,7 +1113,7 @@ private function registerSerializers() : void{ }); $this->map(Blocks::CHEST(), function(Chest $block) : Writer{ return Writer::create(Ids::CHEST) - ->writeHorizontalFacing($block->getFacing()); + ->writeCardinalHorizontalFacing($block->getFacing()); }); $this->map(Blocks::CHISELED_QUARTZ(), fn(SimplePillar $block) => Helper::encodeQuartz(StringValues::CHISEL_TYPE_CHISELED, $block->getAxis())); $this->map(Blocks::CHISELED_RED_SANDSTONE(), fn() => Helper::encodeSandstone(Ids::RED_SANDSTONE, StringValues::SAND_STONE_TYPE_HEIROGLYPHS)); @@ -1274,7 +1274,7 @@ private function registerSerializers() : void{ $this->map(Blocks::ELEMENT_CONSTRUCTOR(), fn(ChemistryTable $block) => Helper::encodeChemistryTable($block, StringValues::CHEMISTRY_TABLE_TYPE_ELEMENT_CONSTRUCTOR, new Writer(Ids::CHEMISTRY_TABLE))); $this->map(Blocks::ENDER_CHEST(), function(EnderChest $block) : Writer{ return Writer::create(Ids::ENDER_CHEST) - ->writeHorizontalFacing($block->getFacing()); + ->writeCardinalHorizontalFacing($block->getFacing()); }); $this->map(Blocks::END_PORTAL_FRAME(), function(EndPortalFrame $block) : Writer{ return Writer::create(Ids::END_PORTAL_FRAME) @@ -1606,7 +1606,7 @@ private function registerSerializers() : void{ }); $this->map(Blocks::STONE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_STONE)); $this->map(Blocks::STONECUTTER(), fn(Stonecutter $block) => Writer::create(Ids::STONECUTTER_BLOCK) - ->writeHorizontalFacing($block->getFacing())); + ->writeCardinalHorizontalFacing($block->getFacing())); $this->map(Blocks::STONE_BRICKS(), fn() => Helper::encodeStoneBricks(StringValues::STONE_BRICK_TYPE_DEFAULT)); $this->map(Blocks::STONE_BRICK_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab1($block, StringValues::STONE_SLAB_TYPE_STONE_BRICK)); $this->mapStairs(Blocks::STONE_BRICK_STAIRS(), Ids::STONE_BRICK_STAIRS); @@ -1637,7 +1637,7 @@ private function registerSerializers() : void{ }); $this->map(Blocks::TRAPPED_CHEST(), function(TrappedChest $block) : Writer{ return Writer::create(Ids::TRAPPED_CHEST) - ->writeHorizontalFacing($block->getFacing()); + ->writeCardinalHorizontalFacing($block->getFacing()); }); $this->map(Blocks::TRIPWIRE(), function(Tripwire $block) : Writer{ return Writer::create(Ids::TRIP_WIRE) diff --git a/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php b/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php index ce39c2739c5..e54ce95eebe 100644 --- a/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php +++ b/src/data/bedrock/block/convert/BlockStateToObjectDeserializer.php @@ -994,7 +994,7 @@ private function registerDeserializers() : void{ }); $this->map(Ids::CHEST, function(Reader $in) : Block{ return Blocks::CHEST() - ->setFacing($in->readHorizontalFacing()); + ->setFacing($in->readCardinalHorizontalFacing()); }); $this->map(Ids::CHORUS_FLOWER, function(Reader $in) : Block{ return Blocks::CHORUS_FLOWER() @@ -1095,7 +1095,7 @@ private function registerDeserializers() : void{ }); $this->map(Ids::ENDER_CHEST, function(Reader $in) : Block{ return Blocks::ENDER_CHEST() - ->setFacing($in->readHorizontalFacing()); + ->setFacing($in->readCardinalHorizontalFacing()); }); $this->map(Ids::EXPOSED_COPPER, fn() => Helper::decodeCopper(Blocks::COPPER(), CopperOxidation::EXPOSED())); $this->map(Ids::EXPOSED_CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::EXPOSED())); @@ -1504,7 +1504,7 @@ private function registerDeserializers() : void{ }); $this->map(Ids::STONECUTTER_BLOCK, function(Reader $in) : Block{ return Blocks::STONECUTTER() - ->setFacing($in->readHorizontalFacing()); + ->setFacing($in->readCardinalHorizontalFacing()); }); $this->map(Ids::SWEET_BERRY_BUSH, function(Reader $in) : Block{ //berry bush only wants 0-3, but it can be bigger in MCPE due to misuse of GROWTH state which goes up to 7 @@ -1530,7 +1530,7 @@ private function registerDeserializers() : void{ }); $this->map(Ids::TRAPPED_CHEST, function(Reader $in) : Block{ return Blocks::TRAPPED_CHEST() - ->setFacing($in->readHorizontalFacing()); + ->setFacing($in->readCardinalHorizontalFacing()); }); $this->map(Ids::TRIP_WIRE, function(Reader $in) : Block{ return Blocks::TRIPWIRE() diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 5b65ca1b5f6..30d802f60ac 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -642,7 +642,7 @@ private function sendDisconnectPacket(Translatable|string $message) : void{ }else{ $translated = $message; } - $this->sendDataPacket(DisconnectPacket::create($translated)); + $this->sendDataPacket(DisconnectPacket::create(0, $translated)); } /** diff --git a/src/world/format/io/data/BedrockWorldData.php b/src/world/format/io/data/BedrockWorldData.php index 20b1210f98d..d92576f21ad 100644 --- a/src/world/format/io/data/BedrockWorldData.php +++ b/src/world/format/io/data/BedrockWorldData.php @@ -51,12 +51,12 @@ class BedrockWorldData extends BaseNbtWorldData{ public const CURRENT_STORAGE_VERSION = 10; - public const CURRENT_STORAGE_NETWORK_VERSION = 618; + public const CURRENT_STORAGE_NETWORK_VERSION = 622; public const CURRENT_CLIENT_VERSION_TARGET = [ 1, //major 20, //minor - 30, //patch - 2, //revision + 40, //patch + 1, //revision 0 //is beta ];