mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 02:09:42 +00:00
fixed #992
This commit is contained in:
parent
138fb88431
commit
2b02fcfe2c
@ -355,4 +355,12 @@ abstract class DataPacket extends BinaryStream{
|
||||
$this->putLFloat($y);
|
||||
$this->putLFloat($z);
|
||||
}
|
||||
|
||||
public function getByteRotation() : float{
|
||||
return (float) ($this->getByte() * (360 / 256));
|
||||
}
|
||||
|
||||
public function putByteRotation(float $rotation){
|
||||
$this->putByte((int) ($rotation / (360 / 256)));
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class MobEquipmentPacket extends DataPacket{
|
||||
public $item;
|
||||
public $inventorySlot;
|
||||
public $hotbarSlot;
|
||||
public $unknownByte;
|
||||
public $unknownByte = 0;
|
||||
|
||||
public function decode(){
|
||||
$this->eid = $this->getEntityRuntimeId();
|
||||
|
@ -42,9 +42,9 @@ class MoveEntityPacket extends DataPacket{
|
||||
public function decode(){
|
||||
$this->eid = $this->getEntityRuntimeId();
|
||||
$this->getVector3f($this->x, $this->y, $this->z);
|
||||
$this->pitch = $this->getByte() * (360.0 / 256);
|
||||
$this->headYaw = $this->getByte() * (360.0 / 256);
|
||||
$this->yaw = $this->getByte() * (360.0 / 256);
|
||||
$this->pitch = $this->getByteRotation();
|
||||
$this->headYaw = $this->getByteRotation();
|
||||
$this->yaw = $this->getByteRotation();
|
||||
$this->onGround = $this->getBool();
|
||||
$this->teleported = $this->getBool();
|
||||
}
|
||||
@ -53,9 +53,9 @@ class MoveEntityPacket extends DataPacket{
|
||||
$this->reset();
|
||||
$this->putEntityRuntimeId($this->eid);
|
||||
$this->putVector3f($this->x, $this->y, $this->z);
|
||||
$this->putByte($this->pitch / (360.0 / 256));
|
||||
$this->putByte($this->headYaw / (360.0 / 256));
|
||||
$this->putByte($this->yaw / (360.0 / 256));
|
||||
$this->putByteRotation($this->pitch);
|
||||
$this->putByteRotation($this->headYaw);
|
||||
$this->putByteRotation($this->yaw);
|
||||
$this->putBool($this->onGround);
|
||||
$this->putBool($this->teleported);
|
||||
}
|
||||
|
@ -178,11 +178,11 @@ class BinaryStream{
|
||||
$this->buffer .= Binary::writeLTriad($v);
|
||||
}
|
||||
|
||||
public function getByte(){
|
||||
public function getByte() : int{
|
||||
return ord($this->buffer{$this->offset++});
|
||||
}
|
||||
|
||||
public function putByte($v){
|
||||
public function putByte(int $v){
|
||||
$this->buffer .= chr($v);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user