diff --git a/src/pocketmine/network/mcpe/NetworkSession.php b/src/pocketmine/network/mcpe/NetworkSession.php index a3bfb13b7..f79df6c77 100644 --- a/src/pocketmine/network/mcpe/NetworkSession.php +++ b/src/pocketmine/network/mcpe/NetworkSession.php @@ -110,6 +110,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\PacketViolationWarningPacket; @@ -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; @@ -841,4 +843,12 @@ abstract class NetworkSession{ public function handleRemoveVolumeEntity(RemoveVolumeEntityPacket $packet) : bool{ return false; } + + public function handleSimulationType(SimulationTypePacket $packet) : bool{ + return false; + } + + public function handleNpcDialogue(NpcDialoguePacket $packet) : bool{ + return false; + } } diff --git a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php index eea350ece..e47f713f8 100644 --- a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php @@ -281,7 +281,7 @@ class AvailableCommandsPacket extends DataPacket{ $retval = new CommandData(); $retval->commandName = $this->getString(); $retval->commandDescription = $this->getString(); - $retval->flags = $this->getByte(); + $retval->flags = $this->getLShort(); $retval->permission = $this->getByte(); $retval->aliases = $enums[$this->getLInt()] ?? null; @@ -324,7 +324,7 @@ class AvailableCommandsPacket extends DataPacket{ protected function putCommandData(CommandData $data, array $enumIndexes, array $postfixIndexes) : void{ $this->putString($data->commandName); $this->putString($data->commandDescription); - $this->putByte($data->flags); + $this->putLShort($data->flags); $this->putByte($data->permission); if($data->aliases !== null){ diff --git a/src/pocketmine/network/mcpe/protocol/NpcDialoguePacket.php b/src/pocketmine/network/mcpe/protocol/NpcDialoguePacket.php new file mode 100644 index 000000000..7e2f88476 --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/NpcDialoguePacket.php @@ -0,0 +1,87 @@ + + +use pocketmine\network\mcpe\NetworkSession; + +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() : void{ + $this->npcActorUniqueId = $this->getEntityUniqueId(); + $this->actionType = $this->getVarInt(); + $this->dialogue = $this->getString(); + $this->sceneName = $this->getString(); + $this->npcName = $this->getString(); + $this->actionJson = $this->getString(); + } + + protected function encodePayload() : void{ + $this->putEntityUniqueId($this->npcActorUniqueId); + $this->putVarInt($this->actionType); + $this->putString($this->dialogue); + $this->putString($this->sceneName); + $this->putString($this->npcName); + $this->putString($this->actionJson); + } + + public function handle(NetworkSession $handler) : bool{ + return $handler->handleNpcDialogue($this); + } +} diff --git a/src/pocketmine/network/mcpe/protocol/NpcRequestPacket.php b/src/pocketmine/network/mcpe/protocol/NpcRequestPacket.php index 5f9f492a6..b8def7d14 100644 --- a/src/pocketmine/network/mcpe/protocol/NpcRequestPacket.php +++ b/src/pocketmine/network/mcpe/protocol/NpcRequestPacket.php @@ -36,6 +36,7 @@ class NpcRequestPacket extends DataPacket{ 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{ public $commandString; /** @var int */ public $actionType; + public string $sceneName; protected function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->requestType = $this->getByte(); $this->commandString = $this->getString(); $this->actionType = $this->getByte(); + $this->sceneName = $this->getString(); } protected function encodePayload(){ @@ -58,6 +61,7 @@ class NpcRequestPacket extends DataPacket{ $this->putByte($this->requestType); $this->putString($this->commandString); $this->putByte($this->actionType); + $this->putString($this->sceneName); } public function handle(NetworkSession $session) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/PacketPool.php b/src/pocketmine/network/mcpe/protocol/PacketPool.php index 83e6531de..3d6db709d 100644 --- a/src/pocketmine/network/mcpe/protocol/PacketPool.php +++ b/src/pocketmine/network/mcpe/protocol/PacketPool.php @@ -198,6 +198,8 @@ class PacketPool{ static::registerPacket(new SyncActorPropertyPacket()); static::registerPacket(new AddVolumeEntityPacket()); static::registerPacket(new RemoveVolumeEntityPacket()); + static::registerPacket(new SimulationTypePacket()); + static::registerPacket(new NpcDialoguePacket()); } /** diff --git a/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php b/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php index 2793c0ab2..c582f874f 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 = 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; @@ -210,5 +210,7 @@ interface 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; } diff --git a/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php b/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php index 714382dea..c795dd7ba 100644 --- a/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php +++ b/src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php @@ -33,9 +33,11 @@ class ResourcePacksInfoPacket extends DataPacket{ 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 ResourcePack[] */ public $behaviorPackEntries = []; /** @var ResourcePack[] */ @@ -44,6 +46,7 @@ class ResourcePacksInfoPacket extends DataPacket{ protected function decodePayload(){ $this->mustAccept = $this->getBool(); $this->hasScripts = $this->getBool(); + $this->forceServerPacks = $this->getBool(); $behaviorPackCount = $this->getLShort(); while($behaviorPackCount-- > 0){ $this->getString(); @@ -71,6 +74,7 @@ class ResourcePacksInfoPacket extends DataPacket{ protected function encodePayload(){ $this->putBool($this->mustAccept); $this->putBool($this->hasScripts); + $this->putBool($this->forceServerPacks); $this->putLShort(count($this->behaviorPackEntries)); foreach($this->behaviorPackEntries as $entry){ $this->putString($entry->getPackId()); diff --git a/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php b/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php index 3c3b89f7e..b179caabe 100644 --- a/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php +++ b/src/pocketmine/network/mcpe/protocol/SetTitlePacket.php @@ -50,6 +50,8 @@ class SetTitlePacket extends DataPacket{ public $stayTime = 0; /** @var int */ public $fadeOutTime = 0; + public string $xuid = ""; + public string $platformOnlineId = ""; protected function decodePayload(){ $this->type = $this->getVarInt(); @@ -57,6 +59,8 @@ class SetTitlePacket extends DataPacket{ $this->fadeInTime = $this->getVarInt(); $this->stayTime = $this->getVarInt(); $this->fadeOutTime = $this->getVarInt(); + $this->xuid = $this->getString(); + $this->platformOnlineId = $this->getString(); } protected function encodePayload(){ @@ -65,6 +69,8 @@ class SetTitlePacket extends DataPacket{ $this->putVarInt($this->fadeInTime); $this->putVarInt($this->stayTime); $this->putVarInt($this->fadeOutTime); + $this->putString($this->xuid); + $this->putString($this->platformOnlineId); } public function handle(NetworkSession $session) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/SimulationTypePacket.php b/src/pocketmine/network/mcpe/protocol/SimulationTypePacket.php new file mode 100644 index 000000000..86c5121bb --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/SimulationTypePacket.php @@ -0,0 +1,58 @@ + + +use pocketmine\network\mcpe\NetworkSession; + +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() : void{ + $this->type = $this->getByte(); + } + + protected function encodePayload() : void{ + $this->putByte($this->type); + } + + public function handle(NetworkSession $handler) : bool{ + return $handler->handleSimulationType($this); + } +} diff --git a/src/pocketmine/network/mcpe/protocol/types/PlayerAuthInputFlags.php b/src/pocketmine/network/mcpe/protocol/types/PlayerAuthInputFlags.php index 83104c88e..51d8557ca 100644 --- a/src/pocketmine/network/mcpe/protocol/types/PlayerAuthInputFlags.php +++ b/src/pocketmine/network/mcpe/protocol/types/PlayerAuthInputFlags.php @@ -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; diff --git a/src/pocketmine/resources/vanilla b/src/pocketmine/resources/vanilla index 04c846c5f..21ec07f14 160000 --- a/src/pocketmine/resources/vanilla +++ b/src/pocketmine/resources/vanilla @@ -1 +1 @@ -Subproject commit 04c846c5f95a7bb9ae111f699f2ba08c9ec838aa +Subproject commit 21ec07f14e258d10475a714d77cbdcb7284745ec