Skip to content

AquaticChargeAttackGoal 5.47.0 ​

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

Extends Goal

Vanilla behavior.aquatic_charge_attack (nautilus, zombie nautilus): a swimming mob dashes in a straight line through its attack target, hits it once on the way (attack_reach 0: the bounding boxes touch) with extra knockback, keeps going for charge_overshoot_distance blocks past where the target was, and waits charge_cooldown_time before the next charge. A charge ends after max_charge_distance blocks at most. A target farther than that is first approached at the normal swimming speed (it has to be seen to start the charge).

The charge direction is chosen when the charge starts (Java ChargeAttack: a fixed velocity), so a target that moves away is missed. All the work is per-tick arithmetic on the running goal; nothing is searched.

Properties ​

$approachSpeed ​

php
public float $approachSpeed

$chargeSpeed ​

php
public float $chargeSpeed

$condition ​

php
public ?\Closure $condition

$cooldownTicks ​

php
public int $cooldownTicks

$damage ​

php
public float $damage

$followRange ​

php
public float $followRange

$knockback ​

php
public float $knockback

$maxChargeDistance ​

php
public float $maxChargeDistance

$mob ​

php
public \pocketmine\entity\Mob $mob

$overshoot ​

php
public float $overshoot

$stopSwimming ​

php
public \Closure $stopSwimming

$swimTowards ​

php
public \Closure $swimTowards

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, \Closure $swimTowards, \Closure $stopSwimming, float $chargeSpeed, float $approachSpeed, float $damage, float $knockback, float $maxChargeDistance = 16.0, float $overshoot = 1.5, int $cooldownTicks = 80, float $followRange = 32.0, ?\Closure $condition = null)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

isCharging() ​

php
public function isCharging() : bool

Returns whether the mob is dashing at its target (as opposed to swimming closer or not attacking).

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.