mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-25 20:33:59 +00:00
World::setBiomeId() now bails when trying to modify a non-generated chunk (or chunk locked for generation)
This commit is contained in:
parent
3e21e47b7a
commit
11434f3a27
@ -1869,7 +1869,18 @@ class World implements ChunkManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setBiomeId(int $x, int $z, int $biomeId) : void{
|
public function setBiomeId(int $x, int $z, int $biomeId) : void{
|
||||||
$this->getOrLoadChunk($x >> 4, $z >> 4, true)->setBiomeId($x & 0x0f, $z & 0x0f, $biomeId);
|
$chunkX = $x >> 4;
|
||||||
|
$chunkZ = $z >> 4;
|
||||||
|
if($this->isChunkLocked($chunkX, $chunkZ)){
|
||||||
|
//the changes would be overwritten when the generation finishes
|
||||||
|
throw new WorldException("Chunk is currently locked for async generation/population");
|
||||||
|
}
|
||||||
|
if(($chunk = $this->getOrLoadChunk($chunkX, $chunkZ, false)) !== null){
|
||||||
|
$chunk->setBiomeId($x & 0x0f, $z & 0x0f, $biomeId);
|
||||||
|
}else{
|
||||||
|
//if we allowed this, the modifications would be lost when the chunk is created
|
||||||
|
throw new WorldException("Cannot set biome in a non-generated chunk");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -535,11 +535,6 @@ parameters:
|
|||||||
count: 3
|
count: 3
|
||||||
path: ../../../src/world/World.php
|
path: ../../../src/world/World.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method setBiomeId\\(\\) on pocketmine\\\\world\\\\format\\\\Chunk\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../../src/world/World.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot call method isPopulated\\(\\) on pocketmine\\\\world\\\\format\\\\Chunk\\|null\\.$#"
|
message: "#^Cannot call method isPopulated\\(\\) on pocketmine\\\\world\\\\format\\\\Chunk\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user