PocketMine-MP 5.18.1 git-9381fc4172e5dce4cada1cb356050c8a2ab57b94
CreatePhotoPacket.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol;
16
18
20 public const NETWORK_ID = ProtocolInfo::CREATE_PHOTO_PACKET;
21
22 private int $actorUniqueId;
23 private string $photoName;
24 private string $photoItemName;
25
29 public static function create(int $actorUniqueId, string $photoName, string $photoItemName) : self{
30 $result = new self;
31 $result->actorUniqueId = $actorUniqueId;
32 $result->photoName = $photoName;
33 $result->photoItemName = $photoItemName;
34 return $result;
35 }
36
37 public function getActorUniqueId() : int{ return $this->actorUniqueId; }
38
39 public function getPhotoName() : string{ return $this->photoName; }
40
41 public function getPhotoItemName() : string{ return $this->photoItemName; }
42
43 protected function decodePayload(PacketSerializer $in) : void{
44 $this->actorUniqueId = $in->getLLong(); //why be consistent mojang ?????
45 $this->photoName = $in->getString();
46 $this->photoItemName = $in->getString();
47 }
48
49 protected function encodePayload(PacketSerializer $out) : void{
50 $out->putLLong($this->actorUniqueId);
51 $out->putString($this->photoName);
52 $out->putString($this->photoItemName);
53 }
54
55 public function handle(PacketHandlerInterface $handler) : bool{
56 return $handler->handleCreatePhoto($this);
57 }
58}
static create(int $actorUniqueId, string $photoName, string $photoItemName)