mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Spawn unleashed, movement fixed and some Player DataProperty cleanup
This commit is contained in:
@ -27,32 +27,33 @@ namespace pocketmine\network\protocol;
|
||||
class MoveEntityPacket extends DataPacket{
|
||||
const NETWORK_ID = Info::MOVE_ENTITY_PACKET;
|
||||
|
||||
|
||||
// eid, x, y, z, yaw, pitch
|
||||
/** @var array[] */
|
||||
public $entities = [];
|
||||
|
||||
public function clean(){
|
||||
$this->entities = [];
|
||||
return parent::clean();
|
||||
}
|
||||
public $eid;
|
||||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
public $yaw;
|
||||
public $headYaw;
|
||||
public $pitch;
|
||||
|
||||
public function decode(){
|
||||
|
||||
$this->eid = $this->getLong();
|
||||
$this->x = $this->getFloat();
|
||||
$this->y = $this->getFloat();
|
||||
$this->z = $this->getFloat();
|
||||
$this->pitch = $this->getByte()*(360.0/256);
|
||||
$this->yaw = $this->getByte()*(360.0/256);
|
||||
$this->headYaw = $this->getByte()*(360.0/256);
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt(count($this->entities));
|
||||
foreach($this->entities as $d){
|
||||
$this->putLong($d[0]); //eid
|
||||
$this->putFloat($d[1]); //x
|
||||
$this->putFloat($d[2]); //y
|
||||
$this->putFloat($d[3]); //z
|
||||
$this->putFloat($d[4]); //yaw
|
||||
$this->putFloat($d[5]); //headYaw
|
||||
$this->putFloat($d[6]); //pitch
|
||||
}
|
||||
$this->putLong($this->eid);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
$this->putByte($this->pitch/(360.0/256));
|
||||
$this->putByte($this->yaw/(360.0/256));
|
||||
$this->putByte($this->headYaw/(360.0/256));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user