From 016a80bb7030ab5c1fed452c1332f0276901af74 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 7 Jun 2022 17:47:13 +0100 Subject: [PATCH] 1.19.0 changes --- composer.json | 4 +- composer.lock | 28 ++++++------- .../mcpe/handler/InGamePacketHandler.php | 41 +++++++++++-------- .../mcpe/handler/PreSpawnPacketHandler.php | 5 +++ 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index 3f417d1f2..479b8229f 100644 --- a/composer.json +++ b/composer.json @@ -34,8 +34,8 @@ "adhocore/json-comment": "^1.1", "fgrosse/phpasn1": "^2.3", "netresearch/jsonmapper": "^4.0", - "pocketmine/bedrock-data": "~1.7.0+bedrock-1.18.30", - "pocketmine/bedrock-protocol": "~9.0.0+bedrock-1.18.30", + "pocketmine/bedrock-data": "~1.8.0+bedrock-1.19.0", + "pocketmine/bedrock-protocol": "~10.0.0+bedrock-1.19.0", "pocketmine/binaryutils": "^0.2.1", "pocketmine/callback-validator": "^1.0.2", "pocketmine/classloader": "^0.2.0", diff --git a/composer.lock b/composer.lock index 3b88b8ca8..e71a6396c 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": "1e967ff64cee3cae84242cc3e5a51752", + "content-hash": "363ffec55c206510b591b54f10138fc0", "packages": [ { "name": "adhocore/json-comment", @@ -249,16 +249,16 @@ }, { "name": "pocketmine/bedrock-data", - "version": "1.7.0+bedrock-1.18.30", + "version": "1.8.0+bedrock-1.19.0", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "c8f323ff0cbdb36a5d95e7e4a23969f562445be0" + "reference": "e654d0a6e5dfd55f8546097ea629c528a70c30ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/c8f323ff0cbdb36a5d95e7e4a23969f562445be0", - "reference": "c8f323ff0cbdb36a5d95e7e4a23969f562445be0", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/e654d0a6e5dfd55f8546097ea629c528a70c30ee", + "reference": "e654d0a6e5dfd55f8546097ea629c528a70c30ee", "shasum": "" }, "type": "library", @@ -269,22 +269,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.18.30" + "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.19.0" }, - "time": "2022-04-20T12:40:59+00:00" + "time": "2022-06-07T16:20:20+00:00" }, { "name": "pocketmine/bedrock-protocol", - "version": "9.0.2+bedrock-1.18.30", + "version": "10.0.0+bedrock-1.19.0", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "37f1cd017caf7aaaa90330ee54690098283589cb" + "reference": "7c17498541bb9a375b945cb131e951674067c00e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/37f1cd017caf7aaaa90330ee54690098283589cb", - "reference": "37f1cd017caf7aaaa90330ee54690098283589cb", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/7c17498541bb9a375b945cb131e951674067c00e", + "reference": "7c17498541bb9a375b945cb131e951674067c00e", "shasum": "" }, "require": { @@ -298,7 +298,7 @@ "ramsey/uuid": "^4.1" }, "require-dev": { - "phpstan/phpstan": "1.7.4", + "phpstan/phpstan": "1.7.11", "phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.0.0", "phpunit/phpunit": "^9.5" @@ -316,9 +316,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/9.0.2+bedrock-1.18.30" + "source": "https://github.com/pmmp/BedrockProtocol/tree/10.0.0+bedrock-1.19.0" }, - "time": "2022-05-30T15:09:53+00:00" + "time": "2022-06-07T16:31:30+00:00" }, { "name": "pocketmine/binaryutils", diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index e6a30a06e..7d4fe3b59 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -80,6 +80,7 @@ use pocketmine\network\mcpe\protocol\PlayerAuthInputPacket; use pocketmine\network\mcpe\protocol\PlayerHotbarPacket; use pocketmine\network\mcpe\protocol\PlayerInputPacket; use pocketmine\network\mcpe\protocol\PlayerSkinPacket; +use pocketmine\network\mcpe\protocol\RequestAbilityPacket; use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket; use pocketmine\network\mcpe\protocol\ServerSettingsRequestPacket; use pocketmine\network\mcpe\protocol\SetActorMotionPacket; @@ -114,6 +115,7 @@ use function count; use function fmod; use function implode; use function in_array; +use function is_bool; use function is_infinite; use function is_nan; use function json_decode; @@ -610,6 +612,9 @@ class InGamePacketHandler extends PacketHandler{ case PlayerAction::CREATIVE_PLAYER_DESTROY_BLOCK: //TODO: do we need to handle this? break; + case PlayerAction::START_ITEM_USE_ON: + case PlayerAction::STOP_ITEM_USE_ON: + //TODO: this has no obvious use and seems only used for analytics in vanilla - ignore it default: $this->session->getLogger()->debug("Unhandled/unknown player action type " . $action); return false; @@ -642,23 +647,7 @@ class InGamePacketHandler extends PacketHandler{ } public function handleAdventureSettings(AdventureSettingsPacket $packet) : bool{ - if($packet->targetActorUniqueId !== $this->player->getId()){ - return false; //TODO: operators can change other people's permissions using this - } - - $handled = false; - - $isFlying = $packet->getFlag(AdventureSettingsPacket::FLYING); - if($isFlying !== $this->player->isFlying()){ - if(!$this->player->toggleFlight($isFlying)){ - $this->session->syncAdventureSettings($this->player); - } - $handled = true; - } - - //TODO: check for other changes - - return $handled; + return true; //no longer used, but the client still sends it for flight changes } public function handleBlockActorData(BlockActorDataPacket $packet) : bool{ @@ -980,4 +969,22 @@ class InGamePacketHandler extends PacketHandler{ $this->player->emote($packet->getEmoteId()); return true; } + + public function handleRequestAbility(RequestAbilityPacket $packet) : bool{ + if($packet->getAbilityId() === RequestAbilityPacket::ABILITY_FLYING){ + $isFlying = $packet->getAbilityValue(); + if(!is_bool($isFlying)){ + throw new PacketHandlingException("Flying ability should always have a bool value"); + } + if($isFlying !== $this->player->isFlying()){ + if(!$this->player->toggleFlight($isFlying)){ + $this->session->syncAdventureSettings($this->player); + } + } + + return true; + } + + return false; + } } diff --git a/src/network/mcpe/handler/PreSpawnPacketHandler.php b/src/network/mcpe/handler/PreSpawnPacketHandler.php index be563b230..52a69d5b5 100644 --- a/src/network/mcpe/handler/PreSpawnPacketHandler.php +++ b/src/network/mcpe/handler/PreSpawnPacketHandler.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace pocketmine\network\mcpe\handler; +use pocketmine\nbt\tag\CompoundTag; use pocketmine\network\mcpe\cache\CraftingDataCache; use pocketmine\network\mcpe\cache\StaticPacketCache; use pocketmine\network\mcpe\convert\GlobalItemTypeDictionary; @@ -33,6 +34,7 @@ use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket; use pocketmine\network\mcpe\protocol\StartGamePacket; use pocketmine\network\mcpe\protocol\types\BlockPosition; use pocketmine\network\mcpe\protocol\types\BoolGameRule; +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; @@ -42,6 +44,7 @@ use pocketmine\network\mcpe\protocol\types\SpawnSettings; use pocketmine\player\Player; use pocketmine\Server; use pocketmine\VersionInfo; +use Ramsey\Uuid\Uuid; use function sprintf; /** @@ -82,6 +85,7 @@ class PreSpawnPacketHandler extends PacketHandler{ $this->player->getOffsetPosition($location), $location->pitch, $location->yaw, + new CacheableNbt(CompoundTag::create()), //TODO: we don't care about this right now $levelSettings, "", $this->server->getMotd(), @@ -93,6 +97,7 @@ class PreSpawnPacketHandler extends PacketHandler{ "", false, sprintf("%s %s", VersionInfo::NAME, VersionInfo::VERSION()->getFullVersion(true)), + Uuid::fromString(Uuid::NIL), [], 0, GlobalItemTypeDictionary::getInstance()->getDictionary()->getEntries()