MoveTowardsHomeRestrictionGoal 5.47.0
Extends Goal
Brings a mob that is outside its home restriction (see \pocketmine\entity\HomeTrait) back towards its home (vanilla behavior.move_towards_home_restriction, Java MoveTowardsRestrictionGoal): it heads for a point up to MoveTowardsHomeRestrictionGoal::STEP blocks towards the home, which is again inside the radius once the mob is no farther than that, and starts over from there if it is still outside.
Mobs moving with a navigation walk, fly or swim there with it; free swimmers (guardians) pass their FreeMoveControl and swim straight there. Checking whether it may start is one distance comparison (evaluated every few ticks like every goal).
Constants
STEP
php
public const STEP = 16.0Blocks towards home of each leg (Java DefaultRandomPos.getPosTowards(mob, 16, 7, ...)).
Properties
$control
php
public ?\pocketmine\entity\ai\hostile\FreeMoveControl $control$controlSpeed
php
public float $controlSpeed$mob
php
public \pocketmine\entity\Mob $mob$retryCooldown
php
public int $retryCooldown$speedMultiplier
php
public float $speedMultiplierMethods
__construct()
php
public function __construct(\pocketmine\entity\Mob $mob, float $speedMultiplier = 1.0, ?\pocketmine\entity\ai\hostile\FreeMoveControl $control = null, float $controlSpeed = 0.1, int $retryCooldown = 0)canContinue()
php
public function canContinue() : boolcanStart()
php
public function canStart() : boolgetFlags()
php
public function getFlags() : intstart()
php
public function start() : voidstop()
php
public function stop() : void