Skip to content

SwimWithEntityGoal 5.47.0 ​

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

Extends Goal

Swims along with a swimming player (Bedrock behavior.swim_with_entity, dolphins): every state_check_interval the mob without a companion picks the nearest player swimming within search_range with success_rate, and a mob swimming with one stops with chance_to_stop. It swims to the player at speed_multiplier, at catch_up_multiplier when farther than catch_up_threshold, stops within stop_distance and, within match_direction_threshold, looks where the player looks (swims alongside).

Properties ​

$catchUpMultiplier ​

php
public float $catchUpMultiplier

$catchUpThreshold ​

php
public float $catchUpThreshold

$chanceToStop ​

php
public float $chanceToStop

$filter ​

php
public ?\Closure $filter

$matchDirectionThreshold ​

php
public float $matchDirectionThreshold

$mob ​

php
public \pocketmine\entity\Mob $mob

$searchRange ​

php
public float $searchRange

$speedMultiplier ​

php
public float $speedMultiplier

$stateCheckInterval ​

php
public int $stateCheckInterval

$stopDistance ​

php
public float $stopDistance

$successRate ​

php
public float $successRate

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, float $speedMultiplier = 1.5, float $searchRange = 20.0, float $successRate = 0.1, float $chanceToStop = 0.0333, int $stateCheckInterval = 10, float $catchUpThreshold = 12.0, float $catchUpMultiplier = 2.5, float $matchDirectionThreshold = 2.0, float $stopDistance = 5.0, ?\Closure $filter = null)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

getPlayer() ​

php
public function getPlayer() : ?\pocketmine\player\Player

Returns the player the mob swims with, if any.

start() ​

php
public function start() : void

stop() ​

php
public function stop() : void

tick() ​

php
public function tick() : void

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