Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Enabled batch block sending again
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Nov 29, 2014
1 parent a72488d commit e44ed4d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
30 changes: 15 additions & 15 deletions src/pocketmine/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -1144,22 +1144,22 @@ protected function processMovement($currentTick){
$ev = new PlayerMoveEvent($this, $from, $to);

$this->server->getPluginManager()->callEvent($ev);
}

if(!($revert = $ev->isCancelled())){ //Yes, this is intended
if($to->distance($ev->getTo()) > 0.1){ //If plugins modify the destination
$this->teleport($ev->getTo());
}else{
$pk = new MovePlayerPacket();
$pk->eid = $this->id;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->bodyYaw = $this->yaw;

Server::broadcastPacket($this->hasSpawned, $pk);
if(!($revert = $ev->isCancelled())){ //Yes, this is intended
if($to->distance($ev->getTo()) > 0.1){ //If plugins modify the destination
$this->teleport($ev->getTo());
}else{
$pk = new MovePlayerPacket();
$pk->eid = $this->id;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->bodyYaw = $this->yaw;

Server::broadcastPacket($this->hasSpawned, $pk);
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/pocketmine/level/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public function doTick($currentTick){
if(($mini & (1 << $Y)) === 0){
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;
}else{
$X = null;
Expand Down Expand Up @@ -1056,7 +1056,7 @@ public function setBlock(Vector3 $pos, Block $block, $direct = false, $update =
Cache::remove("world:" . $this->getID() . ":" . $index);
}

//if($direct === true){
if($direct === true){
$pk = new UpdateBlockPacket();
$pk->x = $pos->x;
$pk->y = $pos->y;
Expand All @@ -1065,7 +1065,7 @@ public function setBlock(Vector3 $pos, Block $block, $direct = false, $update =
$pk->meta = $block->getDamage();

Server::broadcastPacket($this->getUsingChunk($pos->x >> 4, $pos->z >> 4), $pk);
/*}else{
}else{
if(!($pos instanceof Position)){
$pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z);
}
Expand All @@ -1080,7 +1080,7 @@ public function setBlock(Vector3 $pos, Block $block, $direct = false, $update =
$this->changedCount[$index] |= 1 << $Y;
}
$this->changedBlocks[$index][$Y][] = clone $block;
}*/
}

if($update === true){
$this->updateAllLight($block);
Expand Down

0 comments on commit e44ed4d

Please sign in to comment.