From 692e63ad7cf2c97a3a85f60fc45f7816593b3cbe Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 8 Dec 2020 20:31:17 +0000 Subject: [PATCH 1/3] Protocol changes for 1.16.200 --- .../network/mcpe/NetworkSession.php | 5 ++ .../mcpe/protocol/FilterTextPacket.php | 62 +++++++++++++++++++ .../network/mcpe/protocol/PacketPool.php | 1 + .../network/mcpe/protocol/ProtocolInfo.php | 7 ++- .../mcpe/protocol/ResourcePacksInfoPacket.php | 2 + .../ItemStackResponseSlotInfo.php | 11 +++- src/pocketmine/resources/vanilla | 2 +- 7 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 src/pocketmine/network/mcpe/protocol/FilterTextPacket.php diff --git a/src/pocketmine/network/mcpe/NetworkSession.php b/src/pocketmine/network/mcpe/NetworkSession.php index dfb39796f..f6b6cecbe 100644 --- a/src/pocketmine/network/mcpe/NetworkSession.php +++ b/src/pocketmine/network/mcpe/NetworkSession.php @@ -72,6 +72,7 @@ use pocketmine\network\mcpe\protocol\EducationSettingsPacket; use pocketmine\network\mcpe\protocol\EmoteListPacket; use pocketmine\network\mcpe\protocol\EmotePacket; use pocketmine\network\mcpe\protocol\EventPacket; +use pocketmine\network\mcpe\protocol\FilterTextPacket; use pocketmine\network\mcpe\protocol\GameRulesChangedPacket; use pocketmine\network\mcpe\protocol\GuiDataPickItemPacket; use pocketmine\network\mcpe\protocol\HurtArmorPacket; @@ -816,4 +817,8 @@ abstract class NetworkSession{ public function handleItemComponent(ItemComponentPacket $packet) : bool{ return false; } + + public function handleFilterText(FilterTextPacket $packet) : bool{ + return false; + } } diff --git a/src/pocketmine/network/mcpe/protocol/FilterTextPacket.php b/src/pocketmine/network/mcpe/protocol/FilterTextPacket.php new file mode 100644 index 000000000..84f81dc81 --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/FilterTextPacket.php @@ -0,0 +1,62 @@ + + +use pocketmine\network\mcpe\NetworkSession; + +class FilterTextPacket extends DataPacket/* implements ClientboundPacket, ServerboundPacket*/{ + public const NETWORK_ID = ProtocolInfo::FILTER_TEXT_PACKET; + + /** @var string */ + private $text; + /** @var bool */ + private $fromServer; + + public static function create(string $text, bool $server) : self{ + $result = new self; + $result->text = $text; + $result->fromServer = $server; + return $result; + } + + public function getText() : string{ return $this->text; } + + public function isFromServer() : bool{ return $this->fromServer; } + + protected function decodePayload() : void{ + $this->text = $this->getString(); + $this->fromServer = $this->getBool(); + } + + protected function encodePayload() : void{ + $this->putString($this->text); + $this->putBool($this->fromServer); + } + + public function handle(NetworkSession $handler) : bool{ + return $handler->handleFilterText($this); + } +} diff --git a/src/pocketmine/network/mcpe/protocol/PacketPool.php b/src/pocketmine/network/mcpe/protocol/PacketPool.php index f46cbc80f..b0e912a15 100644 --- a/src/pocketmine/network/mcpe/protocol/PacketPool.php +++ b/src/pocketmine/network/mcpe/protocol/PacketPool.php @@ -193,6 +193,7 @@ class PacketPool{ static::registerPacket(new PlayerFogPacket()); static::registerPacket(new CorrectPlayerMovePredictionPacket()); static::registerPacket(new ItemComponentPacket()); + static::registerPacket(new FilterTextPacket()); } /** diff --git a/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php b/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php index d186a0f12..28f421b04 100644 --- a/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php +++ b/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php @@ -37,11 +37,11 @@ interface ProtocolInfo{ */ /** Actual Minecraft: PE protocol version */ - public const CURRENT_PROTOCOL = 419; + public const CURRENT_PROTOCOL = 422; /** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */ - public const MINECRAFT_VERSION = 'v1.16.100'; + public const MINECRAFT_VERSION = 'v1.16.200'; /** Version number sent to clients in ping responses. */ - public const MINECRAFT_VERSION_NETWORK = '1.16.100'; + public const MINECRAFT_VERSION_NETWORK = '1.16.200'; public const LOGIN_PACKET = 0x01; public const PLAY_STATUS_PACKET = 0x02; @@ -205,5 +205,6 @@ interface ProtocolInfo{ public const PLAYER_FOG_PACKET = 0xa0; public const CORRECT_PLAYER_MOVE_PREDICTION_PACKET = 0xa1; public const ITEM_COMPONENT_PACKET = 0xa2; + public const FILTER_TEXT_PACKET = 0xa3; } diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php index 0144587c8..714382dea 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php @@ -64,6 +64,7 @@ class ResourcePacksInfoPacket extends DataPacket{ $this->getString(); $this->getString(); $this->getBool(); + $this->getBool(); } } @@ -89,6 +90,7 @@ class ResourcePacksInfoPacket extends DataPacket{ $this->putString(""); //TODO: subpack name $this->putString(""); //TODO: content identity $this->putBool(false); //TODO: seems useless for resource packs + $this->putBool(false); //TODO: supports RTX } } diff --git a/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php b/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php index f8ac0a781..db290c332 100644 --- a/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php +++ b/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php @@ -35,12 +35,15 @@ final class ItemStackResponseSlotInfo{ private $count; /** @var int */ private $itemStackId; + /** @var string */ + private $customName; - public function __construct(int $slot, int $hotbarSlot, int $count, int $itemStackId){ + public function __construct(int $slot, int $hotbarSlot, int $count, int $itemStackId, string $customName){ $this->slot = $slot; $this->hotbarSlot = $hotbarSlot; $this->count = $count; $this->itemStackId = $itemStackId; + $this->customName = $customName; } public function getSlot() : int{ return $this->slot; } @@ -51,12 +54,15 @@ final class ItemStackResponseSlotInfo{ public function getItemStackId() : int{ return $this->itemStackId; } + public function getCustomName() : string{ return $this->customName; } + public static function read(NetworkBinaryStream $in) : self{ $slot = $in->getByte(); $hotbarSlot = $in->getByte(); $count = $in->getByte(); $itemStackId = $in->readGenericTypeNetworkId(); - return new self($slot, $hotbarSlot, $count, $itemStackId); + $customName = $in->getString(); + return new self($slot, $hotbarSlot, $count, $itemStackId, $customName); } public function write(NetworkBinaryStream $out) : void{ @@ -64,5 +70,6 @@ final class ItemStackResponseSlotInfo{ $out->putByte($this->hotbarSlot); $out->putByte($this->count); $out->writeGenericTypeNetworkId($this->itemStackId); + $out->putString($this->customName); } } diff --git a/src/pocketmine/resources/vanilla b/src/pocketmine/resources/vanilla index 14f4a765e..4e58a3c67 160000 --- a/src/pocketmine/resources/vanilla +++ b/src/pocketmine/resources/vanilla @@ -1 +1 @@ -Subproject commit 14f4a765eba40b2c65c6dcd061cbfea6e1d3d4cc +Subproject commit 4e58a3c67dea62600ce5fd014b9fd792a50d246d From 3903b70ef5747ca8365ccda91d3e4ff0ba45816d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 8 Dec 2020 21:02:13 +0000 Subject: [PATCH 2/3] Release 3.17.0 --- changelogs/3.17.md | 17 +++++++++++++++++ src/pocketmine/VersionInfo.php | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 changelogs/3.17.md diff --git a/changelogs/3.17.md b/changelogs/3.17.md new file mode 100644 index 000000000..5e70530ac --- /dev/null +++ b/changelogs/3.17.md @@ -0,0 +1,17 @@ +**For Minecraft: Bedrock Edition 1.16.200** + +### Note about API versions +Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. +Plugin developers should **only** update their required API to this version if you need the changes in this build. + +**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do. + +# 3.17.0 +- Added support for Minecraft: Bedrock Edition 1.16.200. +- Removed compatibility with earlier versions. + +## Known issues (please don't open issues for these) +- Walls don't connect to each other +- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon +- New blocks, items & mobs aren't implemented +- Nether doesn't exist diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index a1eb5903c..2aef33fa9 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; -const BASE_VERSION = "3.16.2"; -const IS_DEVELOPMENT_BUILD = true; +const BASE_VERSION = "3.17.0"; +const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0; From 69a41a5ed4aab3d64732acd5409d2ccaf044244f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 8 Dec 2020 21:02:14 +0000 Subject: [PATCH 3/3] 3.17.1 is next --- src/pocketmine/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 2aef33fa9..830f6b9c0 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; -const BASE_VERSION = "3.17.0"; -const IS_DEVELOPMENT_BUILD = false; +const BASE_VERSION = "3.17.1"; +const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0;