Skip to content

LocateWorkerPool 5.46.0 ​

final class · pocketmine\world\locate\LocateWorkerPool · source

A separate async pool with a single worker for /locate searches (biome noise sampling, structure placement checks).

The server's async pool also generates chunks, so long searches there delay terrain for players; this pool is started on first use and shut down after IDLE_SECONDS without work, so it costs nothing on servers that never use /locate. Callers should limit how many searches they queue (getPendingCount()).

Constants ​

IDLE_SECONDS ​

php
public const IDLE_SECONDS = 60

Seconds without queued tasks after which the worker thread is stopped.

Methods ​

getInstance() ​

php
public static function getInstance(\pocketmine\Server $server) : self

getPendingCount() ​

php
public function getPendingCount() : int

Number of tasks queued or running on the locate worker.

isRunning() ​

php
public function isRunning() : bool

shutdown() ​

php
public function shutdown() : void

submitTask() ​

php
public function submitTask(\pocketmine\scheduler\AsyncTask $task) : void

Submits a task to the locate worker, starting it if needed.

tick() ​

php
public function tick() : void

Collects finished tasks and stops the worker once it has been idle for IDLE_SECONDS. Called by the server once per second.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.