Merge branch 'pm4-bedrock-1.17.10'

This commit is contained in:
Dylan K. Taylor 2021-07-13 18:04:24 +01:00
commit a182b36b71
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
14 changed files with 264 additions and 83 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

@ -36,77 +36,78 @@ final class ParticleIds{
public const EXPLODE = 6;
public const EVAPORATION = 7;
public const FLAME = 8;
public const LAVA = 9;
public const LARGE_SMOKE = 10;
public const REDSTONE = 11;
public const RISING_RED_DUST = 12;
public const ITEM_BREAK = 13;
public const SNOWBALL_POOF = 14;
public const HUGE_EXPLODE = 15;
public const HUGE_EXPLODE_SEED = 16;
public const MOB_FLAME = 17;
public const HEART = 18;
public const TERRAIN = 19;
public const SUSPENDED_TOWN = 20, TOWN_AURA = 20;
public const PORTAL = 21;
//22 same as 21
public const SPLASH = 23, WATER_SPLASH = 23;
public const WATER_SPLASH_MANUAL = 24;
public const WATER_WAKE = 25;
public const DRIP_WATER = 26;
public const DRIP_LAVA = 27;
public const DRIP_HONEY = 28;
public const STALACTITE_DRIP_WATER = 29;
public const STALACTITE_DRIP_LAVA = 30;
public const FALLING_DUST = 31, DUST = 31;
public const MOB_SPELL = 32;
public const MOB_SPELL_AMBIENT = 33;
public const MOB_SPELL_INSTANTANEOUS = 34;
public const INK = 35;
public const SLIME = 36;
public const RAIN_SPLASH = 37;
public const VILLAGER_ANGRY = 38;
public const VILLAGER_HAPPY = 39;
public const ENCHANTMENT_TABLE = 40;
public const TRACKING_EMITTER = 41;
public const NOTE = 42;
public const WITCH_SPELL = 43;
public const CARROT = 44;
public const MOB_APPEARANCE = 45;
public const END_ROD = 46;
public const DRAGONS_BREATH = 47;
public const SPIT = 48;
public const TOTEM = 49;
public const FOOD = 50;
public const FIREWORKS_STARTER = 51;
public const FIREWORKS_SPARK = 52;
public const FIREWORKS_OVERLAY = 53;
public const BALLOON_GAS = 54;
public const COLORED_FLAME = 55;
public const SPARKLER = 56;
public const CONDUIT = 57;
public const BUBBLE_COLUMN_UP = 58;
public const BUBBLE_COLUMN_DOWN = 59;
public const SNEEZE = 60;
public const SHULKER_BULLET = 61;
public const BLEACH = 62;
public const DRAGON_DESTROY_BLOCK = 63;
public const MYCELIUM_DUST = 64;
public const FALLING_RED_DUST = 65;
public const CAMPFIRE_SMOKE = 66;
public const TALL_CAMPFIRE_SMOKE = 67;
public const DRAGON_BREATH_FIRE = 68;
public const DRAGON_BREATH_TRAIL = 69;
public const BLUE_FLAME = 70;
public const SOUL = 71;
public const OBSIDIAN_TEAR = 72;
public const PORTAL_REVERSE = 73;
public const SNOWFLAKE = 74;
public const VIBRATION_SIGNAL = 75;
public const SCULK_SENSOR_REDSTONE = 76;
public const SPORE_BLOSSOM_SHOWER = 77;
public const SPORE_BLOSSOM_AMBIENT = 78;
public const WAX = 79;
public const ELECTRIC_SPARK = 80;
public const CANDLE_FLAME = 9;
public const LAVA = 10;
public const LARGE_SMOKE = 11;
public const REDSTONE = 12;
public const RISING_RED_DUST = 13;
public const ITEM_BREAK = 14;
public const SNOWBALL_POOF = 15;
public const HUGE_EXPLODE = 16;
public const HUGE_EXPLODE_SEED = 17;
public const MOB_FLAME = 18;
public const HEART = 19;
public const TERRAIN = 20;
public const SUSPENDED_TOWN = 21, TOWN_AURA = 21;
public const PORTAL = 22;
//23 same as 22
public const SPLASH = 24, WATER_SPLASH = 24;
public const WATER_SPLASH_MANUAL = 25;
public const WATER_WAKE = 26;
public const DRIP_WATER = 27;
public const DRIP_LAVA = 28;
public const DRIP_HONEY = 29;
public const STALACTITE_DRIP_WATER = 30;
public const STALACTITE_DRIP_LAVA = 31;
public const FALLING_DUST = 32, DUST = 32;
public const MOB_SPELL = 33;
public const MOB_SPELL_AMBIENT = 34;
public const MOB_SPELL_INSTANTANEOUS = 35;
public const INK = 36;
public const SLIME = 37;
public const RAIN_SPLASH = 38;
public const VILLAGER_ANGRY = 39;
public const VILLAGER_HAPPY = 40;
public const ENCHANTMENT_TABLE = 41;
public const TRACKING_EMITTER = 42;
public const NOTE = 43;
public const WITCH_SPELL = 44;
public const CARROT = 45;
public const MOB_APPEARANCE = 46;
public const END_ROD = 47;
public const DRAGONS_BREATH = 48;
public const SPIT = 49;
public const TOTEM = 50;
public const FOOD = 51;
public const FIREWORKS_STARTER = 52;
public const FIREWORKS_SPARK = 53;
public const FIREWORKS_OVERLAY = 54;
public const BALLOON_GAS = 55;
public const COLORED_FLAME = 56;
public const SPARKLER = 57;
public const CONDUIT = 58;
public const BUBBLE_COLUMN_UP = 59;
public const BUBBLE_COLUMN_DOWN = 60;
public const SNEEZE = 61;
public const SHULKER_BULLET = 62;
public const BLEACH = 63;
public const DRAGON_DESTROY_BLOCK = 64;
public const MYCELIUM_DUST = 65;
public const FALLING_RED_DUST = 66;
public const CAMPFIRE_SMOKE = 67;
public const TALL_CAMPFIRE_SMOKE = 68;
public const DRAGON_BREATH_FIRE = 69;
public const DRAGON_BREATH_TRAIL = 70;
public const BLUE_FLAME = 71;
public const SOUL = 72;
public const OBSIDIAN_TEAR = 73;
public const PORTAL_REVERSE = 74;
public const SNOWFLAKE = 75;
public const VIBRATION_SIGNAL = 76;
public const SCULK_SENSOR_REDSTONE = 77;
public const SPORE_BLOSSOM_SHOWER = 78;
public const SPORE_BLOSSOM_AMBIENT = 79;
public const WAX = 80;
public const ELECTRIC_SPARK = 81;
}

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;