Added yaw/pitch on spawn

This commit is contained in:
Shoghi Cervantes 2014-06-23 16:07:59 +02:00
parent 4b3addb8a0
commit bcb401c0c3
3 changed files with 8 additions and 6 deletions

View File

@ -30,6 +30,8 @@ use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum; use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Short; use pocketmine\nbt\tag\Short;
use pocketmine\network\protocol\AddPlayerPacket; use pocketmine\network\protocol\AddPlayerPacket;
use pocketmine\network\protocol\MoveEntityPacket_PosRot;
use pocketmine\network\protocol\MovePlayerPacket;
use pocketmine\network\protocol\RemovePlayerPacket; use pocketmine\network\protocol\RemovePlayerPacket;
use pocketmine\network\protocol\SetEntityMotionPacket; use pocketmine\network\protocol\SetEntityMotionPacket;
use pocketmine\Network; use pocketmine\Network;
@ -145,8 +147,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;
$pk->yaw = 0; $pk->yaw = $this->yaw;
$pk->pitch = 0; $pk->pitch = $this->pitch;
$pk->unknown1 = 0; $pk->unknown1 = 0;
$pk->unknown2 = 0; $pk->unknown2 = 0;
$pk->metadata = $this->getData(); $pk->metadata = $this->getData();

View File

@ -48,8 +48,8 @@ class AddMobPacket extends DataPacket{
$this->putFloat($this->x); $this->putFloat($this->x);
$this->putFloat($this->y); $this->putFloat($this->y);
$this->putFloat($this->z); $this->putFloat($this->z);
$this->putByte($this->yaw); $this->putByte(floor($this->yaw * (256 / 360)));
$this->putByte($this->pitch); $this->putByte(floor($this->pitch * (256 / 360)));
$this->put(Binary::writeMetadata($this->metadata)); $this->put(Binary::writeMetadata($this->metadata));
} }

View File

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