Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Improved player spawn item in hand sending
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Nov 27, 2014
1 parent dd3207c commit cd135b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/pocketmine/entity/Human.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ public function spawnTo(Player $player){
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->unknown1 = 0;
$pk->unknown2 = 0;
$item = $this->getInventory()->getItemInHand();
$pk->item = $item->getID();
$pk->meta = $item->getDamage();
$pk->metadata = $this->getData();
$player->dataPacket($pk);

Expand All @@ -180,8 +181,6 @@ public function spawnTo(Player $player){
];
$player->dataPacket($pk);

$this->inventory->sendHeldItem($player);

$this->inventory->sendArmorContents($player);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/pocketmine/network/protocol/AddPlayerPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class AddPlayerPacket extends DataPacket{
public $z;
public $pitch;
public $yaw;
public $unknown1;
public $unknown2;
public $item;
public $meta;
public $metadata;

public function pid(){
Expand All @@ -61,8 +61,8 @@ public function encode(){
$this->putFloat($this->z);
$this->putByte((int) ($this->yaw * (256 / 360)));
$this->putByte((int) ($this->pitch * (256 / 360)));
$this->putShort($this->unknown1);
$this->putShort($this->unknown2);
$this->putShort($this->item);
$this->putShort($this->meta);
$this->put(Binary::writeMetadata($this->metadata));
}

Expand Down

0 comments on commit cd135b3

Please sign in to comment.