PocketMine-MP 5.44.3 git-327e8a1690982f1ac3634944d705ebad5d91f4ad
Loading...
Searching...
No Matches
PrimitiveShapeEllipsoidPayload.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\shape;
16
17use pmmp\encoding\Byte;
18use pmmp\encoding\ByteBufferReader;
19use pmmp\encoding\ByteBufferWriter;
22use pocketmine\network\mcpe\protocol\types\GetTypeIdFromConstTrait;
23
25 use GetTypeIdFromConstTrait;
26
27 public const ID = PrimitiveShapeType::PAYLOAD_TYPE_ELLIPSOID;
28
29 public function __construct(
30 private Vector3 $radii,
31 private int $segmentsPerAxis,
32 ){}
33
34 public function getRadii() : Vector3{ return $this->radii; }
35
36 public function getSegmentsPerAxis() : int{ return $this->segmentsPerAxis; }
37
38 public static function read(ByteBufferReader $in) : self{
39 $radii = CommonTypes::getVector3($in);
40 $segmentsPerAxis = Byte::readUnsigned($in);
41
42 return new self($radii, $segmentsPerAxis);
43 }
44
45 public function write(ByteBufferWriter $out) : void{
46 CommonTypes::putVector3($out, $this->radii);
47 Byte::writeUnsigned($out, $this->segmentsPerAxis);
48 }
49}