Skip to content

MoveTowardsHomeRestrictionGoal 5.47.0 ​

class · pocketmine\entity\ai\goal\MoveTowardsHomeRestrictionGoal · source

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.0

Blocks 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 $speedMultiplier

Methods ​

__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() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

start() ​

php
public function start() : void

stop() ​

php
public function stop() : void

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.