Level: minor de-spaghettification of chunk requesting

Now the Level tells the player to request chunks on tick, instead of the server doing it.
This commit is contained in:
Dylan K. Taylor
2018-07-18 16:48:53 +01:00
parent e57dd3e8ba
commit 1144620f2b
3 changed files with 19 additions and 20 deletions

View File

@@ -1140,6 +1140,20 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
Timings::$playerChunkOrderTimer->stopTiming();
}
public function doChunkRequests(){
if(!$this->isOnline()){
return;
}
if($this->nextChunkOrderRun-- <= 0){
$this->orderChunks();
}
if(count($this->loadQueue) > 0){
$this->sendNextChunk();
}
}
/**
* @return Position
*/
@@ -1774,20 +1788,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->dataPacket($pk);
}
public function checkNetwork(){
if(!$this->isOnline()){
return;
}
if($this->nextChunkOrderRun-- <= 0){
$this->orderChunks();
}
if(count($this->loadQueue) > 0){
$this->sendNextChunk();
}
}
/**
* Returns whether the player can interact with the specified position. This checks distance and direction.
*