Updated composed packets

This commit is contained in:
Shoghi Cervantes
2014-06-30 23:52:33 +02:00
parent d4881260da
commit f5a74a87e3
13 changed files with 58 additions and 209 deletions

View File

@ -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
}
}
}