Stop hardcoding chunk dimensions everywhere (#4443)

This commit is contained in:
Dylan T
2021-09-10 16:13:25 +01:00
committed by GitHub
parent 9d5a86fe53
commit 4111d92b98
24 changed files with 166 additions and 140 deletions

View File

@@ -31,6 +31,7 @@ use pocketmine\lang\KnownTranslationFactory;
use pocketmine\player\ChunkSelector;
use pocketmine\Server;
use pocketmine\timings\Timings;
use pocketmine\world\format\Chunk;
use pocketmine\world\format\io\exception\CorruptedWorldException;
use pocketmine\world\format\io\exception\UnsupportedWorldFormatException;
use pocketmine\world\format\io\FormatConverter;
@@ -268,8 +269,8 @@ class WorldManager{
$this->server->getLogger()->notice($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_level_backgroundGeneration($name)));
$spawnLocation = $world->getSpawnLocation();
$centerX = $spawnLocation->getFloorX() >> 4;
$centerZ = $spawnLocation->getFloorZ() >> 4;
$centerX = $spawnLocation->getFloorX() >> Chunk::COORD_BIT_SIZE;
$centerZ = $spawnLocation->getFloorZ() >> Chunk::COORD_BIT_SIZE;
$selected = iterator_to_array((new ChunkSelector())->selectChunks(8, $centerX, $centerZ));
$done = 0;