mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 23:15:29 +00:00
Fixed chunk sending
This commit is contained in:
parent
5ec6ccefda
commit
d616e73242
@ -675,23 +675,21 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$lastChunk = $this->usedChunks;
|
$lastChunk = $this->usedChunks;
|
||||||
$centerX = $this->x >> 4;
|
$centerX = $this->x >> 4;
|
||||||
$centerZ = $this->z >> 4;
|
$centerZ = $this->z >> 4;
|
||||||
$startX = $centerX - $radius;
|
|
||||||
$startZ = $centerZ - $radius;
|
|
||||||
$finalX = $centerX + $radius;
|
|
||||||
$finalZ = $centerZ + $radius;
|
|
||||||
$generateQueue = new ReversePriorityQueue();
|
$generateQueue = new ReversePriorityQueue();
|
||||||
for($X = $startX; $X <= $finalX; ++$X){
|
for($X = -$radius; $X <= $radius; ++$X){
|
||||||
for($Z = $startZ; $Z <= $finalZ; ++$Z){
|
for($Z = -$radius; $Z <= $radius; ++$Z){
|
||||||
$distance = ($X * $X) + ($Z * $Z);
|
$distance = ($X * $X) + ($Z * $Z);
|
||||||
if($distance > $radiusSquared){
|
if($distance > $radiusSquared){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$index = Level::chunkHash($X, $Z);
|
$chunkX = $X + $centerX;
|
||||||
|
$chunkZ = $Z + $centerZ;
|
||||||
|
$index = Level::chunkHash($chunkX, $chunkZ);
|
||||||
if(!isset($this->usedChunks[$index])){
|
if(!isset($this->usedChunks[$index])){
|
||||||
if($this->getLevel()->isChunkPopulated($X, $Z)){
|
if($this->getLevel()->isChunkPopulated($chunkX, $chunkZ)){
|
||||||
$newOrder[$index] = $distance;
|
$newOrder[$index] = $distance;
|
||||||
}else{
|
}else{
|
||||||
$generateQueue->insert([$X, $Z], $distance);
|
$generateQueue->insert([$chunkX, $chunkZ], $distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($lastChunk[$index]);
|
unset($lastChunk[$index]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user