Minecraft wiki entry for Damage, associated text: If an entity is in the immunity period and then receives higher damage (before accounting for armor, enchantments, or status effects), the difference between the original and new damage amounts is dealt. For example, if a mob is attacked with a weapon dealing 7 damage and then attacked with another weapon dealing 12 × 6 damage during the immunity period, the second hit deals 5 damage (resulting in 12 × 6 total). This does not reset the immunity period.