mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-26 05:14:05 +00:00
World: verify blockstate IDs in setChunk()
I think I've finally traced the source of these problems back to BuilderTools setting bad values in async tasks :)
This commit is contained in:
parent
04494e845c
commit
258923cc78
@ -2625,6 +2625,16 @@ class World implements ChunkManager{
|
||||
}
|
||||
|
||||
public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk) : void{
|
||||
foreach($chunk->getSubChunks() as $subChunk){
|
||||
foreach($subChunk->getBlockLayers() as $blockLayer){
|
||||
foreach($blockLayer->getPalette() as $blockStateId){
|
||||
if(!$this->blockStateRegistry->hasStateId($blockStateId)){
|
||||
throw new \InvalidArgumentException("Provided chunk contains unknown/unregistered blocks (found unknown state ID $blockStateId)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$chunkHash = World::chunkHash($chunkX, $chunkZ);
|
||||
$oldChunk = $this->loadChunk($chunkX, $chunkZ);
|
||||
if($oldChunk !== null && $oldChunk !== $chunk){
|
||||
|
Loading…
x
Reference in New Issue
Block a user