Skip to content

AiBudget 5.46.0 ​

final class · pocketmine\entity\ai\AiBudget · source

Server-wide limits on mob AI work per tick (pocketmine.yml "mobs" section).

Mobs over the AI update budget keep following their current path and look target, but don't evaluate new goals until a later tick. Path searches over their budget are retried by the navigator on a later tick.

Constants ​

DEFAULT_MAX_AI_UPDATES_PER_TICK ​

php
public const DEFAULT_MAX_AI_UPDATES_PER_TICK = 200

DEFAULT_MAX_PATH_SEARCHES_PER_TICK ​

php
public const DEFAULT_MAX_PATH_SEARCHES_PER_TICK = 10

Methods ​

configure() ​

php
public static function configure(bool $enabled, int $maxAiUpdates, int $maxPathSearches, int $maxPathNodes = 400, bool $requireNearbyPlayer = true) : void

Overrides the configuration (tests, plugins).

getMaxPathNodes() ​

php
public static function getMaxPathNodes() : int

isEnabled() ​

php
public static function isEnabled() : bool

Whether mob AI runs at all (mobs.enabled).

load() ​

php
public static function load(\pocketmine\Server $server) : void

requiresNearbyPlayer() ​

php
public static function requiresNearbyPlayer() : bool

Whether mobs only run their AI with a player nearby (always true on a server; tests turn it off).

tryAiUpdate() ​

php
public static function tryAiUpdate(int $currentTick) : bool

Takes one full AI update (goal evaluation) from this tick's budget. Returns false if it's exhausted.

tryPathSearch() ​

php
public static function tryPathSearch(int $currentTick) : bool

Takes one path search from this tick's budget. Returns false if it's exhausted.

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