26 use GetTypeIdFromConstTrait;
28 public const ID = PrimitiveShapeType::PAYLOAD_TYPE_CYLINDER;
30 public function __construct(
33 private float $height,
34 private int $segments,
37 public function getRadiusX() :
Vector2{
return $this->radiusX; }
39 public function getRadiusZ() :
Vector2{
return $this->radiusZ; }
41 public function getHeight() :
float{
return $this->height; }
43 public function getSegments() :
int{
return $this->segments; }
45 public static function read(ByteBufferReader $in) :
self{
46 $radiusX = CommonTypes::getVector2($in);
47 $radiusZ = CommonTypes::getVector2($in);
48 $height = LE::readFloat($in);
49 $segments = Byte::readUnsigned($in);
51 return new self($radiusX, $radiusZ, $height, $segments);
54 public function write(ByteBufferWriter $out) :
void{
55 CommonTypes::putVector2($out, $this->radiusX);
56 CommonTypes::putVector2($out, $this->radiusZ);
57 LE::writeFloat($out, $this->height);
58 Byte::writeUnsigned($out, $this->segments);