Skip to content

EatCarriedItemGoal 5.47.0 ​

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

Extends Goal

Eats the food the mob carries (vanilla behavior.eat_carried_item of foxes): once it held the food for $delay ticks while $canEat allows it (on the ground, no target...), $eat consumes it. The last ticks show the eating particles and play the eating sound (Java Fox.aiStep(): entity event 45 and the eating sound just before eating).

It needs no control of its own: the mob may walk around while it chews. Without food it costs one call of $heldFood per goal evaluation.

Properties ​

$canEat ​

php
public \Closure $canEat

$delay ​

php
public int $delay

$eat ​

php
public \Closure $eat

$heldFood ​

php
public \Closure $heldFood

$mob ​

php
public \pocketmine\entity\Mob $mob

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Mob $mob, \Closure $heldFood, \Closure $eat, \Closure $canEat, int $delay = 28)

canContinue() ​

php
public function canContinue() : bool

canStart() ​

php
public function canStart() : bool

getFlags() ​

php
public function getFlags() : int

start() ​

php
public function start() : void

tick() ​

php
public function tick() : void

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