mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-21 10:51:24 +00:00
Apparently intdiv() is fucking stupid
This commit is contained in:
parent
5b435e783c
commit
07cd2e5542
@ -32,7 +32,6 @@ use pocketmine\world\WorldCreationOptions;
|
|||||||
use Symfony\Component\Filesystem\Path;
|
use Symfony\Component\Filesystem\Path;
|
||||||
use function array_key_exists;
|
use function array_key_exists;
|
||||||
use function file_exists;
|
use function file_exists;
|
||||||
use function intdiv;
|
|
||||||
use function is_dir;
|
use function is_dir;
|
||||||
use function mkdir;
|
use function mkdir;
|
||||||
use function morton2d_decode;
|
use function morton2d_decode;
|
||||||
@ -107,13 +106,13 @@ final class RegionizedLevelDB extends BaseLevelDB{
|
|||||||
protected function getDBPathForCoords(int $chunkX, int $chunkZ) : string{
|
protected function getDBPathForCoords(int $chunkX, int $chunkZ) : string{
|
||||||
return Path::join(self::dbRegionPath($this->path, $this->regionLength), sprintf(
|
return Path::join(self::dbRegionPath($this->path, $this->regionLength), sprintf(
|
||||||
"db.%d.%d",
|
"db.%d.%d",
|
||||||
intdiv($chunkX, $this->regionLength),
|
(int) floor($chunkX / $this->regionLength),
|
||||||
intdiv($chunkZ, $this->regionLength)
|
(int) floor($chunkZ / $this->regionLength)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDBIndexForCoords(int $chunkX, int $chunkZ) : int{
|
protected function getDBIndexForCoords(int $chunkX, int $chunkZ) : int{
|
||||||
return morton2d_encode(intdiv($chunkX, $this->regionLength), intdiv($chunkZ, $this->regionLength));
|
return morton2d_encode((int) floor($chunkX / $this->regionLength), (int) floor($chunkZ / $this->regionLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fetchDBForCoords(int $chunkX, int $chunkZ, bool $createIfMissing) : ?\LevelDB{
|
protected function fetchDBForCoords(int $chunkX, int $chunkZ, bool $createIfMissing) : ?\LevelDB{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user