-
Notifications
You must be signed in to change notification settings - Fork 123
Bedrock 1.26.10 #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Bedrock 1.26.10 #342
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * This file is part of BedrockProtocol. | ||
| * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol> | ||
| * | ||
| * BedrockProtocol 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. | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace pocketmine\network\mcpe\protocol; | ||
|
|
||
| use pmmp\encoding\ByteBufferReader; | ||
| use pmmp\encoding\ByteBufferWriter; | ||
| use pmmp\encoding\VarInt; | ||
| use pocketmine\network\mcpe\protocol\types\AttributeLayerSyncPayload; | ||
| use pocketmine\network\mcpe\protocol\types\AttributesRemoveEnvironment; | ||
| use pocketmine\network\mcpe\protocol\types\AttributesUpdateEnvironment; | ||
| use pocketmine\network\mcpe\protocol\types\AttributeUpdateLayers; | ||
| use pocketmine\network\mcpe\protocol\types\AttributeUpdateLayerSettings; | ||
|
|
||
| class ClientboundAttributeLayerSyncPacket extends DataPacket{ | ||
| public const NETWORK_ID = ProtocolInfo::CLIENTBOUND_ATTRIBUTE_LAYER_SYNC_PACKET; | ||
|
|
||
| private AttributeLayerSyncPayload $payload; | ||
|
|
||
| /** | ||
| * @generate-create-func | ||
| */ | ||
| public static function create(AttributeLayerSyncPayload $payload) : self{ | ||
| $result = new self; | ||
| $result->payload = $payload; | ||
| return $result; | ||
| } | ||
|
|
||
| protected function decodePayload(ByteBufferReader $in) : void{ | ||
| $this->payload = match(VarInt::readUnsignedInt($in)){ | ||
| AttributeUpdateLayers::ID => AttributeUpdateLayers::read($in), | ||
| AttributeUpdateLayerSettings::ID => AttributeUpdateLayerSettings::read($in), | ||
| AttributesUpdateEnvironment::ID => AttributesUpdateEnvironment::read($in), | ||
| AttributesRemoveEnvironment::ID => AttributesRemoveEnvironment::read($in), | ||
| default => throw new PacketDecodeException("Unknown ClientboundAttributeLayerSync type"), | ||
| }; | ||
| } | ||
|
|
||
| protected function encodePayload(ByteBufferWriter $out) : void{ | ||
| VarInt::writeUnsignedInt($out, $this->payload->getTypeId()); | ||
| $this->payload->write($out); | ||
| } | ||
|
|
||
| public function handle(PacketHandlerInterface $handler) : bool{ | ||
| return $handler->handleClientboundAttributeLayerSync($this); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * This file is part of BedrockProtocol. | ||
| * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol> | ||
| * | ||
| * BedrockProtocol 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. | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace pocketmine\network\mcpe\protocol; | ||
|
|
||
| use pmmp\encoding\ByteBufferReader; | ||
| use pmmp\encoding\ByteBufferWriter; | ||
| use pmmp\encoding\LE; | ||
| use pocketmine\network\mcpe\protocol\serializer\CommonTypes; | ||
|
|
||
| class ClientboundDataDrivenUICloseScreenPacket extends DataPacket implements ClientboundPacket{ | ||
| public const NETWORK_ID = ProtocolInfo::CLIENTBOUND_DATA_DRIVEN_UI_CLOSE_SCREEN_PACKET; | ||
|
|
||
| private ?int $formId; | ||
|
|
||
| /** | ||
| * @generate-create-func | ||
| */ | ||
| public static function create(?int $formId) : self{ | ||
| $result = new self; | ||
| $result->formId = $formId; | ||
| return $result; | ||
| } | ||
|
|
||
| public function getFormId() : ?int{ return $this->formId; } | ||
|
|
||
| protected function decodePayload(ByteBufferReader $in) : void{ | ||
| $this->formId = CommonTypes::readOptional($in, LE::readUnsignedInt(...)); | ||
| } | ||
|
|
||
| protected function encodePayload(ByteBufferWriter $out) : void{ | ||
| CommonTypes::writeOptional($out, $this->formId, LE::writeUnsignedInt(...)); | ||
| } | ||
|
|
||
| public function handle(PacketHandlerInterface $handler) : bool{ | ||
| return $handler->handleClientboundDataDrivenUICloseScreen($this); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * This file is part of BedrockProtocol. | ||
| * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol> | ||
| * | ||
| * BedrockProtocol 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. | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace pocketmine\network\mcpe\protocol; | ||
|
|
||
| use pmmp\encoding\ByteBufferReader; | ||
| use pmmp\encoding\ByteBufferWriter; | ||
| use pmmp\encoding\VarInt; | ||
| use pocketmine\network\mcpe\protocol\types\LocatorBarWaypointPayload; | ||
| use function count; | ||
|
|
||
| class LocatorBarPacket extends DataPacket{ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing clientbound/serverbound |
||
| public const NETWORK_ID = ProtocolInfo::LOCATOR_BAR_PACKET; | ||
|
|
||
| /** | ||
| * @var LocatorBarWaypointPayload[] | ||
| * @phpstan-var list<LocatorBarWaypointPayload> | ||
| */ | ||
| private array $waypoints; | ||
|
|
||
| /** | ||
| * @generate-create-func | ||
| * @param LocatorBarWaypointPayload[] $waypoints | ||
| * @phpstan-param list<LocatorBarWaypointPayload> $waypoints | ||
| */ | ||
| public static function create(array $waypoints) : self{ | ||
| $result = new self; | ||
| $result->waypoints = $waypoints; | ||
| return $result; | ||
| } | ||
|
|
||
| protected function decodePayload(ByteBufferReader $in) : void{ | ||
| $this->waypoints = []; | ||
| for($i = 0, $len = VarInt::readUnsignedInt($in); $i < $len; ++$i){ | ||
| $this->waypoints[] = LocatorBarWaypointPayload::read($in); | ||
| } | ||
| } | ||
|
|
||
| protected function encodePayload(ByteBufferWriter $out) : void{ | ||
| VarInt::writeUnsignedInt($out, count($this->waypoints)); | ||
| foreach($this->waypoints as $waypoint){ | ||
| $waypoint->write($out); | ||
| } | ||
| } | ||
|
|
||
| public function handle(PacketHandlerInterface $handler) : bool{ | ||
| return $handler->handleLocatorBar($this); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should implement
ClientboundPacket