McRegion: Refactor some ambiguous variable names

This commit is contained in:
Dylan K. Taylor 2017-12-30 18:59:01 +00:00
parent bcb080e2b9
commit 54b23968e7

View File

@ -409,31 +409,31 @@ class McRegion extends BaseLevelProvider{
/** /**
* @param int $chunkX * @param int $chunkX
* @param int $chunkZ * @param int $chunkZ
* @param int &$x * @param int &$regionX
* @param int &$z * @param int &$regionZ
*/ */
public static function getRegionIndex(int $chunkX, int $chunkZ, &$x, &$z){ public static function getRegionIndex(int $chunkX, int $chunkZ, &$regionX, &$regionZ){
$x = $chunkX >> 5; $regionX = $chunkX >> 5;
$z = $chunkZ >> 5; $regionZ = $chunkZ >> 5;
} }
/** /**
* @param int $x * @param int $regionX
* @param int $z * @param int $regionZ
* *
* @return RegionLoader|null * @return RegionLoader|null
*/ */
protected function getRegion(int $x, int $z){ protected function getRegion(int $regionX, int $regionZ){
return $this->regions[Level::chunkHash($x, $z)] ?? null; return $this->regions[Level::chunkHash($regionX, $regionZ)] ?? null;
} }
/** /**
* @param int $x * @param int $regionX
* @param int $z * @param int $regionZ
*/ */
protected function loadRegion(int $x, int $z){ protected function loadRegion(int $regionX, int $regionZ){
if(!isset($this->regions[$index = Level::chunkHash($x, $z)])){ if(!isset($this->regions[$index = Level::chunkHash($regionX, $regionZ)])){
$this->regions[$index] = new RegionLoader($this, $x, $z, static::REGION_FILE_EXTENSION); $this->regions[$index] = new RegionLoader($this, $regionX, $regionZ, static::REGION_FILE_EXTENSION);
try{ try{
$this->regions[$index]->open(); $this->regions[$index]->open();
}catch(CorruptedRegionException $e){ }catch(CorruptedRegionException $e){
@ -447,7 +447,7 @@ class McRegion extends BaseLevelProvider{
rename($path, $backupPath); rename($path, $backupPath);
$logger->error("Corrupted region file has been backed up to " . $backupPath); $logger->error("Corrupted region file has been backed up to " . $backupPath);
$this->regions[$index] = new RegionLoader($this, $x, $z, static::REGION_FILE_EXTENSION); $this->regions[$index] = new RegionLoader($this, $regionX, $regionZ, static::REGION_FILE_EXTENSION);
$this->regions[$index]->open(); //this will create a new empty region to replace the corrupted one $this->regions[$index]->open(); //this will create a new empty region to replace the corrupted one
} }
} }