AngerTrait 5.46.0
Anger of a neutral mob (vanilla minecraft:angry): who it is angry at and for how many more ticks. Anger can be broadcast to mobs of the same kind nearby (zombified piglins, piglins, silverfish). Attacking the anger target is done by \pocketmine\entity\ai\hostile\goal\AngerTargetGoal.
The using class must call AngerTrait::tickAnger() every tick.
Methods
alertNearby() protected
php
protected function alertNearby(\pocketmine\entity\Living $target, float $range, string $class, int $ticks) : voidMakes the nearby mobs of the given class angry at the target too.
getAngerTarget()
php
public function getAngerTarget() : ?\pocketmine\entity\LivingReturns the entity the mob is angry at, if it is still around.
isAngry()
php
public function isAngry() : boolonAngerChange() protected
php
protected function onAngerChange(bool $angry) : voidCalled when the mob becomes angry or calms down.
setAngryAt()
php
public function setAngryAt(?\pocketmine\entity\Living $target, int $ticks) : voidMakes the mob angry at the target for the given ticks (-1: until the target is gone), or calms it down (null).
tickAnger() protected
php
protected function tickAnger(int $tickDiff) : void