Less protocol madness

This commit is contained in:
Shoghi Cervantes 2015-03-16 12:13:52 +01:00
parent 4ec584d800
commit 29ca349b3d
5 changed files with 20 additions and 22 deletions

View File

@ -230,14 +230,12 @@ class Item extends Entity{
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->roll = 0;
$pk->speedX = $this->motionX;
$pk->speedY = $this->motionY;
$pk->speedZ = $this->motionZ;
$pk->item = $this->getItem();
$player->dataPacket($pk);
$player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
parent::spawnTo($player);
}
}

View File

@ -55,9 +55,9 @@ class AddEntityPacket extends DataPacket{
$this->putFloat($this->z);
$this->putLong($this->did);
if($this->did > 0){
$this->putShort($this->speedX * 8000);
$this->putShort($this->speedY * 8000);
$this->putShort($this->speedZ * 8000);
$this->putFloat($this->speedX);
$this->putFloat($this->speedY);
$this->putFloat($this->speedZ);
}
}

View File

@ -33,9 +33,9 @@ class AddItemEntityPacket extends DataPacket{
public $x;
public $y;
public $z;
public $yaw;
public $pitch;
public $roll;
public $speedX;
public $speedY;
public $speedZ;
public function pid(){
return Info::ADD_ITEM_ENTITY_PACKET;
@ -52,9 +52,9 @@ class AddItemEntityPacket extends DataPacket{
$this->putFloat($this->x);
$this->putFloat($this->y);
$this->putFloat($this->z);
$this->putByte($this->yaw);
$this->putByte($this->pitch);
$this->putByte($this->roll);
$this->putFloat($this->speedX);
$this->putFloat($this->speedY);
$this->putFloat($this->speedZ);
}
}

View File

@ -53,11 +53,11 @@ class AddMobPacket extends DataPacket{
$this->reset();
$this->putLong($this->eid);
$this->putInt($this->type);
$this->putInt($this->x);
$this->putInt($this->y);
$this->putInt($this->z);
$this->putByte(floor($this->yaw * (256 / 360)));
$this->putByte(floor($this->pitch * (256 / 360)));
$this->putFloat($this->x);
$this->putFloat($this->y);
$this->putFloat($this->z);
$this->putFloat($this->yaw);
$this->putFloat($this->pitch);
$this->put(Binary::writeMetadata($this->metadata));
}

View File

@ -60,8 +60,8 @@ class AddPlayerPacket extends DataPacket{
$this->putFloat($this->x);
$this->putFloat($this->y);
$this->putFloat($this->z);
$this->putByte((int) ($this->yaw * (256 / 360)));
$this->putByte((int) ($this->pitch * (256 / 360)));
$this->putFloat($this->yaw);
$this->putFloat($this->pitch);
$this->putShort($this->item);
$this->putShort($this->meta);
$this->put(Binary::writeMetadata($this->metadata));