21 public const NETWORK_ID = ProtocolInfo::MOVEMENT_PREDICTION_SYNC_PACKET;
27 private float $height;
29 private float $movementSpeed;
30 private float $underwaterMovementSpeed;
31 private float $lavaMovementSpeed;
32 private float $jumpStrength;
33 private float $health;
34 private float $hunger;
36 private int $actorUniqueId;
41 private static function internalCreate(
47 float $underwaterMovementSpeed,
48 float $lavaMovementSpeed,
55 $result->flags = $flags;
56 $result->scale = $scale;
57 $result->width = $width;
58 $result->height = $height;
59 $result->movementSpeed = $movementSpeed;
60 $result->underwaterMovementSpeed = $underwaterMovementSpeed;
61 $result->lavaMovementSpeed = $lavaMovementSpeed;
62 $result->jumpStrength = $jumpStrength;
63 $result->health = $health;
64 $result->hunger = $hunger;
65 $result->actorUniqueId = $actorUniqueId;
69 public static function create(
75 float $underwaterMovementSpeed,
76 float $lavaMovementSpeed,
82 if($flags->getLength() !== 120){
83 throw new \InvalidArgumentException(
"Input flags must be 120 bits long");
86 return self::internalCreate($flags, $scale, $width, $height, $movementSpeed, $underwaterMovementSpeed, $lavaMovementSpeed, $jumpStrength, $health, $hunger, $actorUniqueId);
89 public function getFlags() :
BitSet{
return $this->flags; }
91 public function getScale() :
float{
return $this->scale; }
93 public function getWidth() :
float{
return $this->width; }
95 public function getHeight() :
float{
return $this->height; }
97 public function getMovementSpeed() :
float{
return $this->movementSpeed; }
99 public function getUnderwaterMovementSpeed() :
float{
return $this->underwaterMovementSpeed; }
101 public function getLavaMovementSpeed() :
float{
return $this->lavaMovementSpeed; }
103 public function getJumpStrength() :
float{
return $this->jumpStrength; }
105 public function getHealth() :
float{
return $this->health; }
107 public function getHunger() :
float{
return $this->hunger; }
109 public function getActorUniqueId() :
int{
return $this->actorUniqueId; }
112 $this->flags =
BitSet::read($in, 120);
117 $this->underwaterMovementSpeed = $in->
getLFloat();
118 $this->lavaMovementSpeed = $in->
getLFloat();
126 $this->flags->write($out);
127 $out->putLFloat($this->scale);
128 $out->putLFloat($this->width);
129 $out->putLFloat($this->height);
130 $out->putLFloat($this->movementSpeed);
131 $out->putLFloat($this->underwaterMovementSpeed);
132 $out->putLFloat($this->lavaMovementSpeed);
133 $out->putLFloat($this->jumpStrength);
134 $out->putLFloat($this->health);
135 $out->putLFloat($this->hunger);
136 $out->putActorUniqueId($this->actorUniqueId);
140 return $handler->handleMovementPredictionSync($this);