mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
LevelDB: stop passing false to places where it's not expected
This commit is contained in:
parent
a7f10d8ccf
commit
7255065106
@ -301,7 +301,8 @@ class LevelDB extends BaseLevelProvider{
|
||||
protected function readChunk(int $chunkX, int $chunkZ) : ?Chunk{
|
||||
$index = LevelDB::chunkIndex($chunkX, $chunkZ);
|
||||
|
||||
if(!$this->chunkExists($chunkX, $chunkZ)){
|
||||
$chunkVersionRaw = $this->db->get($index . self::TAG_VERSION);
|
||||
if($chunkVersionRaw === false){
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -316,7 +317,7 @@ class LevelDB extends BaseLevelProvider{
|
||||
/** @var bool $lightPopulated */
|
||||
$lightPopulated = true;
|
||||
|
||||
$chunkVersion = ord($this->db->get($index . self::TAG_VERSION));
|
||||
$chunkVersion = ord($chunkVersionRaw);
|
||||
$hasBeenUpgraded = $chunkVersion < self::CURRENT_LEVEL_CHUNK_VERSION;
|
||||
|
||||
$binaryStream = new BinaryStream();
|
||||
@ -368,7 +369,11 @@ class LevelDB extends BaseLevelProvider{
|
||||
}
|
||||
break;
|
||||
case 2: // < MCPE 1.0
|
||||
$binaryStream->setBuffer($this->db->get($index . self::TAG_LEGACY_TERRAIN));
|
||||
$legacyTerrain = $this->db->get($index . self::TAG_LEGACY_TERRAIN);
|
||||
if($legacyTerrain === false){
|
||||
throw new CorruptedChunkException("Expected to find a LEGACY_TERRAIN key for this chunk version, but none found");
|
||||
}
|
||||
$binaryStream->setBuffer($legacyTerrain);
|
||||
$fullIds = $binaryStream->get(32768);
|
||||
$fullData = $binaryStream->get(16384);
|
||||
$fullSkyLight = $binaryStream->get(16384);
|
||||
|
Loading…
x
Reference in New Issue
Block a user