mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
World: account for null chunk edge case in tickChunk()
the target chunk may no longer be loaded if it was unloaded during a previous chunk's tick (e.g. during BlockGrowEvent). Since the parent function iterates over a pre-selected array of chunks, the chunk will still be present in the list even if it's no longer loaded by the time it's reached.
This commit is contained in:
parent
97ef209c5f
commit
1e5597f0d5
@ -1222,7 +1222,8 @@ class World implements ChunkManager{
|
|||||||
private function tickChunk(int $chunkX, int $chunkZ) : void{
|
private function tickChunk(int $chunkX, int $chunkZ) : void{
|
||||||
$chunk = $this->getChunk($chunkX, $chunkZ);
|
$chunk = $this->getChunk($chunkX, $chunkZ);
|
||||||
if($chunk === null){
|
if($chunk === null){
|
||||||
throw new \InvalidArgumentException("Chunk is not loaded");
|
//the chunk may have been unloaded during a previous chunk's update (e.g. during BlockGrowEvent)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
foreach($this->getChunkEntities($chunkX, $chunkZ) as $entity){
|
foreach($this->getChunkEntities($chunkX, $chunkZ) as $entity){
|
||||||
$entity->onRandomUpdate();
|
$entity->onRandomUpdate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user