fromEvent

public static ArmorDefenseCalculator.DamageType fromEvent(EntityDamageByEntityEvent event)

Maps an EntityDamageByEntityEvent's cause to a DamageType.

This determines which protection enchantments are relevant for the attack:

  • ENTITY_ATTACK, ENTITY_SWEEP_ATTACK → MELEE
  • PROJECTILE → PROJECTILE (arrows, fireballs aimed at player)
  • ENTITY_EXPLOSION, BLOCK_EXPLOSION → EXPLOSION (creepers, ghasts)
  • FIRE, FIRE_TICK → FIRE
  • Everything else → OTHER (treated as MELEE for enchant purposes)

Return

The classified damage type

Parameters

event

The damage event to classify