mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Added encode/decode for StructureTemplateDataExport(Request|Response)Packet (#3145)
This commit is contained in:
@ -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{
|
||||
|
@ -30,12 +30,24 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class StructureTemplateDataExportResponsePacket extends DataPacket{
|
||||
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(NetworkSession $handler) : bool{
|
||||
|
@ -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;
|
||||
}
|
Reference in New Issue
Block a user