Interface ElementComponent

All Superinterfaces:
org.ladysnake.cca.api.v3.component.sync.AutoSyncedComponent, org.ladysnake.cca.api.v3.component.tick.ClientTickingComponent, org.ladysnake.cca.api.v3.component.tick.CommonTickingComponent, org.ladysnake.cca.api.v3.component.Component, org.ladysnake.cca.api.v3.component.sync.ComponentPacketWriter, org.ladysnake.cca.api.v3.component.sync.PlayerSyncPredicate, org.ladysnake.cca.api.v3.component.tick.ServerTickingComponent
All Known Implementing Classes:
ElementComponentImpl

public interface ElementComponent extends org.ladysnake.cca.api.v3.component.sync.AutoSyncedComponent, org.ladysnake.cca.api.v3.component.tick.CommonTickingComponent
  • Field Details

    • KEY

      static final org.ladysnake.cca.api.v3.component.ComponentKey<ElementComponent> KEY
  • Method Details

    • denyElementsFor

      static <T extends LivingEntity> void denyElementsFor(Class<T> entityClass)
      Denies Elemental Applications for the specific entity class.

      The provided entity class, and all its subclasses, cannot have elements applied to them, either by force or naturally.
      Parameters:
      entityClass - The entity to deny Elemental Applications for.
    • applyElementalInfusions

      static ElementalDamageSource applyElementalInfusions(DamageSource source, LivingEntity target)
    • attemptEntityDamageInfusions

      private static Optional<ElementalDamageSource> attemptEntityDamageInfusions(DamageSource source, LivingEntity target)
    • attemptDamageTypeInfusions

      private static Optional<ElementalDamageSource> attemptDamageTypeInfusions(DamageSource source, LivingEntity target)
    • attemptProjectileInfusions

      private static Optional<ElementalDamageSource> attemptProjectileInfusions(DamageSource source, LivingEntity target)
    • get

      @Nullable private static <T> T get(Optional<T> optional)
    • getOwner

      LivingEntity getOwner()
    • getElementHolder

      ElementHolder getElementHolder(Element element)
    • getLastReaction

      Pair<ElementalReaction,Long> getLastReaction()
    • hasLastReaction

      default boolean hasLastReaction()
    • hasValidLastReaction

      default boolean hasValidLastReaction()
    • isElectroChargedOnCD

      boolean isElectroChargedOnCD()
    • isBurningOnCD

      boolean isBurningOnCD()
    • resetElectroChargedCD

      void resetElectroChargedCD()
    • resetBurningCD

      void resetBurningCD()
    • setElectroChargedOrigin

      void setElectroChargedOrigin(@Nullable @Nullable LivingEntity origin)
    • setBurningOrigin

      void setBurningOrigin(@Nullable @Nullable LivingEntity origin)
    • getElectroChargedOrigin

      @Nullable @Nullable LivingEntity getElectroChargedOrigin()
    • getBurningOrigin

      @Nullable @Nullable LivingEntity getBurningOrigin()
    • getFreezeDecayTimeModifier

      double getFreezeDecayTimeModifier()
      Gets the current decay time modifier for the Freeze aura.

      Freeze is a special element: its decay is unique.
      • Freeze's gauge decay starts with the standard rate: 0.4 GU/s
      • For every second the entity is frozen, the gauge decay increases by 0.1 GU/s, hence 0.1 GU/s² acceleration
      • When the entity is unfrozen, the gauge decay decreases by 0.2 GU/s until it is back at 0.4 GU/s, hence 0.2 GU/s² deceleration
      By extending the Freeze formula, we get a generalized Freeze duration formula for consecutive Frozen reactions.

      sum(max(0, t_frozen_i - 2 t_unfrozen_i))

      i is a Frozen and unfrozen instance, and since we reset only when it is 0 due to being negative, we could drop the sum() function, as this behaves exactly like the mathematical model, given that we update the frozenTime and unfrozenTime accordingly.

      Retrieved from: https://library.keqingmains.com/combat-mechanics/elemental-effects/transformative-reactions#frozen.
    • setOrRetainElectroChargedOrigin

      default void setOrRetainElectroChargedOrigin(@Nullable @Nullable LivingEntity origin)
    • setOrRetainBurningOrigin

      default void setOrRetainBurningOrigin(@Nullable @Nullable LivingEntity origin)
    • setCrystallizeShield

      void setCrystallizeShield(Element element, double amount)
      Grants this entity a Crystallize shield.
      Parameters:
      element - The element of this Crystallize shield.
      amount - The amount of HP this shield has.
    • getCrystallizeShield

      @Nullable @Nullable Pair<Element,Double> getCrystallizeShield()
      Gets the current Crystallize Shield of this entity.
    • reduceCrystallizeShield

      float reduceCrystallizeShield(DamageSource source, float amount)
      Reduces the Crystallize shield and returns the effective amount of DMG reduced.
      Parameters:
      source - The DamageSource. If this isn't an instance of ElementalDamageSource, 0 is returned.
      amount - The amount of damage to be dealt to the entity.
    • reducedCrystallizeShield

      boolean reducedCrystallizeShield()
      Returns whether the Crystallize Shield has been reduced in the current tick.
    • canApplyElement

      default boolean canApplyElement(Element element, InternalCooldownContext icdContext)
      Checks if the element can be applied.
      Parameters:
      element - The element to check.
      icdContext - The InternalCooldownContext of the Element to be applied.
    • canApplyElement

      boolean canApplyElement(Element element, InternalCooldownContext icdContext, boolean handleICD)
      Checks if the element can be applied.
      Parameters:
      element - The element to check.
      icdContext - The InternalCooldownContext of the Element to be applied.
      handleICD - Whether the ICD should be handled. This will register a "hit" to the gauge sequence.
    • addElementalApplication

      default List<ElementalReaction> addElementalApplication(Element element, InternalCooldownContext icdContext, double gaugeUnits)
    • addElementalApplication

      default List<ElementalReaction> addElementalApplication(Element element, InternalCooldownContext icdContext, double gaugeUnits, double duration)
    • addElementalApplication

      List<ElementalReaction> addElementalApplication(ElementalApplication application, InternalCooldownContext icdContext)
    • hasElementalApplication

      default boolean hasElementalApplication(Element element)
      Checks if this entity has a specified Elemental Application with the provided element.
      Parameters:
      element - The element to check.
      Returns:
      Whether the entity has the specified element applied.
    • reduceElementalApplication

      default double reduceElementalApplication(Element element, double gaugeUnits)
      Reduces the amount of gauge units in a specified element, then returns the eventual amount of gauge units reduced.
      Parameters:
      element - The element to reduce the gauge units of.
      gaugeUnits - The amount of gauge units to reduce.
      Returns:
      The eventual amount of gauge units reduced. If this value is lower than gaugeUnits, the current element had a current gauge value lesser than gaugeUnits. However, if this value is -1.0, the provided element was not found or did not exist.
      See Also:
    • getElementalApplication

      default ElementalApplication getElementalApplication(Element element)
      Gets an Elemental Application with the specified element.
      Parameters:
      element - The Element to get an Elemental Application from.
      Returns:
      The ElementalApplication, if one exists for element.
    • getAppliedElements

      Array<ElementalApplication> getAppliedElements()
      Gets all currently applied elements as a Array.
    • applyFromDamageSource

      List<ElementalReaction> applyFromDamageSource(ElementalDamageSource source)
      Applies an ElementalDamageSource to this entity, possibly triggering multiple ElementalReactions. If no reactions were triggered, the list will be empty.
      Parameters:
      source - The ElementalDamageSource to apply to this entity.
      Returns:
      The triggered ElementalReactions.
    • getHighestElementPriority

      Optional<Integer> getHighestElementPriority()
      Gets the lowest priority value from the currently applied Elements as an Optional.

      If the Optional has no value, this means that there are no Elements currently applied.
    • getPrioritizedElements

      Array<ElementalApplication> getPrioritizedElements()
      Gets all currently prioritized applied elements as an Array.

      If there are applied Elements with multiple priority values, the most prioritized one has to be consumed first before the others can be consumed.

      Say that Element A has a priority of 1, while Element B has a priority of 2. Element A's application must be consumed entirely before Element B could be reacted with or reapplied.
    • sync

      static void sync(Entity entity)