Skip to content

Damage System

Damage types are stored under damage_types/*.yml. The current damage system uses a multi-stage pipeline instead of one fixed formula. Each damage type can define its own attack, defense, critical, penetration, recovery, and custom expression stages.

Damage type fields

FieldDescription
idDamage type id, such as physical, projectile, or spell.
display_nameDisplay name. Defaults to id.
aliasesOptional aliases.
hard_lockWhether this damage type strongly takes over matching vanilla damage events.
allowed_eventsVanilla event/cause allowlist. Empty means unrestricted.
message / attacker_message / target_messageCombat messages.
stagesOrdered calculation stages.
recoveryPost-damage recovery or lifesteal calculation.

Default damage types include physical, projectile, and spell.

Stage pipeline

Each stage can read attributes from the attacker, target, or context, then add or subtract the calculated result.

FieldDescription
idDebug id for the stage.
kindFLAT_PERCENT or CUSTOM.
sourceATTACKER, TARGET, or CONTEXT.
modeADD or SUBTRACT.
flat_attributesFlat contribution attributes.
percent_attributesPercentage contribution attributes.
chance_attributesChance attributes.
multiplier_attributesMultiplier attributes.
expressionCustom expression when kind=CUSTOM.
min_result / max_resultResult clamps.
min_chance / max_chanceChance clamps.
min_multiplier / max_multiplierMultiplier clamps.

Vanilla damage takeover modes

Global vanilla_event_damage.enabled controls the current vanilla event takeover mode:

  • enabled: true: recommended perfect takeover mode. Attribute does not cancel the vanilla damage event first. Instead, it resolves EA damage synchronously before the event returns and rewrites the final event damage in place. This preserves vanilla side effects such as burning zombies igniting players, iron golem knockback, shields, absorption hearts, thorns, death/stat handling, and other vanilla/plugin event effects.
  • enabled: false: compatibility mode. The old behavior cancels the event and re-applies damage/feedback through Attribute. Use it only when a server needs the legacy behavior or is integrating with special combat plugins.

Perfect takeover changes how damage is applied, not the configured damage-number pipeline. If the result is dodge, event cancellation, or final damage <= 0, the original event is cancelled for that hit. Attribute side effects such as lifesteal, combat messages, and attack cooldown handling are still applied by Attribute.

Synthetic hit feedback

Synthetic feedback mainly matters in compatibility mode. In perfect takeover mode, vanilla usually produces knockback, hurt animation, and sound naturally.

yaml
synthetic_hit_feedback:
  knockback: true
  knockback_strength: 0.4
  hurt_sound: true
FieldDescription
knockbackWhether to add knockback feedback.
knockback_strengthKnockback strength.
hurt_soundWhether to play hurt sound feedback.

Debugging

Use /ea debug and the module's damage debug output to inspect context variables, stage results, final damage, recovery, and event behavior.