类 LivingChangeTargetEvent

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

public class LivingChangeTargetEvent extends LivingEvent
This event allows you to change the target an entity has.
This event is fired before
引用无效
LivingSetAttackTargetEvent
.

This event is fired via the
引用无效
ForgeHooks#onLivingChangeTarget(LivingEntity, LivingEntity, ILivingTargetType)


getOriginalTarget() returns the target that should originally be set. The return value cannot be affected by calling setNewTarget(LivingEntity).
getNewTarget() returns the new target that this entity will have. The return value can be affected by calling setNewTarget(LivingEntity).
getTargetType() returns the target type that caused the change of targets.

This event is Cancelable.

If you cancel this event, the target will not be changed and it will stay the same. Cancelling this event will prevent
引用无效
LivingSetAttackTargetEvent
from being posted.

This event does not have a result. Event.HasResult

This event is fired on the MinecraftForge.EVENT_BUS.
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getNewTarget

      public LivingEntity getNewTarget()
      返回 the new target of this entity.。
      返回:
      the new target of this entity.
    • setNewTarget

      public void setNewTarget(LivingEntity newTarget)
      Sets the new target this entity shall have.
      参数:
      newTarget - The new target of this entity.
    • getTargetType

      返回 the living target type.。
      返回:
      the living target type.
    • getOriginalTarget

      public LivingEntity getOriginalTarget()
      返回 the original entity MC intended to use as a target before firing this event.。
      返回:
      the original entity MC intended to use as a target before firing this event.