Skip to content

KineticWeaponGoal 5.47.0 ​

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

Extends Goal

Spear charges of mobs holding a spear (vanilla behavior.use_kinetic_weapon of zombies, husks and zombie villagers; Java SpearUseGoal): the mob walks up to its target until it is within $approachDistance, lowers the spear and charges at it; once next to it (or its path ended) it runs 6-7 blocks away from the target and charges again, until the spear's charge is over. Then it raises the spear and retreats 9-11 blocks away (at most 5 seconds), and the goal ends. While the spear is lowered every living thing it touches is hit like by a player's charge (see Spear), with the mob values of Bedrock: half the reach (weapon_reach_multiplier 0.5), a fifth of the minimum speeds (weapon_min_speed_multiplier 0.2), and the mob's attack damage added to the speed damage (Java KineticWeapon).

A mob riding another mob steers it (hijack_mount_navigation): the mount's own movement goals pause while the goal runs, and the mount's speed decides the hits.

Only runs while the mob has an attack target and holds a spear in its main hand.

Constants ​

MIN_SPEED_MULTIPLIER ​

php
public const MIN_SPEED_MULTIPLIER = 0.2

Bedrock weapon_min_speed_multiplier (Java mob action factor): mobs need a fifth of the speeds players need.

REACH_MULTIPLIER ​

php
public const REACH_MULTIPLIER = 0.5

Bedrock weapon_reach_multiplier: mobs reach half as far as players.

Properties ​

$approachDistance ​

php
public float $approachDistance

$baseDamage ​

php
public float $baseDamage

$condition ​

php
public ?\Closure $condition

$cooldown ​

php
public array $cooldown

$cooldownSpeedMultiplier ​

php
public float $cooldownSpeedMultiplier

$holdsSpear ​

php
public ?\Closure $holdsSpear

$mainHandItem ​

php
public \Closure $mainHandItem

$mob ​

php
public \pocketmine\entity\Mob $mob

$onUsingChanged ​

php
public ?\Closure $onUsingChanged

$reposition ​

php
public array $reposition

$repositionSpeedMultiplier ​

php
public float $repositionSpeedMultiplier

$speedMultiplier ​

php
public float $speedMultiplier

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, \Closure $mainHandItem, float $baseDamage = 3.0, float $approachDistance = 10.0, array $reposition = [6, 7], array $cooldown = [9, 11], float $speedMultiplier = 1.0, float $repositionSpeedMultiplier = 1.0, float $cooldownSpeedMultiplier = 1.0, ?\Closure $condition = null, ?\Closure $onUsingChanged = null, ?\Closure $holdsSpear = 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

Whether the spear is lowered (the charge is on).

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.