PocketMine-MP 5.42.1 git-443151900a14fe9dc682cbf786fa441be1294fab
Loading...
Searching...
No Matches
LocatorBarWaypointPayload.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\types;
16
17use pmmp\encoding\Byte;
18use pmmp\encoding\ByteBufferReader;
19use pmmp\encoding\ByteBufferWriter;
21use Ramsey\Uuid\UuidInterface;
22
27 public function __construct(
28 private UuidInterface $group,
29 private LocatorBarWaypoint $waypoint,
30 private int $action,
31 ){}
32
33 public function getGroup() : UuidInterface{ return $this->group; }
34
35 public function getWaypoint() : LocatorBarWaypoint{ return $this->waypoint; }
36
37 public function getAction() : int{ return $this->action; }
38
39 public static function read(ByteBufferReader $in) : self{
40 $group = CommonTypes::getUUID($in);
41 $waypoint = LocatorBarWaypoint::read($in);
42 $action = Byte::readUnsigned($in);
43
44 return new self(
45 $group,
46 $waypoint,
47 $action
48 );
49 }
50
51 public function write(ByteBufferWriter $out) : void{
52 CommonTypes::putUUID($out, $this->group);
53 $this->waypoint->write($out);
54 Byte::writeUnsigned($out, $this->action);
55 }
56}