Class ArmorHurtEvent
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.ArmorHurtEvent
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
Fired on both sides when a
LivingEntity's armor is dealt damage in
doHurtEquipment.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEventNested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EnumMap<EquipmentSlot, ArmorHurtEvent.ArmorEntry> private final DamageSource -
Constructor Summary
ConstructorsConstructorDescriptionArmorHurtEvent(EnumMap<EquipmentSlot, ArmorHurtEvent.ArmorEntry> armorMap, LivingEntity player, DamageSource source) -
Method Summary
Modifier and TypeMethodDescriptionProvides the Itemstack for the given slot.Used internally to get the full map ofItemStacks to be hurtReturns theDamageSourcecausing the damage.getNewDamage(EquipmentSlot slot) Returns the amount to hurt the armor if the event is not cancelled.Returns the original damage before any event modifications.voidsetNewDamage(EquipmentSlot slot, float damage) Sets new damage for the armor.Methods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
source
-
armorEntries
-
-
Constructor Details
-
ArmorHurtEvent
@Internal public ArmorHurtEvent(EnumMap<EquipmentSlot, ArmorHurtEvent.ArmorEntry> armorMap, LivingEntity player, DamageSource source)
-
-
Method Details
-
getArmorItemStack
Provides the Itemstack for the given slot. Hand slots will always returnItemStack.EMPTY- Returns:
- the
ItemStackto be hurt for the given slot
-
getOriginalDamage
Returns the original damage before any event modifications.- Returns:
- the original damage before any event modifications
-
getNewDamage
Returns the amount to hurt the armor if the event is not cancelled.- Returns:
- the amount to hurt the armor if the event is not cancelled
-
setNewDamage
Sets new damage for the armor. Setting damage for empty slots will have no effect.- Parameters:
damage- the new amount to hurt the armor. Values below zero will be set to zero.
-
getArmorMap
Used internally to get the full map ofItemStacks to be hurt -
getDamageSource
Returns theDamageSourcecausing the damage.- Returns:
- the
DamageSourcecausing the damage
-