Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor
2019-10-20 21:25:39 +01:00
13 changed files with 177 additions and 11 deletions

View File

@@ -39,9 +39,9 @@ class BossEventPacket extends DataPacket implements ClientboundPacket, Serverbou
public const TYPE_HIDE = 2;
/* C2S: Unregisters a player from a boss fight. */
public const TYPE_UNREGISTER_PLAYER = 3;
/* S2C: Appears not to be implemented. Currently bar percentage only appears to change in response to the target entity's health. */
/* S2C: Sets the bar percentage. */
public const TYPE_HEALTH_PERCENT = 4;
/* S2C: Also appears to not be implemented. Title client-side sticks as the target entity's nametag, or their entity type name if not set. */
/* S2C: Sets title of the bar. */
public const TYPE_TITLE = 5;
/* S2C: Not sure on this. Includes color and overlay fields, plus an unknown short. TODO: check this */
public const TYPE_UNKNOWN_6 = 6;

View File

@@ -43,6 +43,11 @@ class EventPacket extends DataPacket implements ClientboundPacket{
public const TYPE_PATTERN_REMOVED = 10; //???
public const TYPE_COMMANED_EXECUTED = 11;
public const TYPE_FISH_BUCKETED = 12;
public const TYPE_MOB_BORN = 13;
public const TYPE_PET_DIED = 14;
public const TYPE_CAULDRON_BLOCK_USED = 15;
public const TYPE_COMPOSTER_BLOCK_USED = 16;
public const TYPE_BELL_BLOCK_USED = 17;
/** @var int */
public $playerRuntimeId;

View File

@@ -26,16 +26,39 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\handler\PacketHandler;
use pocketmine\network\mcpe\protocol\types\StructureSettings;
class StructureTemplateDataExportRequestPacket extends DataPacket implements ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_EXPORT_REQUEST_PACKET;
public const TYPE_ALWAYS_LOAD = 1;
public const TYPE_CREATE_AND_LOAD = 2;
/** @var string */
public $structureTemplateName;
/** @var int */
public $structureBlockX;
/** @var int */
public $structureBlockY;
/** @var int */
public $structureBlockZ;
/** @var StructureSettings */
public $structureSettings;
/** @var int */
public $structureTemplateResponseType;
protected function decodePayload() : void{
//TODO
$this->structureTemplateName = $this->getString();
$this->getBlockPosition($this->structureBlockX, $this->structureBlockY, $this->structureBlockZ);
$this->structureSettings = $this->getStructureSettings();
$this->structureTemplateResponseType = $this->getByte();
}
protected function encodePayload() : void{
//TODO
$this->putString($this->structureTemplateName);
$this->putBlockPosition($this->structureBlockX, $this->structureBlockY, $this->structureBlockZ);
$this->putStructureSettings($this->structureSettings);
$this->putByte($this->structureTemplateResponseType);
}
public function handle(PacketHandler $handler) : bool{

View File

@@ -30,12 +30,24 @@ use pocketmine\network\mcpe\handler\PacketHandler;
class StructureTemplateDataExportResponsePacket extends DataPacket implements ClientboundPacket{
public const NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_EXPORT_RESPONSE_PACKET;
/** @var string */
public $structureTemplateName;
/** @var string|null */
public $namedtag;
protected function decodePayload() : void{
//TODO
$this->structureTemplateName = $this->getString();
if($this->getBool()){
$this->namedtag = $this->getRemaining();
}
}
protected function encodePayload() : void{
//TODO
$this->putString($this->structureTemplateName);
$this->putBool($this->namedtag !== null);
if($this->namedtag !== null){
$this->put($this->namedtag);
}
}
public function handle(PacketHandler $handler) : bool{

View File

@@ -0,0 +1,55 @@
<?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\types;
class StructureSettings{
/** @var string */
public $paletteName;
/** @var bool */
public $ignoreEntities;
/** @var bool */
public $ignoreBlocks;
/** @var int */
public $structureSizeX;
/** @var int */
public $structureSizeY;
/** @var int */
public $structureSizeZ;
/** @var int */
public $structureOffsetX;
/** @var int */
public $structureOffsetY;
/** @var int */
public $structureOffsetZ;
/** @var int */
public $lastTouchedByPlayerID;
/** @var int */
public $rotation;
/** @var int */
public $mirror;
/** @var float */
public $integrityValue;
/** @var int */
public $integritySeed;
}

View File

@@ -48,6 +48,7 @@ use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\ShortMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\StringMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\Vec3MetadataProperty;
use pocketmine\network\mcpe\protocol\types\StructureSettings;
use pocketmine\utils\BinaryDataException;
use pocketmine\utils\BinaryStream;
use pocketmine\utils\UUID;
@@ -599,4 +600,40 @@ class NetworkBinaryStream extends BinaryStream{
$this->putVarLong($data->varlong1);
}
}
protected function getStructureSettings() : StructureSettings{
$result = new StructureSettings();
$result->paletteName = $this->getString();
$result->ignoreEntities = $this->getBool();
$result->ignoreBlocks = $this->getBool();
$this->getBlockPosition($result->structureSizeX, $result->structureSizeY, $result->structureSizeZ);
$this->getBlockPosition($result->structureOffsetX, $result->structureOffsetY, $result->structureOffsetZ);
$result->lastTouchedByPlayerID = $this->getEntityUniqueId();
$result->rotation = $this->getByte();
$result->mirror = $this->getByte();
$result->integrityValue = $this->getFloat();
$result->integritySeed = $this->getInt();
return $result;
}
protected function putStructureSettings(StructureSettings $structureSettings) : void{
$this->putString($structureSettings->paletteName);
$this->putBool($structureSettings->ignoreEntities);
$this->putBool($structureSettings->ignoreBlocks);
$this->putBlockPosition($structureSettings->structureSizeX, $structureSettings->structureSizeY, $structureSettings->structureSizeZ);
$this->putBlockPosition($structureSettings->structureOffsetX, $structureSettings->structureOffsetY, $structureSettings->structureOffsetZ);
$this->putEntityUniqueId($structureSettings->lastTouchedByPlayerID);
$this->putByte($structureSettings->rotation);
$this->putByte($structureSettings->mirror);
$this->putFloat($structureSettings->integrityValue);
$this->putInt($structureSettings->integritySeed);
}
}