Class PetOnHitSkillEvent

All Implemented Interfaces:
Cancellable

public class PetOnHitSkillEvent extends CancellablePetEvent
Fired before a pet's on-hit skill executes against a living target. Dispatched once per on-hit skill per strike — a pet with both Bleed and Fire on a single mêlée swing fires the event twice in sequence.

Fires from PetSkillTriggerListener during the mêlée chain, after PetDamageEvent (the damage step) and before each OnHitSkill.apply(LivingEntity) call.

Cancellable: cancellation suppresses this specific on-hit skill; other on-hit skills in the chain still run. To veto the entire strike, cancel PetDamageEvent instead — that aborts the damage and the full on-hit chain together.

Pet state: live pet, with the owner online. Skill is the live OnHitSkill instance — listeners may call its accessors to read upgrade levels but should not mutate state mid-strike.

Note: there is no symmetric event for active-skill dispatch. Active skills run via the skill's own activate() flow without a per-skill event hook today.

  • Constructor Details

    • PetOnHitSkillEvent

      public PetOnHitSkillEvent(Pet pet, OnHitSkill skill, LivingEntity target)
      Creates the event for one on-hit skill in a mêlée strike.
      Parameters:
      pet - the attacking pet
      skill - the on-hit skill about to run
      target - the entity it will be applied to
  • Method Details

    • getHandlerList

      public static HandlerList getHandlerList()
      Returns the handler list for this event type.
      Returns:
      the shared HandlerList every PetOnHitSkillEvent is dispatched through
    • getHandlers

      public @NonNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getPet

      public Pet getPet()
      The pet whose skill is about to fire.
      Specified by:
      getPet in class PetEvent
      Returns:
      the attacking pet
    • getSkill

      public OnHitSkill getSkill()
      The live skill instance about to run. Safe to read for upgrade levels; do not mutate it mid-strike.
      Returns:
      the on-hit skill about to run
    • getTarget

      public LivingEntity getTarget()
      The entity the skill will be applied to.
      Returns:
      the entity it will be applied to