mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Protocol changes for 1.17.10
This commit is contained in:
parent
1122131c8d
commit
8b79253d3b
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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){
|
||||
|
87
src/pocketmine/network/mcpe/protocol/NpcDialoguePacket.php
Normal file
87
src/pocketmine/network/mcpe/protocol/NpcDialoguePacket.php
Normal 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\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);
|
||||
}
|
||||
}
|
@ -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{
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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{
|
||||
|
@ -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\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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 04c846c5f95a7bb9ae111f699f2ba08c9ec838aa
|
||||
Subproject commit 21ec07f14e258d10475a714d77cbdcb7284745ec
|
Loading…
x
Reference in New Issue
Block a user