13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
21 public const NETWORK_ID = ProtocolInfo::CLIENTBOUND_DEBUG_RENDERER_PACKET;
23 public const TYPE_CLEAR = 1;
24 public const TYPE_ADD_CUBE = 2;
35 private int $durationMillis;
37 private static function base(
int $type) :
self{
39 $result->type = $type;
43 public static function clear() :
self{
return self::base(self::TYPE_CLEAR); }
45 public static function addCube(
string $text,
Vector3 $position,
float $red,
float $green,
float $blue,
float $alpha,
int $durationMillis) :
self{
46 $result = self::base(self::TYPE_ADD_CUBE);
47 $result->text = $text;
48 $result->position = $position;
50 $result->green = $green;
51 $result->blue = $blue;
52 $result->alpha = $alpha;
53 $result->durationMillis = $durationMillis;
57 public function getType() :
int{
return $this->type; }
59 public function getText() :
string{
return $this->text; }
61 public function getPosition() :
Vector3{
return $this->position; }
63 public function getRed() :
float{
return $this->red; }
65 public function getGreen() :
float{
return $this->green; }
67 public function getBlue() :
float{
return $this->blue; }
69 public function getAlpha() :
float{
return $this->alpha; }
71 public function getDurationMillis() :
int{
return $this->durationMillis; }
74 $this->type = $in->getLInt();
77 case self::TYPE_CLEAR:
80 case self::TYPE_ADD_CUBE:
87 $this->durationMillis = $in->
getLLong();
95 $out->putLInt($this->type);
98 case self::TYPE_CLEAR:
101 case self::TYPE_ADD_CUBE:
102 $out->putString($this->text);
104 $out->putLFloat($this->red);
105 $out->putLFloat($this->green);
106 $out->putLFloat($this->blue);
107 $out->putLFloat($this->alpha);
108 $out->putLLong($this->durationMillis);
111 throw new \InvalidArgumentException(
"Unknown type " . $this->type);
116 return $handler->handleClientboundDebugRenderer($this);
handle(PacketHandlerInterface $handler)
decodePayload(PacketSerializer $in)
encodePayload(PacketSerializer $out)
putVector3(Vector3 $vector)