Fixed picking up items, entity IDs on packets

This commit is contained in:
Shoghi Cervantes 2015-03-12 11:43:24 +01:00
parent 4b442a9d7c
commit 00942d3a2b
6 changed files with 11 additions and 16 deletions

View File

@ -645,7 +645,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
} }
if($spawned < 16){ if($spawned < 8){
return; return;
} }
@ -1308,10 +1308,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
continue; continue;
} }
$pk = new TakeItemEntityPacket();
$pk->eid = $this->getId();
$pk->target = $entity->getId();
$this->dataPacket($pk);
$pk = new TakeItemEntityPacket(); $pk = new TakeItemEntityPacket();
$pk->eid = $this->getId(); $pk->eid = $this->getId();
$pk->target = $entity->getId(); $pk->target = $entity->getId();
@ -1342,10 +1338,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break; break;
} }
$pk = new TakeItemEntityPacket();
$pk->eid = $this->getId();
$pk->target = $entity->getId();
$this->dataPacket($pk);
$pk = new TakeItemEntityPacket(); $pk = new TakeItemEntityPacket();
$pk->eid = $this->getId(); $pk->eid = $this->getId();
$pk->target = $entity->getId(); $pk->target = $entity->getId();

View File

@ -37,7 +37,7 @@ class DropItemPacket extends DataPacket{
} }
public function decode(){ public function decode(){
$this->eid = $this->getInt(); $this->eid = $this->getLong();
$this->unknown = $this->getByte(); $this->unknown = $this->getByte();
$this->item = $this->getSlot(); $this->item = $this->getSlot();
} }

View File

@ -38,8 +38,8 @@ class InteractPacket extends DataPacket{
public function decode(){ public function decode(){
$this->action = $this->getByte(); $this->action = $this->getByte();
$this->eid = $this->getInt(); $this->eid = $this->getLong();
$this->target = $this->getInt(); $this->target = $this->getLong();
} }
public function encode(){ public function encode(){

View File

@ -32,6 +32,7 @@ class PlayerEquipmentPacket extends DataPacket{
public $item; public $item;
public $meta; public $meta;
public $slot; public $slot;
public $selectedSlot;
public function pid(){ public function pid(){
return Info::PLAYER_EQUIPMENT_PACKET; return Info::PLAYER_EQUIPMENT_PACKET;
@ -42,6 +43,7 @@ class PlayerEquipmentPacket extends DataPacket{
$this->item = $this->getShort(); $this->item = $this->getShort();
$this->meta = $this->getShort(); $this->meta = $this->getShort();
$this->slot = $this->getByte(); $this->slot = $this->getByte();
$this->selectedSlot = $this->getByte();
} }
public function encode(){ public function encode(){
@ -50,6 +52,7 @@ class PlayerEquipmentPacket extends DataPacket{
$this->putShort($this->item); $this->putShort($this->item);
$this->putShort($this->meta); $this->putShort($this->meta);
$this->putByte($this->slot); $this->putByte($this->slot);
$this->putByte($this->selectedSlot);
} }
} }

View File

@ -38,7 +38,7 @@ class RemoveBlockPacket extends DataPacket{
} }
public function decode(){ public function decode(){
$this->eid = $this->getInt(); $this->eid = $this->getLong();
$this->x = $this->getInt(); $this->x = $this->getInt();
$this->z = $this->getInt(); $this->z = $this->getInt();
$this->y = $this->getByte(); $this->y = $this->getByte();

View File

@ -41,7 +41,7 @@ class TakeItemEntityPacket extends DataPacket{
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putInt($this->target); $this->putLong($this->target);
$this->putLong($this->eid); $this->putLong($this->eid);
} }