Interface OnDamageByEntitySkill

All Known Subinterfaces:
Thorns

public interface OnDamageByEntitySkill
Interface for skills that react when the pet receives damage from another entity. The combat listener calls trigger() first to check if the skill should fire (e.g., random chance based on level), and if it returns true, invokes apply(LivingEntity, EntityDamageByEntityEvent) to execute the reactive effect (e.g., Thorns reflecting damage back to the attacker).

Implementations are called from PetPvPListener / pet damage handling.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Applies this skill's reactive effect.
    boolean
    Determines whether this skill should fire for the current damage event.
  • Method Details

    • trigger

      boolean trigger()
      Determines whether this skill should fire for the current damage event. Typically based on a random chance scaled by the skill's upgrade level.
      Returns:
      true if the skill triggers; false to skip
    • apply

      void apply(LivingEntity damager, EntityDamageByEntityEvent event)
      Applies this skill's reactive effect.
      Parameters:
      damager - the entity that dealt damage to the pet
      event - the original damage event (can be modified, e.g., to reduce damage)