Merge branch 'pm3-bedrock-1.17.10' into pm4-bedrock-1.17.10

This commit is contained in:
Dylan K. Taylor 2021-07-09 20:02:30 +01:00
commit b07000f613
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
13 changed files with 191 additions and 11 deletions

@ -1 +1 @@
Subproject commit 04c846c5f95a7bb9ae111f699f2ba08c9ec838aa
Subproject commit 21ec07f14e258d10475a714d77cbdcb7284745ec

View File

@ -109,6 +109,7 @@ use pocketmine\network\mcpe\protocol\MultiplayerSettingsPacket;
use pocketmine\network\mcpe\protocol\NetworkChunkPublisherUpdatePacket;
use pocketmine\network\mcpe\protocol\NetworkSettingsPacket;
use pocketmine\network\mcpe\protocol\NetworkStackLatencyPacket;
use pocketmine\network\mcpe\protocol\NpcDialoguePacket;
use pocketmine\network\mcpe\protocol\NpcRequestPacket;
use pocketmine\network\mcpe\protocol\OnScreenTextureAnimationPacket;
use pocketmine\network\mcpe\protocol\PacketHandlerInterface;
@ -166,6 +167,7 @@ use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
use pocketmine\network\mcpe\protocol\ShowProfilePacket;
use pocketmine\network\mcpe\protocol\ShowStoreOfferPacket;
use pocketmine\network\mcpe\protocol\SimpleEventPacket;
use pocketmine\network\mcpe\protocol\SimulationTypePacket;
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
use pocketmine\network\mcpe\protocol\SpawnParticleEffectPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket;
@ -846,4 +848,12 @@ abstract class PacketHandler implements PacketHandlerInterface{
public function handleRemoveVolumeEntity(RemoveVolumeEntityPacket $packet) : bool{
return false;
}
public function handleSimulationType(SimulationTypePacket $packet) : bool{
return false;
}
public function handleNpcDialogue(NpcDialoguePacket $packet) : bool{
return false;
}
}

View File

@ -76,7 +76,8 @@ class ResourcePacksPacketHandler extends PacketHandler{
//TODO: more stuff
return new ResourcePackInfoEntry($pack->getPackId(), $pack->getPackVersion(), $pack->getPackSize(), "", "", "", false);
}, $this->resourcePackManager->getResourceStack());
$this->session->sendDataPacket(ResourcePacksInfoPacket::create($resourcePackEntries, [], $this->resourcePackManager->resourcePacksRequired(), false));
//TODO: support forcing server packs
$this->session->sendDataPacket(ResourcePacksInfoPacket::create($resourcePackEntries, [], $this->resourcePackManager->resourcePacksRequired(), false, false));
$this->session->getLogger()->debug("Waiting for client to accept resource packs");
}

View File

