mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
RegionLoader: do a full check for chunk overlaps during initial load
This commit is contained in:
@ -76,4 +76,17 @@ class RegionLocationTableEntry{
|
||||
public function isNull() : bool{
|
||||
return $this->firstSector === 0 or $this->sectorCount === 0;
|
||||
}
|
||||
|
||||
public function overlaps(RegionLocationTableEntry $other) : bool{
|
||||
$overlapCheck = static function(RegionLocationTableEntry $entry1, RegionLocationTableEntry $entry2) : bool{
|
||||
$entry1Last = $entry1->getLastSector();
|
||||
$entry2Last = $entry2->getLastSector();
|
||||
|
||||
return (
|
||||
($entry2->firstSector >= $entry1->firstSector and $entry2->firstSector <= $entry1Last) or
|
||||
($entry2Last >= $entry1->firstSector and $entry2Last <= $entry1Last)
|
||||
);
|
||||
};
|
||||
return $overlapCheck($this, $other) or $overlapCheck($other, $this);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user