Class AbilityChargeActivator

java.lang.Object
com.hypixel.hytale.builtin.abilities.trigger.AbilityChargeActivator

public final class AbilityChargeActivator extends Object
The shared body of the ability charge systems: finds the armed AbilityCharges.Entry records whose buff is still active and whose ability allows the held item, then spends a charge on each and runs its per-activation interaction server-simulated on the carrier.
  • Method Details

    • getArmed

      @Nonnull public static List<AbilityCharges.Entry> getArmed(@Nonnull Ref<EntityStore> ref, @Nonnull AbilityChargeTrigger trigger, @Nonnull CommandBuffer<EntityStore> commandBuffer)
      Returns:
      the carrier's entries for trigger that can activate right now, empty when none. Entries whose buff expired on its own are dropped here.
    • activate

      public static void activate(@Nonnull Ref<EntityStore> ref, @Nonnull AbilityCharges.Entry entry, @Nullable Ref<EntityStore> targetRef, @Nonnull CommandBuffer<EntityStore> commandBuffer)
      Spends one charge of entry and runs its per-activation interaction. When the last charge goes, the buff effect and the entry are removed, and the component with it once no entry remains.
      Parameters:
      targetRef - the hit entity for an OnHit activation, exposed to the interaction as its target entity. null for OnPrimaryActivation.