Add cases for some unhandled Player Actions and add unknown field to ContainerSetSlotPacket

This commit is contained in:
Dylan K. Taylor 2016-12-13 11:43:37 +00:00
parent 6ea45c5c4a
commit 146f5a567f
2 changed files with 7 additions and 0 deletions

View File

@ -2113,6 +2113,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
case PlayerActionPacket::ACTION_ABORT_BREAK:
$this->lastBreak = PHP_INT_MAX;
break;
case PlayerActionPacket::ACTION_STOP_BREAK:
break;
case PlayerActionPacket::ACTION_RELEASE_ITEM:
if($this->startAction > -1 and $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION)){
if($this->inventory->getItemInHand()->getId() === Item::BOW){
@ -2244,6 +2246,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->spawnToAll();
$this->scheduleUpdate();
break;
case PlayerActionPacket::ACTION_JUMP:
break;
case PlayerActionPacket::ACTION_START_SPRINT:
$ev = new PlayerToggleSprintEvent($this, true);
$this->server->getPluginManager()->callEvent($ev);

View File

@ -33,12 +33,14 @@ class ContainerSetSlotPacket extends DataPacket{
public $hotbarSlot;
/** @var Item */
public $item;
public $unknown;
public function decode(){
$this->windowid = $this->getByte();
$this->slot = $this->getVarInt();
$this->hotbarSlot = $this->getVarInt();
$this->item = $this->getSlot();
$this->unknown = $this->getByte();
}
public function encode(){
@ -47,6 +49,7 @@ class ContainerSetSlotPacket extends DataPacket{
$this->putVarInt($this->slot);
$this->putVarInt($this->hotbarSlot);
$this->putSlot($this->item);
$this->putByte($this->unknown);
}
}