@ -288,7 +288,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
protected function getCommandData(array $enums, array $postfixes, PacketSerializer $in) : CommandData{
$name = $in->getString();
$description = $in->getString();
$flags = $in->getByte();
$flags = $in->getLShort();
$permission = $in->getByte();
$aliases = $enums[$in->getLInt()] ?? null;
$overloads = [];
@ -332,7 +332,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
protected function putCommandData(CommandData $data, array $enumIndexes, array $postfixIndexes, PacketSerializer $out) : void{
$out->putString($data->name);
$out->putString($data->description);
$out->putByte($data->flags);
$out->putLShort($data->flags);
$out->putByte($data->permission);
if($data->aliases !== null){

View File

@ -0,0 +1,87 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class NpcDialoguePacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::NPC_DIALOGUE_PACKET;
public const ACTION_OPEN = 0;
public const ACTION_CLOSE = 1;
private int $npcActorUniqueId;
private int $actionType;
private string $dialogue;
private string $sceneName;
private string $npcName;
private string $actionJson;
public static function create(int $npcActorUniqueId, int $actionType, string $dialogue, string $sceneName, string $npcName, string $actionJson) : self{
$result = new self;
$result->npcActorUniqueId = $npcActorUniqueId;
$result->actionType = $actionType;
$result->dialogue = $dialogue;
$result->sceneName = $sceneName;
$result->npcName = $npcName;
$result->actionJson = $actionJson;
return $result;
}
public function getNpcActorUniqueId() : int{ return $this->npcActorUniqueId; }
public function getActionType() : int{ return $this->actionType; }
public function getDialogue() : string{ return $this->dialogue; }
public function getSceneName() : string{ return $this->sceneName; }
public function getNpcName() : string{ return $this->npcName; }
public function getActionJson() : string{ return $this->actionJson; }
protected function decodePayload(PacketSerializer $in) : void{
$this->npcActorUniqueId = $in->getEntityUniqueId();
$this->actionType = $in->getVarInt();
$this->dialogue = $in->getString();
$this->sceneName = $in->getString();
$this->npcName = $in->getString();
$this->actionJson = $in->getString();
}
protected function encodePayload(PacketSerializer $out) : void{
$out->putEntityUniqueId($this->npcActorUniqueId);
$out->putVarInt($this->actionType);
$out->putString($this->dialogue);
$out->putString($this->sceneName);
$out->putString($this->npcName);
$out->putString($this->actionJson);
}
public function handle(PacketHandlerInterface $handler) : bool{
return $handler->handleNpcDialogue($this);
}
}

View File

@ -36,6 +36,7 @@ class NpcRequestPacket extends DataPacket implements ServerboundPacket{
public const REQUEST_SET_NAME = 3;
public const REQUEST_SET_SKIN = 4;
public const REQUEST_SET_INTERACTION_TEXT = 5;
public const REQUEST_EXECUTE_OPENING_COMMANDS = 6;
/** @var int */
public $entityRuntimeId;
@ -45,12 +46,14 @@ class NpcRequestPacket extends DataPacket implements ServerboundPacket{
public $commandString;
/** @var int */
public $actionType;
public string $sceneName;
protected function decodePayload(PacketSerializer $in) : void{
$this->entityRuntimeId = $in->getEntityRuntimeId();
$this->requestType = $in->getByte();
$this->commandString = $in->getString();
$this->actionType = $in->getByte();
$this->sceneName = $in->getString();
}
protected function encodePayload(PacketSerializer $out) : void{
@ -58,6 +61,7 @@ class NpcRequestPacket extends DataPacket implements ServerboundPacket{
$out->putByte($this->requestType);
$out->putString($this->commandString);
$out->putByte($this->actionType);
$out->putString($this->sceneName);
}
public function handle(PacketHandlerInterface $handler) : bool{

View File

@ -350,4 +350,8 @@ interface PacketHandlerInterface{
public function handleAddVolumeEntity(AddVolumeEntityPacket $packet) : bool;
public function handleRemoveVolumeEntity(RemoveVolumeEntityPacket $packet) : bool;
public function handleSimulationType(SimulationTypePacket $packet) : bool;
public function handleNpcDialogue(NpcDialoguePacket $packet) : bool;
}

View File

@ -205,6 +205,8 @@ class PacketPool{
$this->registerPacket(new SyncActorPropertyPacket());
$this->registerPacket(new AddVolumeEntityPacket());
$this->registerPacket(new RemoveVolumeEntityPacket());
$this->registerPacket(new SimulationTypePacket());
$this->registerPacket(new NpcDialoguePacket());
}
public function registerPacket(Packet $packet) : void{

View File

@ -41,11 +41,11 @@ final class ProtocolInfo{
*/
/** Actual Minecraft: PE protocol version */
public const CURRENT_PROTOCOL = 440;
public const CURRENT_PROTOCOL = 448;
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
public const MINECRAFT_VERSION = 'v1.17.0';
public const MINECRAFT_VERSION = 'v1.17.10';
/** Version number sent to clients in ping responses. */
public const MINECRAFT_VERSION_NETWORK = '1.17.0';
public const MINECRAFT_VERSION_NETWORK = '1.17.10';
public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;
@ -214,5 +214,7 @@ final class ProtocolInfo{
public const SYNC_ACTOR_PROPERTY_PACKET = 0xa5;
public const ADD_VOLUME_ENTITY_PACKET = 0xa6;
public const REMOVE_VOLUME_ENTITY_PACKET = 0xa7;
public const SIMULATION_TYPE_PACKET = 0xa8;
public const NPC_DIALOGUE_PACKET = 0xa9;
}

View File

@ -34,32 +34,37 @@ class ResourcePacksInfoPacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::RESOURCE_PACKS_INFO_PACKET;
/** @var bool */
public $mustAccept = false; //if true, forces client to use selected resource packs
public $mustAccept = false; //if true, forces client to choose between accepting packs or being disconnected
/** @var bool */
public $hasScripts = false; //if true, causes disconnect for any platform that doesn't support scripts yet
public bool $forceServerPacks = false;
/** @var BehaviorPackInfoEntry[] */
public $behaviorPackEntries = [];
/** @var ResourcePackInfoEntry[] */
public $resourcePackEntries = [];
/**
* @param bool $forceServerPacks
* @param ResourcePackInfoEntry[] $resourcePacks
* @param BehaviorPackInfoEntry[] $behaviorPacks
*
* @return ResourcePacksInfoPacket
*/
public static function create(array $resourcePacks, array $behaviorPacks, bool $mustAccept, bool $hasScripts = false) : self{
public static function create(array $resourcePacks, array $behaviorPacks, bool $mustAccept, bool $hasScripts, bool $forceServerPacks) : self{
$result = new self;
$result->mustAccept = $mustAccept;
$result->hasScripts = $hasScripts;
$result->resourcePackEntries = $resourcePacks;
$result->behaviorPackEntries = $behaviorPacks;
$result->forceServerPacks = $forceServerPacks;
return $result;
}
protected function decodePayload(PacketSerializer $in) : void{
$this->mustAccept = $in->getBool();
$this->hasScripts = $in->getBool();
$this->forceServerPacks = $in->getBool();
$behaviorPackCount = $in->getLShort();
while($behaviorPackCount-- > 0){
$this->behaviorPackEntries[] = BehaviorPackInfoEntry::read($in);
@ -74,6 +79,7 @@ class ResourcePacksInfoPacket extends DataPacket implements ClientboundPacket{
protected function encodePayload(PacketSerializer $out) : void{
$out->putBool($this->mustAccept);
$out->putBool($this->hasScripts);
$out->putBool($this->forceServerPacks);
$out->putLShort(count($this->behaviorPackEntries));
foreach($this->behaviorPackEntries as $entry){
$entry->write($out);

View File

@ -50,6 +50,8 @@ class SetTitlePacket extends DataPacket implements ClientboundPacket{
public $stayTime = 0;
/** @var int */
public $fadeOutTime = 0;
public string $xuid = "";
public string $platformOnlineId = "";
protected function decodePayload(PacketSerializer $in) : void{
$this->type = $in->getVarInt();
@ -57,6 +59,8 @@ class SetTitlePacket extends DataPacket implements ClientboundPacket{
$this->fadeInTime = $in->getVarInt();
$this->stayTime = $in->getVarInt();
$this->fadeOutTime = $in->getVarInt();
$this->xuid = $in->getString();
$this->platformOnlineId = $in->getString();
}
protected function encodePayload(PacketSerializer $out) : void{
@ -65,6 +69,8 @@ class SetTitlePacket extends DataPacket implements ClientboundPacket{
$out->putVarInt($this->fadeInTime);
$out->putVarInt($this->stayTime);
$out->putVarInt($this->fadeOutTime);
$out->putString($this->xuid);
$out->putString($this->platformOnlineId);
}
public function handle(PacketHandlerInterface $handler) : bool{

View File

@ -0,0 +1,58 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
class SimulationTypePacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::SIMULATION_TYPE_PACKET;
public const GAME = 0;
public const EDITOR = 1;
public const TEST = 2;
private int $type;
public static function create(int $type) : self{
$result = new self;
$result->type = $type;
return $result;
}
public function getType() : int{ return $this->type; }
protected function decodePayload(PacketSerializer $in) : void{
$this->type = $in->getByte();
}
protected function encodePayload(PacketSerializer $out) : void{
$out->putByte($this->type);
}
public function handle(PacketHandlerInterface $handler) : bool{
return $handler->handleSimulationType($this);
}
}

View File

@ -56,8 +56,8 @@ final class PlayerAuthInputFlags{
public const WANT_DOWN_SLOW = 18;
public const WANT_UP_SLOW = 19;
public const SPRINTING = 20;
public const ASCEND_SCAFFOLDING = 21;
public const DESCEND_SCAFFOLDING = 22;
public const ASCEND_BLOCK = 21;
public const DESCEND_BLOCK = 22;
public const SNEAK_TOGGLE_DOWN = 23;
public const PERSIST_SNEAK = 24;
public const START_SPRINTING = 25;