23 public function __construct(
28 self::clampOffset($this->xOffset);
29 self::clampOffset($this->yOffset);
30 self::clampOffset($this->zOffset);
33 private static function clampOffset(
int $v) :
void{
34 if($v < Limits::INT8_MIN || $v > Limits::INT8_MAX){
35 throw new \InvalidArgumentException(
"Offsets must be within the range of a byte (" . Limits::INT8_MIN .
" ... " . Limits::INT8_MAX .
")");
39 public function getXOffset() :
int{
return $this->xOffset; }
41 public function getYOffset() :
int{
return $this->yOffset; }
43 public function getZOffset() :
int{
return $this->zOffset; }
46 $xOffset = Binary::signByte($in->
getByte());
47 $yOffset = Binary::signByte($in->
getByte());
48 $zOffset = Binary::signByte($in->
getByte());
50 return new self($xOffset, $yOffset, $zOffset);
54 $out->putByte($this->xOffset);
55 $out->putByte($this->yOffset);
56 $out->putByte($this->zOffset);