mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Updated composed packets
This commit is contained in:
@ -23,10 +23,10 @@ namespace pocketmine\network\protocol;
|
||||
|
||||
|
||||
class SetEntityMotionPacket extends DataPacket{
|
||||
public $eid;
|
||||
public $speedX;
|
||||
public $speedY;
|
||||
public $speedZ;
|
||||
|
||||
// eid, motX, motY, motZ
|
||||
/** @var array[] */
|
||||
public $entities = [];
|
||||
|
||||
public function pid(){
|
||||
return Info::SET_ENTITY_MOTION_PACKET;
|
||||
@ -38,10 +38,13 @@ class SetEntityMotionPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putShort((int) ($this->speedX * 400));
|
||||
$this->putShort((int) ($this->speedY * 400));
|
||||
$this->putShort((int) ($this->speedZ * 400));
|
||||
$this->putInt(count($this->entities));
|
||||
foreach($this->entities as $d){
|
||||
$this->putInt($d[0]); //eid
|
||||
$this->putShort((int) ($d[1] * 400)); //motX
|
||||
$this->putShort((int) ($d[2] * 400)); //motY
|
||||
$this->putShort((int) ($d[3] * 400)); //motZ
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user