Added global block cache

This commit is contained in:
Shoghi Cervantes
2014-10-12 16:16:19 +02:00
parent 9b69cc4288
commit 6246ad19c4
3 changed files with 75 additions and 72 deletions

View File

@@ -175,7 +175,8 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
/** @var Vector3 */
protected $newPosition;
private $viewDistance;
protected $viewDistance;
protected $chunksPerTick;
/** @var null|Position */
private $spawnPosition = null;
private $inAction = false;
@@ -424,6 +425,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->setLevel($this->server->getDefaultLevel(), true);
$this->viewDistance = $this->server->getViewDistance();
$this->newPosition = new Vector3(0, 0, 0);
$this->chunksPerTick = (int) $this->server->getProperty("chunk-sending.per-tick", 4);
}
/**
@@ -608,10 +610,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
if(count($this->loadQueue) === 0){
$this->chunkLoadTask->setNextRun($this->chunkLoadTask->getNextRun() + 30);
}else{
$count = 0;
$limit = (int) $this->server->getProperty("chunk-sending.per-tick", 4);
$count = 0;;
foreach($this->loadQueue as $index => $distance){
if($count >= $limit){
if($count >= $this->chunksPerTick){
break;
}
++$count;
@@ -648,7 +649,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
}
}
if($spawned < 48){
if($spawned < 56){
return;
}