UpdateBlockPacket fixed and changed skinName to skinId

This commit is contained in:
Intyre
2016-06-22 01:07:09 +02:00
parent df8e1e8702
commit 6fb41c5c7f
6 changed files with 57 additions and 36 deletions

View File

@ -36,7 +36,12 @@ class UpdateBlockPacket extends DataPacket{
const FLAG_ALL = (self::FLAG_NEIGHBORS | self::FLAG_NETWORK);
const FLAG_ALL_PRIORITY = (self::FLAG_ALL | self::FLAG_PRIORITY);
public $records = []; //x, z, y, blockId, blockData, flags
public $x;
public $z;
public $y;
public $blockId;
public $blockData;
public $flags;
public function decode(){
@ -44,14 +49,11 @@ class UpdateBlockPacket extends DataPacket{
public function encode(){
$this->reset();
$this->putInt(count($this->records));
foreach($this->records as $r){
$this->putInt($r[0]);
$this->putInt($r[1]);
$this->putByte($r[2]);
$this->putByte($r[3]);
$this->putByte(($r[5] << 4) | $r[4]);
}
$this->putInt($this->x);
$this->putInt($this->z);
$this->putByte($this->y);
$this->putByte($this->blockId);
$this->putByte(($this->flags << 4) | $this->blockData);
}
}