duct tape for block ID remapping

This commit is contained in:
Dylan K. Taylor
2018-03-03 18:52:41 +00:00
parent c81f178cdb
commit 5ce55bd3b0
8 changed files with 72 additions and 22 deletions

View File

@ -47,24 +47,20 @@ class UpdateBlockPacket extends DataPacket{
/** @var int */
public $y;
/** @var int */
public $blockId;
/** @var int */
public $blockData;
public $blockRuntimeId;
/** @var int */
public $flags;
protected function decodePayload(){
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->blockId = $this->getUnsignedVarInt();
$aux = $this->getUnsignedVarInt();
$this->blockData = $aux & 0x0f;
$this->flags = $aux >> 4;
$this->blockRuntimeId = $this->getUnsignedVarInt();
$this->flags = $this->getUnsignedVarInt();
}
protected function encodePayload(){
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->putUnsignedVarInt($this->blockId);
$this->putUnsignedVarInt(($this->flags << 4) | $this->blockData);
$this->putUnsignedVarInt($this->blockRuntimeId);
$this->putUnsignedVarInt($this->flags);
}
public function handle(NetworkSession $session) : bool{