Skip to content

AngerTrait 5.46.0 ​

trait · pocketmine\entity\monster\AngerTrait · source

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) : void

Makes the nearby mobs of the given class angry at the target too.

getAngerTarget() ​

php
public function getAngerTarget() : ?\pocketmine\entity\Living

Returns the entity the mob is angry at, if it is still around.

isAngry() ​

php
public function isAngry() : bool

onAngerChange() protected ​

php
protected function onAngerChange(bool $angry) : void

Called when the mob becomes angry or calms down.

setAngryAt() ​

php
public function setAngryAt(?\pocketmine\entity\Living $target, int $ticks) : void

Makes 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

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.