mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
chunks will reorder if player changed chunk while the world was sending it(should result in visually faster chunk loading)
This commit is contained in:
parent
a980eda1be
commit
e13b1f28ce
1 changed files with 8 additions and 2 deletions
|
|
@ -468,7 +468,9 @@ class Player{
|
|||
$this->server->api->dhandle("player.armor", $data);
|
||||
}
|
||||
}
|
||||
|
||||
public $lastOrderX = 0;
|
||||
public $lastOrderZ = 0;
|
||||
|
||||
public function orderChunks(){
|
||||
if(!($this->entity instanceof Entity) or $this->connected === false){
|
||||
return false;
|
||||
|
|
@ -476,6 +478,8 @@ class Player{
|
|||
$X = ((int)$this->entity->x) >> 4;
|
||||
$Z = ((int)$this->entity->z) >> 4;
|
||||
$this->chunksOrder = [];
|
||||
$this->lastOrderX = $X;
|
||||
$this->lastOrderZ = $Z;
|
||||
if(self::$smallChunks){
|
||||
$Y = ((int)$this->entity->y) >> 4;
|
||||
$v = new Vector3($X, $Y, $Z);
|
||||
|
|
@ -622,7 +626,9 @@ class Player{
|
|||
}
|
||||
|
||||
$this->lastChunk = [$x, $z];
|
||||
|
||||
if($this->lastOrderX != ($this->entity->x >> 4) || $this->lastOrderZ != ($this->entity->z >> 4)){
|
||||
$this->orderChunks();
|
||||
}
|
||||
$this->server->schedule(MAX_CHUNK_RATE, [$this, "getNextChunk"], $world);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue