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 classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
-
Constructor Summary
ConstructorDescriptionArmorHurtEvent
(EnumMap<EquipmentSlot, ArmorHurtEvent.ArmorEntry> armorMap, LivingEntity player) -
Method Summary
Modifier and TypeMethodDescriptionProvides the Itemstack for the given slot.Used internally to get the full map ofItemStack
s to be hurtgetNewDamage
(EquipmentSlot slot) Returns the amount to hurt the armor if the event is not cancelled.Returns the original damage before any event modifications.void
setNewDamage
(EquipmentSlot slot, float damage) Sets new damage for the armor.Methods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
armorEntries
-
-
Constructor Details
-
ArmorHurtEvent
@Internal public ArmorHurtEvent(EnumMap<EquipmentSlot, ArmorHurtEvent.ArmorEntry> armorMap, LivingEntity player)
-
-
Method Details
-
getArmorItemStack
Provides the Itemstack for the given slot. Hand slots will always returnItemStack.EMPTY
- Returns:
- the
ItemStack
to 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 ofItemStack
s to be hurt
-