Package de.Keyle.MyPet.api.skill
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 TypeMethodDescriptionvoidapply(LivingEntity damager, EntityDamageByEntityEvent event) Applies this skill's reactive effect.booleantrigger()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:
trueif the skill triggers;falseto skip
-
apply
Applies this skill's reactive effect.- Parameters:
damager- the entity that dealt damage to the petevent- the original damage event (can be modified, e.g., to reduce damage)
-