Class ArmorHurtEvent

java.lang.Object
net.neoforged.bus.api.Event
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent

public class ArmorHurtEvent extends LivingEvent implements net.neoforged.bus.api.ICancellableEvent
Fired on both sides when a LivingEntity's armor is dealt damage in doHurtEquipment.
  • Field Details

  • Constructor Details

  • Method Details

    • getArmorItemStack

      public ItemStack getArmorItemStack(EquipmentSlot slot)
      Provides the Itemstack for the given slot. Hand slots will always return ItemStack.EMPTY
      Returns:
      the ItemStack to be hurt for the given slot
    • getOriginalDamage

      public Float getOriginalDamage(EquipmentSlot slot)
      Returns the original damage before any event modifications.
      Returns:
      the original damage before any event modifications
    • getNewDamage

      public Float getNewDamage(EquipmentSlot slot)
      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

      public void setNewDamage(EquipmentSlot slot, float damage)
      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 of ItemStacks to be hurt