mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
World: formalize setBlockAt()'s refusal to modify un-generated chunks
closes #2631
This commit is contained in:
parent
b7690fed04
commit
0bb37b5065
@ -1401,6 +1401,14 @@ class World implements ChunkManager{
|
|||||||
if(!$this->isInWorld($x, $y, $z)){
|
if(!$this->isInWorld($x, $y, $z)){
|
||||||
throw new \InvalidArgumentException("Pos x=$x,y=$y,z=$z is outside of the world bounds");
|
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();
|
$this->timings->setBlock->startTiming();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user