32 public function __construct(
33 private int $networkId,
34 private ?ScriptDebugShapeType $type,
36 private ?
float $scale,
38 private ?
float $totalTimeLeft,
39 private ?
Color $color,
40 private ?
string $text,
42 private ?
Vector3 $lineEndLocation,
43 private ?
float $arrowHeadLength,
44 private ?
float $arrowHeadRadius,
45 private ?
int $segments,
48 public static function remove(
int $networkId) :
self{
49 return new self($networkId,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null);
52 public static function line(
int $networkId,
Vector3 $location,
Vector3 $lineEndLocation, ?
Color $color =
null) :
self{
54 networkId: $networkId,
55 type: ScriptDebugShapeType::LINE,
63 lineEndLocation: $lineEndLocation,
64 arrowHeadLength:
null,
65 arrowHeadRadius:
null,
70 public static function box(
int $networkId,
Vector3 $location,
Vector3 $boxBound, ?
float $scale =
null, ?
Color $color =
null) :
self{
72 networkId: $networkId,
73 type: ScriptDebugShapeType::BOX,
81 lineEndLocation:
null,
82 arrowHeadLength:
null,
83 arrowHeadRadius:
null,
88 public static function sphere(
int $networkId,
Vector3 $location, ?
float $scale =
null, ?
Color $color =
null, ?
int $segments =
null) :
self{
90 networkId: $networkId,
91 type: ScriptDebugShapeType::SPHERE,
99 lineEndLocation:
null,
100 arrowHeadLength:
null,
101 arrowHeadRadius:
null,
106 public static function circle(
int $networkId,
Vector3 $location, ?
float $scale =
null, ?
Color $color =
null, ?
int $segments =
null) :
self{
108 networkId: $networkId,
109 type: ScriptDebugShapeType::CIRCLE,
117 lineEndLocation:
null,
118 arrowHeadLength:
null,
119 arrowHeadRadius:
null,
124 public static function text(
int $networkId,
Vector3 $location,
string $text, ?
Color $color =
null) :
self{
126 networkId: $networkId,
127 type: ScriptDebugShapeType::TEXT,
135 lineEndLocation:
null,
136 arrowHeadLength:
null,
137 arrowHeadRadius:
null,
142 public static function arrow(
int $networkId,
Vector3 $location,
Vector3 $lineEndLocation, ?
float $scale =
null, ?
Color $color =
null, ?
float $arrowHeadLength =
null, ?
float $arrowHeadRadius =
null, ?
int $segments =
null) :
self{
144 networkId: $networkId,
145 type: ScriptDebugShapeType::ARROW,
153 lineEndLocation: $lineEndLocation,
154 arrowHeadLength: $arrowHeadLength,
155 arrowHeadRadius: $arrowHeadRadius,
160 public function getNetworkId() :
int{
return $this->networkId; }
162 public function getType() : ?ScriptDebugShapeType{
return $this->type; }
164 public function getLocation() : ?
Vector3{
return $this->location; }
166 public function getScale() : ?
float{
return $this->scale; }
168 public function getRotation() : ?
Vector3{
return $this->rotation; }
170 public function getTotalTimeLeft() : ?
float{
return $this->totalTimeLeft; }
172 public function getColor() : ?
Color{
return $this->color; }
174 public function getText() : ?
string{
return $this->text; }
176 public function getBoxBound() : ?
Vector3{
return $this->boxBound; }
178 public function getLineEndLocation() : ?
Vector3{
return $this->lineEndLocation; }
180 public function getArrowHeadLength() : ?
float{
return $this->arrowHeadLength; }
182 public function getArrowHeadRadius() : ?
float{
return $this->arrowHeadRadius; }
184 public function getSegments() : ?
int{
return $this->segments; }
186 public static function read(ByteBufferReader $in) :
self{
187 $networkId = VarInt::readUnsignedLong($in);
188 $type = CommonTypes::readOptional($in, fn() => ScriptDebugShapeType::fromPacket(Byte::readUnsigned($in)));
189 $location = CommonTypes::readOptional($in, CommonTypes::getVector3(...));
190 $scale = CommonTypes::readOptional($in, LE::readFloat(...));
191 $rotation = CommonTypes::readOptional($in, CommonTypes::getVector3(...));
192 $totalTimeLeft = CommonTypes::readOptional($in, LE::readFloat(...));
193 $color = CommonTypes::readOptional($in, fn() => Color::fromARGB(LE::readUnsignedInt($in)));
194 $text = CommonTypes::readOptional($in, CommonTypes::getString(...));
195 $boxBound = CommonTypes::readOptional($in, CommonTypes::getVector3(...));
196 $lineEndLocation = CommonTypes::readOptional($in, CommonTypes::getVector3(...));
197 $arrowHeadLength = CommonTypes::readOptional($in, LE::readFloat(...));
198 $arrowHeadRadius = CommonTypes::readOptional($in, LE::readFloat(...));
199 $segments = CommonTypes::readOptional($in, Byte::readUnsigned(...));
218 public function write(ByteBufferWriter $out) :
void{
219 VarInt::writeUnsignedLong($out, $this->networkId);
220 CommonTypes::writeOptional($out, $this->type, fn(ByteBufferWriter $out, ScriptDebugShapeType $type) => Byte::writeUnsigned($out, $type->value));
221 CommonTypes::writeOptional($out, $this->location, CommonTypes::putVector3(...));
222 CommonTypes::writeOptional($out, $this->scale, LE::writeFloat(...));
223 CommonTypes::writeOptional($out, $this->rotation, CommonTypes::putVector3(...));
224 CommonTypes::writeOptional($out, $this->totalTimeLeft, LE::writeFloat(...));
225 CommonTypes::writeOptional($out, $this->color, fn(ByteBufferWriter $out,
Color $color) => LE::writeUnsignedInt($out, $color->
toARGB()));
226 CommonTypes::writeOptional($out, $this->text, CommonTypes::putString(...));
227 CommonTypes::writeOptional($out, $this->boxBound, CommonTypes::putVector3(...));
228 CommonTypes::writeOptional($out, $this->lineEndLocation, CommonTypes::putVector3(...));
229 CommonTypes::writeOptional($out, $this->arrowHeadLength, LE::writeFloat(...));
230 CommonTypes::writeOptional($out, $this->arrowHeadRadius, LE::writeFloat(...));
231 CommonTypes::writeOptional($out, $this->segments, Byte::writeUnsigned(...));