mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Region loaders don't need to know their own coordinates
This commit is contained in:
parent
41f335e7d9
commit
b0f1863c4f
@ -254,7 +254,7 @@ abstract class RegionLevelProvider extends BaseLevelProvider{
|
||||
if(!isset($this->regions[$index = Level::chunkHash($regionX, $regionZ)])){
|
||||
$path = $this->pathToRegion($regionX, $regionZ);
|
||||
|
||||
$region = new RegionLoader($path, $regionX, $regionZ);
|
||||
$region = new RegionLoader($path);
|
||||
try{
|
||||
$region->open();
|
||||
}catch(CorruptedRegionException $e){
|
||||
@ -267,7 +267,7 @@ abstract class RegionLevelProvider extends BaseLevelProvider{
|
||||
rename($path, $backupPath);
|
||||
$logger->error("Corrupted region file has been backed up to " . $backupPath);
|
||||
|
||||
$region = new RegionLoader($path, $regionX, $regionZ);
|
||||
$region = new RegionLoader($path);
|
||||
$region->open(); //this will create a new empty region to replace the corrupted one
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,6 @@ class RegionLoader{
|
||||
|
||||
public static $COMPRESSION_LEVEL = 7;
|
||||
|
||||
/** @var int */
|
||||
protected $x;
|
||||
/** @var int */
|
||||
protected $z;
|
||||
/** @var string */
|
||||
protected $filePath;
|
||||
/** @var resource */
|
||||
@ -54,9 +50,7 @@ class RegionLoader{
|
||||
/** @var int */
|
||||
public $lastUsed = 0;
|
||||
|
||||
public function __construct(string $filePath, int $regionX, int $regionZ){
|
||||
$this->x = $regionX;
|
||||
$this->z = $regionZ;
|
||||
public function __construct(string $filePath){
|
||||
$this->filePath = $filePath;
|
||||
}
|
||||
|
||||
@ -340,14 +334,6 @@ class RegionLoader{
|
||||
$this->locationTable = array_fill(0, 1024, [0, 0, 0]);
|
||||
}
|
||||
|
||||
public function getX() : int{
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
public function getZ() : int{
|
||||
return $this->z;
|
||||
}
|
||||
|
||||
public function getFilePath() : string{
|
||||
return $this->filePath;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user