类 LivingChangeTargetEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.living.LivingChangeTargetEvent
- 所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent
public class LivingChangeTargetEvent
extends LivingEvent
implements net.neoforged.bus.api.ICancellableEvent
This event allows you to change the target an entity has.
This event is fired before
.
This event is fired via the
This event is
If you cancel this event, the target will not be changed and it will stay the same. Cancelling this event will prevent
from being posted.
This event does not have a result.
This event is fired on the
This event is fired before
引用无效
LivingSetAttackTargetEvent
This event is fired via the
CommonHooks.onLivingChangeTarget(LivingEntity, LivingEntity, ILivingTargetType)
getOriginalAboutToBeSetTarget()
returns the target that should originally be set.
The return value cannot be affected by calling setNewAboutToBeSetTarget(LivingEntity)
.getNewAboutToBeSetTarget()
returns the new target that this entity will have.
The return value can be affected by calling setNewAboutToBeSetTarget(LivingEntity)
.getTargetType()
returns the target type that caused the change of targets.This event is
ICancellableEvent
.If you cancel this event, the target will not be changed and it will stay the same. Cancelling this event will prevent
引用无效
LivingSetAttackTargetEvent
This event does not have a result.
引用无效
Event.HasResult
This event is fired on the
NeoForge.EVENT_BUS
.-
嵌套类概要
嵌套类修饰符和类型类说明static interface
A living target type indicates what kind of system caused a change of targets.static enum
This enum contains two default living target types.从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
字段概要
字段修饰符和类型字段说明private @Nullable LivingEntity
private final @Nullable LivingEntity
private final LivingChangeTargetEvent.ILivingTargetType
-
构造器概要
构造器构造器说明LivingChangeTargetEvent
(LivingEntity entity, @Nullable LivingEntity aboutToBeSetTarget, LivingChangeTargetEvent.ILivingTargetType targetType) -
方法概要
修饰符和类型方法说明@Nullable LivingEntity
返回 the new target that this entity will begin to track.。@Nullable LivingEntity
返回 the original entity MC intended to use as a target before firing this event.。返回 the living target type.。void
setNewAboutToBeSetTarget
(@Nullable LivingEntity newAboutToBeSetTarget) Sets the new target this entity shall have.从类继承的方法 net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
字段详细资料
-
targetType
-
originalAboutToBeSetTarget
-
newAboutToBeSetTarget
-
-
构造器详细资料
-
LivingChangeTargetEvent
public LivingChangeTargetEvent(LivingEntity entity, @Nullable @Nullable LivingEntity aboutToBeSetTarget, LivingChangeTargetEvent.ILivingTargetType targetType)
-
-
方法详细资料
-
getNewAboutToBeSetTarget
返回 the new target that this entity will begin to track.。- 返回:
- the new target that this entity will begin to track.
-
setNewAboutToBeSetTarget
Sets the new target this entity shall have.- 参数:
newAboutToBeSetTarget
- The new target that this entity will begin to track
-
getTargetType
返回 the living target type.。- 返回:
- the living target type.
-
getOriginalAboutToBeSetTarget
返回 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.
-