EntityTargetEvent 5.46.0
Extends EntityEvent
Implements Cancellable
Called when a mob picks a new attack target (like Paper's EntityTargetLivingEntityEvent): a monster spotting a player, a zombie going for a villager, a wolf hunting, a mob fighting back... Cancelling it keeps the mob without a target; the target can also be replaced. NPC plugins use it so that mobs leave their NPCs alone.
Methods
__construct()
php
public function __construct(\pocketmine\entity\Mob $entity, \pocketmine\entity\Living $target)getTarget()
php
public function getTarget() : \pocketmine\entity\LivingsetTarget()
php
public function setTarget(\pocketmine\entity\Living $target) : void