use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\protocol\types\StructureSettings; class StructureTemplateDataRequestPacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::STRUCTURE_TEMPLATE_DATA_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{ $this->structureTemplateName = $this->getString(); $this->getBlockPosition($this->structureBlockX, $this->structureBlockY, $this->structureBlockZ); $this->structureSettings = $this->getStructureSettings(); $this->structureTemplateResponseType = $this->getByte(); } protected function encodePayload() : void{ $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{ return $handler->handleStructureTemplateDataRequest($this); } }