Added encode/decode for StructureTemplateDataExport(Request|Response)Packet (#3145)

This commit is contained in:
Ivan
2019-10-14 17:14:42 +07:00
committed by Dylan T
parent 13994055d9
commit aeeee5eb53
4 changed files with 131 additions and 4 deletions

View File

@ -26,16 +26,39 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\StructureSettings;
class StructureTemplateDataExportRequestPacket extends DataPacket{
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(NetworkSession $handler) : bool{