mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
World: formalize setBlockAt()'s refusal to modify un-generated chunks
closes #2631
This commit is contained in:
@@ -1401,6 +1401,14 @@ class World implements ChunkManager{
|
||||
if(!$this->isInWorld($x, $y, $z)){
|
||||
throw new \InvalidArgumentException("Pos x=$x,y=$y,z=$z is outside of the world bounds");
|
||||
}
|
||||
$chunkX = $x >> 4;
|
||||
$chunkZ = $z >> 4;
|
||||
if($this->isChunkLocked($chunkX, $chunkZ)){
|
||||
throw new WorldException("Terrain is locked for generation/population");
|
||||
}
|
||||
if(!$this->loadChunk($chunkX, $chunkZ, false)){ //current expected behaviour is to try to load the terrain synchronously
|
||||
throw new WorldException("Cannot set a block in un-generated terrain");
|
||||
}
|
||||
|
||||
$this->timings->setBlock->startTiming();
|
||||
|
||||
|
Reference in New Issue
Block a user