Separate TickingChunkLoader from ChunkLoader

this makes it possible to keep chunks loaded without ticking them.
This commit is contained in:
Dylan K. Taylor
2021-03-18 23:19:27 +00:00
parent d1387ebd0a
commit c092a2e836
6 changed files with 54 additions and 14 deletions

View File

@ -211,7 +211,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
protected $chunksPerTick;
/** @var ChunkSelector */
protected $chunkSelector;
/** @var TickingChunkLoader */
/** @var PlayerChunkLoader */
protected $chunkLoader;
/** @var bool[] map: raw UUID (string) => bool */
@ -295,7 +295,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$onGround = true;
}
$this->chunkLoader = new TickingChunkLoader($spawn);
$this->chunkLoader = new PlayerChunkLoader($spawn);
//load the spawn chunk so we can see the terrain
$world->registerChunkLoader($this->chunkLoader, $spawn->getFloorX() >> 4, $spawn->getFloorZ() >> 4, true);

View File

@ -24,9 +24,9 @@ declare(strict_types=1);
namespace pocketmine\player;
use pocketmine\math\Vector3;
use pocketmine\world\ChunkLoader;
use pocketmine\world\TickingChunkLoader;
final class TickingChunkLoader implements ChunkLoader{
final class PlayerChunkLoader implements TickingChunkLoader{
/** @var Vector3 */
private $currentLocation;