mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Chunk: make setSubChunk() throw exception on invalid Y instead of returning false
This commit is contained in:
parent
b8c857df64
commit
295d14e0d9
@ -685,12 +685,10 @@ class Chunk{
|
||||
* @param int $y
|
||||
* @param SubChunkInterface|null $subChunk
|
||||
* @param bool $allowEmpty Whether to check if the chunk is empty, and if so replace it with an empty stub
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setSubChunk(int $y, ?SubChunkInterface $subChunk, bool $allowEmpty = false) : bool{
|
||||
public function setSubChunk(int $y, ?SubChunkInterface $subChunk, bool $allowEmpty = false) : void{
|
||||
if($y < 0 or $y >= $this->height){
|
||||
return false;
|
||||
throw new \InvalidArgumentException("Invalid subchunk Y coordinate $y");
|
||||
}
|
||||
if($subChunk === null or ($subChunk->isEmpty() and !$allowEmpty)){
|
||||
$this->subChunks[$y] = EmptySubChunk::getInstance();
|
||||
@ -698,7 +696,6 @@ class Chunk{
|
||||
$this->subChunks[$y] = $subChunk;
|
||||
}
|
||||
$this->setDirtyFlag(self::DIRTY_FLAG_TERRAIN, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user