mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 19:28:55 +00:00
Faster generation, ticks catch up when slower
This commit is contained in:
parent
ed5325c069
commit
e6224be46f
@ -644,7 +644,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$this->chunksOrder = $newOrder;
|
||||
|
||||
$i = 0;
|
||||
while(count($this->chunksOrder) === 0 and $generateQueue->count() > 0 and $i < 8){
|
||||
while(count($this->chunksOrder) < 3 and $generateQueue->count() > 0 and $i < 16){
|
||||
$d = $generateQueue->extract();
|
||||
$this->getLevel()->generateChunk($d[0], $d[1]);
|
||||
++$i;
|
||||
|
@ -63,7 +63,7 @@ class TickScheduler extends \Thread{
|
||||
|
||||
public function run(){
|
||||
$tickTime = microtime(true);
|
||||
$this->hasTick = true;
|
||||
$this->tickMeasure = $this->sleepTime;
|
||||
while(true){
|
||||
$this->synchronized(function (){
|
||||
$this->hasTick = true;
|
||||
@ -73,7 +73,8 @@ class TickScheduler extends \Thread{
|
||||
|
||||
$this->tickMeasure = (int) ((($time = microtime(true)) - $tickTime) * 1000000);
|
||||
$tickTime = $time;
|
||||
usleep($this->sleepTime - 100); //Remove a few ms for processing
|
||||
$sleepTime = $this->sleepTime * ($this->sleepTime / max($this->sleepTime, $this->tickMeasure));
|
||||
usleep($sleepTime - 100); //Remove a few ms for processing
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit cac93ad971a0b2792f4bb9873c73a76254dd1f7d
|
||||
Subproject commit 79e7386ed8f655af65af9c4878173df4a8bf7e04
|
Loading…
x
Reference in New Issue
Block a user