Merge branch 'stable' into master

# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/command/defaults/StatusCommand.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/level/format/SubChunk.php
This commit is contained in:
Dylan K. Taylor
2020-09-26 13:27:08 +01:00
7 changed files with 16 additions and 8 deletions

View File

@ -69,11 +69,14 @@ final class RegionGarbageMap{
/** @var RegionLocationTableEntry|null $prevEntry */
$prevEntry = null;
foreach($usedMap as $firstSector => $entry){
$expectedStart = ($prevEntry !== null ? $prevEntry->getLastSector() + 1 : RegionLoader::FIRST_SECTOR);
$actualStart = $entry->getFirstSector();
if($expectedStart < $actualStart){
$prevEndPlusOne = ($prevEntry !== null ? $prevEntry->getLastSector() + 1 : RegionLoader::FIRST_SECTOR);
$currentStart = $entry->getFirstSector();
if($prevEndPlusOne < $currentStart){
//found a gap in the table
$garbageMap[$expectedStart] = new RegionLocationTableEntry($expectedStart, $actualStart - $expectedStart, 0);
$garbageMap[$prevEndPlusOne] = new RegionLocationTableEntry($prevEndPlusOne, $currentStart - $prevEndPlusOne, 0);
}elseif($prevEndPlusOne > $currentStart){
//current entry starts inside the previous. This would be a bug since RegionLoader should prevent this
throw new AssumptionFailedError("Overlapping entries detected");
}
$prevEntry = $entry;
}

View File

@ -283,6 +283,7 @@ class RegionLoader{
throw new CorruptedRegionException("Corrupted region header (unexpected end of file)");
}
/** @var int[] $data */
$data = unpack("N*", $headerRaw);
for($i = 0; $i < 1024; ++$i){