LocateCommand 5.46.0
Extends VanillaCommand
Implements ExhaustiveOverloads
Bedrock /locate:
- /locate biome <biome>: the closest biome of that type (vanilla worlds are searched from the generator's noise up to 6400 blocks away without generating chunks; other worlds only in their loaded chunks)
- /locate structure <structure> [useNewChunksOnly]: asks the world's StructureLocator (from the console: the default world, or its loaded Nether / End world if the structure only exists there)
- /locate <structure> [useNewChunksOnly]: older Bedrock syntax (console and plugins only: clients get just the two syntaxes above, with their biome and structure lists, and no free-text overload)
Slow searches (vanilla biomes, AsyncStructureLocators) run on the LocateWorkerPool, never on the main thread nor on the async pool that generates chunks; each sender may have one search running at a time, at most MAX_PENDING_SEARCHES searches are queued, and each gives up after SEARCH_TIMEOUT_SECONDS. Results use the vanilla messages (commands.locate.*), which the client shows in its own language.
Constants
BEDROCK_STRUCTURES
public const BEDROCK_STRUCTURES = ["ancient_city", "bastion_remnant", "buried_treasure", "end_city", "fortress", "mansion", "mineshaft", "monument", "pillager_outpost", "ruined_portal", "ruins", "shipwreck", "stronghold", "temple", "trail_ruins", "trial_chambers", "village"]Structure names of Bedrock's /locate structure (the client suggests them).
MAX_PENDING_SEARCHES
public const MAX_PENDING_SEARCHES = 4Searches queued or running on the /locate worker at most (all senders together).
SEARCH_TIMEOUT_SECONDS
public const SEARCH_TIMEOUT_SECONDS = 60A biome or structure search running longer than this is abandoned (and reported as not found).
STRUCTURE_RADIUS_CHUNKS
public const STRUCTURE_RADIUS_CHUNKS = 400Search radius of /locate structure, in chunks (6400 blocks, like /locate biome).
Methods
__construct()
public function __construct()execute()
public function execute(\pocketmine\command\CommandSender $sender, string $commandLabel, array $args)getOverloads()
public function getOverloads() : arraysuggestNames()
public static function suggestNames(string $typed, array $known, array $preferred = []) : arrayUp to 3 known names close to what was typed ("ender" -> "end_city"), most similar first; $preferred names (the ones the client suggests) win over aliases that are as close.
