StrollTowardsVillageGoal 5.47.0
Extends Goal
Walks to a village nearby (vanilla behavior.stroll_towards_village of foxes at night: search_range 32, start_chance 0.005, cooldown 10 s, goal_radius 3; that is how foxes end up among the chickens of villages): a random point of interest of a village (a bell first, else a bed or a job site) within $searchRange blocks.
The points of interest come from the world's cached POI data (World::getPoiManager()), asked only when the start chance is met (about once every 10 seconds per mob), and only while $condition allows it (night).
Properties
$condition
php
public ?\Closure $condition$cooldown
php
public int $cooldown$goalRadius
php
public float $goalRadius$mob
php
public \pocketmine\entity\Mob $mob$searchRange
php
public int $searchRange$speedMultiplier
php
public float $speedMultiplier$startChance
php
public float $startChanceMethods
__construct()
php
public function __construct(\pocketmine\entity\Mob $mob, float $speedMultiplier = 1.0, int $searchRange = 32, float $startChance = 0.005, int $cooldown = 200, float $goalRadius = 3.0, ?\Closure $condition = null)canContinue()
php
public function canContinue() : boolcanStart()
php
public function canStart() : boolgetFlags()
php
public function getFlags() : intpickTarget()
php
public function pickTarget(\pocketmine\world\World $world, \pocketmine\math\Vector3 $from) : ?\pocketmine\math\Vector3Returns a random point of interest of a village within the search range farther than the goal radius: a bell if there is one, else a bed or a job site.
start()
php
public function start() : voidstop()
php
public function stop() : voidtick()
php
public function tick() : void