类 LivingIncomingDamageEvent
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.LivingIncomingDamageEvent
- 所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent
public class LivingIncomingDamageEvent
extends LivingEvent
implements net.neoforged.bus.api.ICancellableEvent
LivingIncomingDamageEvent is fired when a LivingEntity is about to receive damage.
This event is fired in
For custom posting of this event, the event expects to be fired before any damage reductions have been calculated. This event expects a mutable
This event is fired via the
This event is fired in
Entity.hurt(DamageSource, float)
after invulnerability checks but before any damage processing/mitigation.
For custom posting of this event, the event expects to be fired before any damage reductions have been calculated. This event expects a mutable
DamageContainer
.
This event is fired via the
CommonHooks.onEntityIncomingDamage(LivingEntity, DamageContainer)
.- 另请参阅:
-
嵌套类概要
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
addReductionModifier
(DamageContainer.Reduction type, IReductionFunction reductionFunc) Reduction modifiers alter the vanilla damage reduction before it modifies the damage value.float
返回 the current damage to be applied to the entity。返回 the container for this damage sequence。float
返回 the damage value passed into the damage sequence before modifications。返回 theDamageSource
for this damage sequence。void
setAmount
(float newDamage) void
setInvulnerabilityTicks
(int ticks) When an entity's invulnerable time is fully cooled down, 20 ticks of invulnerability is added on the next attack.从类继承的方法 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
-
字段详细资料
-
container
-
-
构造器详细资料
-
LivingIncomingDamageEvent
-
-
方法详细资料
-
getContainer
返回 the container for this damage sequence。- 返回:
- the container for this damage sequence
-
getSource
返回 theDamageSource
for this damage sequence。- 返回:
- the
DamageSource
for this damage sequence
-
getAmount
public float getAmount()返回 the current damage to be applied to the entity。- 返回:
- the current damage to be applied to the entity
-
getOriginalAmount
public float getOriginalAmount()返回 the damage value passed into the damage sequence before modifications。- 返回:
- the damage value passed into the damage sequence before modifications
-
setAmount
public void setAmount(float newDamage) - 参数:
newDamage
- the damage value to be used in the rest of the damage sequence.
-
addReductionModifier
Reduction modifiers alter the vanilla damage reduction before it modifies the damage value. Modifiers are executed in sequence.- 参数:
type
- the reduction type to be modifiedreductionFunc
- the function to apply to the reduction value.
-
setInvulnerabilityTicks
public void setInvulnerabilityTicks(int ticks) When an entity's invulnerable time is fully cooled down, 20 ticks of invulnerability is added on the next attack. This method allows for setting a new invulnerability tick count when those conditions are met.
Note: this value will be ignored if the damage is taken while invulnerability ticks are greater than 10 and the damage source does not bypass invulnerability- 参数:
ticks
- the number of ticks for the entity to remain invulnerable to incoming damage
-