mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 04:15:04 +00:00
performance: only calculate light for chunks inside ticking areas
this produces a major performance improvement for large render distances, and reduces the impact of lighting calculation to zero on servers which have random blockupdates turned off.
This commit is contained in:
@@ -58,7 +58,7 @@ class Chunk{
|
||||
/** @var int */
|
||||
private $dirtyFlags = 0;
|
||||
|
||||
/** @var bool */
|
||||
/** @var bool|null */
|
||||
protected $lightPopulated = false;
|
||||
/** @var bool */
|
||||
protected $terrainGenerated = false;
|
||||
@@ -387,11 +387,11 @@ class Chunk{
|
||||
$this->dirtyFlags |= self::DIRTY_FLAG_BIOMES;
|
||||
}
|
||||
|
||||
public function isLightPopulated() : bool{
|
||||
public function isLightPopulated() : ?bool{
|
||||
return $this->lightPopulated;
|
||||
}
|
||||
|
||||
public function setLightPopulated(bool $value = true) : void{
|
||||
public function setLightPopulated(?bool $value = true) : void{
|
||||
$this->lightPopulated = $value;
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ final class FastChunkSerializer{
|
||||
* TODO: tiles and entities
|
||||
*/
|
||||
public static function serialize(Chunk $chunk, bool $includeLight = true) : string{
|
||||
$includeLight = $includeLight && $chunk->isLightPopulated();
|
||||
$includeLight = $includeLight && $chunk->isLightPopulated() === true;
|
||||
|
||||
$stream = new BinaryStream();
|
||||
$stream->putInt($chunk->getX());
|
||||
|
Reference in New Issue
Block a user