diff --git a/src/world/World.php b/src/world/World.php index 95de642d9..6cfd66eed 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -77,6 +77,7 @@ use pocketmine\world\particle\DestroyBlockParticle; use pocketmine\world\particle\Particle; use pocketmine\world\sound\BlockPlaceSound; use pocketmine\world\sound\Sound; +use pocketmine\world\utils\SubChunkIteratorManager; use function abs; use function array_fill_keys; use function array_map; @@ -1165,14 +1166,14 @@ class World implements ChunkManager{ $blockFactory = BlockFactory::getInstance(); $this->timings->doBlockSkyLightUpdates->startTiming(); if($this->skyLightUpdate === null){ - $this->skyLightUpdate = new SkyLightUpdate($this, $blockFactory->lightFilter, $blockFactory->blocksDirectSkyLight); + $this->skyLightUpdate = new SkyLightUpdate(new SubChunkIteratorManager($this), $blockFactory->lightFilter, $blockFactory->blocksDirectSkyLight); } $this->skyLightUpdate->recalculateNode($x, $y, $z); $this->timings->doBlockSkyLightUpdates->stopTiming(); $this->timings->doBlockLightUpdates->startTiming(); if($this->blockLightUpdate === null){ - $this->blockLightUpdate = new BlockLightUpdate($this, $blockFactory->lightFilter, $blockFactory->light); + $this->blockLightUpdate = new BlockLightUpdate(new SubChunkIteratorManager($this), $blockFactory->lightFilter, $blockFactory->light); } $this->blockLightUpdate->recalculateNode($x, $y, $z); $this->timings->doBlockLightUpdates->stopTiming(); diff --git a/src/world/light/BlockLightUpdate.php b/src/world/light/BlockLightUpdate.php index fc48e27bb..ff6125a74 100644 --- a/src/world/light/BlockLightUpdate.php +++ b/src/world/light/BlockLightUpdate.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace pocketmine\world\light; -use pocketmine\world\ChunkManager; +use pocketmine\world\utils\SubChunkIteratorManager; use function max; class BlockLightUpdate extends LightUpdate{ @@ -40,8 +40,8 @@ class BlockLightUpdate extends LightUpdate{ * @phpstan-param \SplFixedArray $lightFilters * @phpstan-param \SplFixedArray $lightEmitters */ - public function __construct(ChunkManager $world, \SplFixedArray $lightFilters, \SplFixedArray $lightEmitters){ - parent::__construct($world, $lightFilters); + public function __construct(SubChunkIteratorManager $subChunkHandler, \SplFixedArray $lightFilters, \SplFixedArray $lightEmitters){ + parent::__construct($subChunkHandler, $lightFilters); $this->lightEmitters = $lightEmitters; } diff --git a/src/world/light/LightUpdate.php b/src/world/light/LightUpdate.php index f3c6c5eb4..e0b325a84 100644 --- a/src/world/light/LightUpdate.php +++ b/src/world/light/LightUpdate.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\world\light; -use pocketmine\world\ChunkManager; use pocketmine\world\format\LightArray; use pocketmine\world\utils\SubChunkIteratorManager; use pocketmine\world\World; @@ -54,10 +53,10 @@ abstract class LightUpdate{ * @param \SplFixedArray|int[] $lightFilters * @phpstan-param \SplFixedArray $lightFilters */ - public function __construct(ChunkManager $world, \SplFixedArray $lightFilters){ + public function __construct(SubChunkIteratorManager $subChunkHandler, \SplFixedArray $lightFilters){ $this->lightFilters = $lightFilters; - $this->subChunkHandler = new SubChunkIteratorManager($world); + $this->subChunkHandler = $subChunkHandler; $this->subChunkHandler->onSubChunkChange(\Closure::fromCallable([$this, 'updateLightArrayRef'])); } diff --git a/src/world/light/SkyLightUpdate.php b/src/world/light/SkyLightUpdate.php index 4c63bbc2d..abf84f80f 100644 --- a/src/world/light/SkyLightUpdate.php +++ b/src/world/light/SkyLightUpdate.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace pocketmine\world\light; -use pocketmine\world\ChunkManager; +use pocketmine\world\utils\SubChunkIteratorManager; use pocketmine\world\World; use function max; @@ -41,8 +41,8 @@ class SkyLightUpdate extends LightUpdate{ * @phpstan-param \SplFixedArray $lightFilters * @phpstan-param \SplFixedArray $directSkyLightBlockers */ - public function __construct(ChunkManager $world, \SplFixedArray $lightFilters, \SplFixedArray $directSkyLightBlockers){ - parent::__construct($world, $lightFilters); + public function __construct(SubChunkIteratorManager $subChunkHandler, \SplFixedArray $lightFilters, \SplFixedArray $directSkyLightBlockers){ + parent::__construct($subChunkHandler, $lightFilters); $this->directSkyLightBlockers = $directSkyLightBlockers; }