PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
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)