mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 17:20:02 +00:00
Improved performance of basic chunk sky-light population
No need to recalculate this 256 times
This commit is contained in:
parent
2726f2a011
commit
728851594b
@ -427,13 +427,12 @@ class Chunk{
|
|||||||
* TODO: fast adjacent light spread
|
* TODO: fast adjacent light spread
|
||||||
*/
|
*/
|
||||||
public function populateSkyLight(){
|
public function populateSkyLight(){
|
||||||
|
$maxY = ($this->getHighestSubChunkIndex() + 1) << 4;
|
||||||
for($x = 0; $x < 16; ++$x){
|
for($x = 0; $x < 16; ++$x){
|
||||||
for($z = 0; $z < 16; ++$z){
|
for($z = 0; $z < 16; ++$z){
|
||||||
$heightMap = $this->getHeightMap($x, $z);
|
$heightMap = $this->getHeightMap($x, $z);
|
||||||
|
|
||||||
$y = ($this->getHighestSubChunkIndex() + 1) << 4;
|
for($y = $maxY; $y >= $heightMap; --$y){
|
||||||
|
|
||||||
for(; $y >= $heightMap; --$y){
|
|
||||||
$this->setBlockSkyLight($x, $y, $z, 15);
|
$this->setBlockSkyLight($x, $y, $z, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user