Fixed block picking, added PlayerBlockPickEvent

This commit is contained in:
Dylan K. Taylor
2017-09-23 14:42:28 +01:00
parent 826ec90856
commit 178dd1b981
3 changed files with 86 additions and 13 deletions

View File

@ -33,24 +33,24 @@ class BlockPickRequestPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::BLOCK_PICK_REQUEST_PACKET;
/** @var int */
public $tileX;
public $blockX;
/** @var int */
public $tileY;
public $blockY;
/** @var int */
public $tileZ;
public $blockZ;
/** @var bool */
public $addUserData = false;
/** @var int */
public $hotbarSlot;
protected function decodePayload(){
$this->getSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ);
$this->getSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
$this->addUserData = $this->getBool();
$this->hotbarSlot = $this->getByte();
}
protected function encodePayload(){
$this->putSignedBlockPosition($this->tileX, $this->tileY, $this->tileZ);
$this->putSignedBlockPosition($this->blockX, $this->blockY, $this->blockZ);
$this->putBool($this->addUserData);
$this->putByte($this->hotbarSlot);
}