mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Improved flat world initial chunk generation speed by ~50%
This commit is contained in:
parent
8274f5b3cc
commit
c1542d853f
@ -118,8 +118,18 @@ class Flat extends Generator{
|
|||||||
for($Z = 0; $Z < 16; ++$Z){
|
for($Z = 0; $Z < 16; ++$Z){
|
||||||
for($X = 0; $X < 16; ++$X){
|
for($X = 0; $X < 16; ++$X){
|
||||||
$this->chunk->setBiomeId($X, $Z, $biome);
|
$this->chunk->setBiomeId($X, $Z, $biome);
|
||||||
for($y = 0; $y < 256 and isset($this->structure[$y]); ++$y){
|
}
|
||||||
$this->chunk->setBlock($X, $y, $Z, ...$this->structure[$y]);
|
}
|
||||||
|
|
||||||
|
for($sy = 0; $sy < 256; $sy += 16){
|
||||||
|
$subchunk = $this->chunk->getSubChunk($sy >> 4, true);
|
||||||
|
for($y = 0; $y < 16 and isset($this->structure[$y | $sy]); ++$y){
|
||||||
|
list($id, $meta) = $this->structure[$y | $sy];
|
||||||
|
|
||||||
|
for($Z = 0; $Z < 16; ++$Z){
|
||||||
|
for($X = 0; $X < 16; ++$X){
|
||||||
|
$subchunk->setBlock($X, $y, $Z, $id, $meta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user