Enabled batch block sending again

This commit is contained in:
Shoghi Cervantes 2014-11-29 12:58:31 +01:00
parent a72488d41e
commit e44ed4da3b
2 changed files with 18 additions and 18 deletions

View File

@ -1144,22 +1144,22 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$ev = new PlayerMoveEvent($this, $from, $to); $ev = new PlayerMoveEvent($this, $from, $to);
$this->server->getPluginManager()->callEvent($ev); $this->server->getPluginManager()->callEvent($ev);
}
if(!($revert = $ev->isCancelled())){ //Yes, this is intended if(!($revert = $ev->isCancelled())){ //Yes, this is intended
if($to->distance($ev->getTo()) > 0.1){ //If plugins modify the destination if($to->distance($ev->getTo()) > 0.1){ //If plugins modify the destination
$this->teleport($ev->getTo()); $this->teleport($ev->getTo());
}else{ }else{
$pk = new MovePlayerPacket(); $pk = new MovePlayerPacket();
$pk->eid = $this->id; $pk->eid = $this->id;
$pk->x = $this->x; $pk->x = $this->x;
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;
$pk->yaw = $this->yaw; $pk->yaw = $this->yaw;
$pk->pitch = $this->pitch; $pk->pitch = $this->pitch;
$pk->bodyYaw = $this->yaw; $pk->bodyYaw = $this->yaw;
Server::broadcastPacket($this->hasSpawned, $pk); Server::broadcastPacket($this->hasSpawned, $pk);
}
} }
} }
} }

View File

@ -514,7 +514,7 @@ class Level implements ChunkManager, Metadatable{
if(($mini & (1 << $Y)) === 0){ if(($mini & (1 << $Y)) === 0){
continue; continue;
} }
if(count($this->changedBlocks[$index][$Y]) < 582){ //Optimal value, calculated using the relation between minichunks and single packets if(count($this->changedBlocks[$index][$Y]) < 256){
continue; continue;
}else{ }else{
$X = null; $X = null;
@ -1056,7 +1056,7 @@ class Level implements ChunkManager, Metadatable{
Cache::remove("world:" . $this->getID() . ":" . $index); Cache::remove("world:" . $this->getID() . ":" . $index);
} }
//if($direct === true){ if($direct === true){
$pk = new UpdateBlockPacket(); $pk = new UpdateBlockPacket();
$pk->x = $pos->x; $pk->x = $pos->x;
$pk->y = $pos->y; $pk->y = $pos->y;
@ -1065,7 +1065,7 @@ class Level implements ChunkManager, Metadatable{
$pk->meta = $block->getDamage(); $pk->meta = $block->getDamage();
Server::broadcastPacket($this->getUsingChunk($pos->x >> 4, $pos->z >> 4), $pk); Server::broadcastPacket($this->getUsingChunk($pos->x >> 4, $pos->z >> 4), $pk);
/*}else{ }else{
if(!($pos instanceof Position)){ if(!($pos instanceof Position)){
$pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z); $pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z);
} }
@ -1080,7 +1080,7 @@ class Level implements ChunkManager, Metadatable{
$this->changedCount[$index] |= 1 << $Y; $this->changedCount[$index] |= 1 << $Y;
} }
$this->changedBlocks[$index][$Y][] = clone $block; $this->changedBlocks[$index][$Y][] = clone $block;
}*/ }
if($update === true){ if($update === true){
$this->updateAllLight($block); $this->updateAllLight($block);