mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
WorldProvider: allow loadChunk() to return additional information about the loaded chunk data
this will be needed for dealing with #5733. I don't plan to fix that before 5.0, but we need to make the appropriate BC breaks now, before release.
This commit is contained in:
@ -2702,25 +2702,25 @@ class World implements ChunkManager{
|
||||
|
||||
$this->timings->syncChunkLoadData->startTiming();
|
||||
|
||||
$chunk = null;
|
||||
$loadedChunkData = null;
|
||||
|
||||
try{
|
||||
$chunk = $this->provider->loadChunk($x, $z);
|
||||
$loadedChunkData = $this->provider->loadChunk($x, $z);
|
||||
}catch(CorruptedChunkException $e){
|
||||
$this->logger->critical("Failed to load chunk x=$x z=$z: " . $e->getMessage());
|
||||
}
|
||||
|
||||
$this->timings->syncChunkLoadData->stopTiming();
|
||||
|
||||
if($chunk === null){
|
||||
if($loadedChunkData === null){
|
||||
$this->timings->syncChunkLoad->stopTiming();
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->chunks[$chunkHash] = $chunk->getChunk();
|
||||
$this->chunks[$chunkHash] = $loadedChunkData->getData()->getChunk();
|
||||
unset($this->blockCache[$chunkHash]);
|
||||
|
||||
$this->initChunk($x, $z, $chunk);
|
||||
$this->initChunk($x, $z, $loadedChunkData->getData());
|
||||
|
||||
(new ChunkLoadEvent($this, $x, $z, $this->chunks[$chunkHash], false))->call();
|
||||
|
||||
|
Reference in New Issue
Block a user