mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +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,6 +468,8 @@ class Player{
|
||||||
$this->server->api->dhandle("player.armor", $data);
|
$this->server->api->dhandle("player.armor", $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public $lastOrderX = 0;
|
||||||
|
public $lastOrderZ = 0;
|
||||||
|
|
||||||
public function orderChunks(){
|
public function orderChunks(){
|
||||||
if(!($this->entity instanceof Entity) or $this->connected === false){
|
if(!($this->entity instanceof Entity) or $this->connected === false){
|
||||||
|
|
@ -476,6 +478,8 @@ class Player{
|
||||||
$X = ((int)$this->entity->x) >> 4;
|
$X = ((int)$this->entity->x) >> 4;
|
||||||
$Z = ((int)$this->entity->z) >> 4;
|
$Z = ((int)$this->entity->z) >> 4;
|
||||||
$this->chunksOrder = [];
|
$this->chunksOrder = [];
|
||||||
|
$this->lastOrderX = $X;
|
||||||
|
$this->lastOrderZ = $Z;
|
||||||
if(self::$smallChunks){
|
if(self::$smallChunks){
|
||||||
$Y = ((int)$this->entity->y) >> 4;
|
$Y = ((int)$this->entity->y) >> 4;
|
||||||
$v = new Vector3($X, $Y, $Z);
|
$v = new Vector3($X, $Y, $Z);
|
||||||
|
|
@ -622,7 +626,9 @@ class Player{
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lastChunk = [$x, $z];
|
$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);
|
$this->server->schedule(MAX_CHUNK_RATE, [$this, "getNextChunk"], $world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue