Class LivingSetAttackTargetEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.event.entity.living.LivingEvent
net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent

@Deprecated(since="1.19.2", forRemoval=true) public class LivingSetAttackTargetEvent extends LivingEvent
Deprecated, for removal: This API element is subject to removal in a future version.
This event is deprecated. Use LivingChangeTargetEvent instead.

LivingSetAttackTargetEvent is fired when an Entity sets a target to attack.
This event is fired whenever an Entity sets a target to attack in Mob.setTarget(LivingEntity) or StartAttacking#setAttackTarget(Mob, LivingEntity)

This event is fired via the ForgeHooks.onLivingSetAttackTarget(LivingEntity, LivingEntity).

getTarget() returns the newly targeted Entity.
getTargetType() returns the target type that caused the change of targets.

This event is not Cancelable.

This event does not have a result. Event.HasResult

This event is fired on the MinecraftForge.EVENT_BUS.
  • Field Details

    • targetType

      Deprecated, for removal: This API element is subject to removal in a future version.
    • originalTarget

      private final LivingEntity originalTarget
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

  • Method Details

    • getTarget

      public LivingEntity getTarget()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the target this living entity had after changing its target to a new target, but before posting this event..
      Returns:
      the target this living entity had after changing its target to a new target, but before posting this event.
    • getTargetType

      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the target type of this event..
      Returns:
      the target type of this event.