mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 16:45:13 +00:00
New batched UpdateBlockPacket, added Level->sendBlocks()
This commit is contained in:
@ -28,11 +28,15 @@ class UpdateBlockPacket extends DataPacket{
|
||||
public static $pool = [];
|
||||
public static $next = 0;
|
||||
|
||||
public $x;
|
||||
public $z;
|
||||
public $y;
|
||||
public $block;
|
||||
public $meta;
|
||||
const FLAG_NONE = 0b0;
|
||||
const FLAG_NEIGHBORS = 0b1;
|
||||
const FLAG_NOGRAPHIC = 0b100;
|
||||
const FLAG_PRIORITY = 0b1000;
|
||||
|
||||
const FLAG_ALL = self::FLAG_NEIGHBORS;
|
||||
const FLAG_ALL_PRIORITY = self::FLAG_NEIGHBORS | self::FLAG_PRIORITY;
|
||||
|
||||
public $records = []; //x, z, y, blockId, blockData, flags
|
||||
|
||||
public function pid(){
|
||||
return Info::UPDATE_BLOCK_PACKET;
|
||||
@ -44,11 +48,14 @@ class UpdateBlockPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->z);
|
||||
$this->putByte($this->y);
|
||||
$this->putByte($this->block);
|
||||
$this->putByte($this->meta);
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user