Class ElementalApplication

java.lang.Object
io.github.xrickastley.sevenelements.element.ElementalApplication
Direct Known Subclasses:
DurationElementalApplication, GaugeUnitElementalApplication

public abstract sealed class ElementalApplication extends Object permits DurationElementalApplication, GaugeUnitElementalApplication
A class representing an Elemental Application for an entity.
  • Field Details

    • GAUGE_UNIT_FORMAT

      protected static final DecimalFormat GAUGE_UNIT_FORMAT
    • DURATION_FORMAT

      protected static final DecimalFormat DURATION_FORMAT
    • type

      protected final ElementalApplication.Type type
    • element

      protected final Element element
    • entity

      protected final LivingEntity entity
    • isAura

      protected final boolean isAura
    • uuid

      protected final UUID uuid
    • gaugeUnits

      protected double gaugeUnits
    • currentGauge

      protected double currentGauge
    • appliedAt

      protected long appliedAt
  • Constructor Details

  • Method Details

    • getType

      public ElementalApplication.Type getType()
      Gets the Type of this Elemental Application.
    • getElement

      public Element getElement()
      Gets the Element of to this Elemental Application.
    • getEntity

      public LivingEntity getEntity()
    • getUuid

      public UUID getUuid()
    • getGaugeUnits

      public double getGaugeUnits()
    • getCurrentGauge

      public double getCurrentGauge()
    • getAppliedAt

      public long getAppliedAt()
    • getAppliedTicks

      public long getAppliedTicks()
      Gets the number of ticks this Elemental Application has been applied for.
    • getDefaultDecayRate

      protected abstract double getDefaultDecayRate()
      Gets the default decay rate of this Elemental Application.
      Returns:
      The default decay rate of this Elemental Application in GU/tick.
    • getRemainingTicks

      public abstract int getRemainingTicks()
    • getText

      public Text getText()
    • getText

      public Text getText(@Nullable @Nullable String gaugeFormat)
    • getText

      public Text getText(@Nullable @Nullable DecimalFormat gaugeFormat)
    • getText

      public Text getText(@Nullable @Nullable String gaugeFormat, @Nullable @Nullable String durationFormat)
    • getText

      public abstract Text getText(@Nullable @Nullable DecimalFormat gaugeFormat, @Nullable @Nullable DecimalFormat durationFormat)
    • isGaugeUnits

      public boolean isGaugeUnits()
      Returns whether this Elemental Application is using Gauge Units.
    • isDuration

      public boolean isDuration()
      Returns whether this Elemental Application is using a specified duration.
    • isOfElement

      public boolean isOfElement(Element element)
      Checks if the element in this Elemental Application is of the given element.
      Parameters:
      element - The Element to compare with this Elemental Application.
    • isAuraElement

      public boolean isAuraElement()
      Returns whether this Elemental Application is an aura element.
    • isEmpty

      public abstract boolean isEmpty()
      Returns whether this Elemental Application is empty.
    • reduceGauge

      public double reduceGauge(double gaugeUnits)
      Reduces the amount of gauge units in this Elemental Application, then returns the eventual amount of gauge units reduced.
      Parameters:
      gaugeUnits - The amount of gauge units to reduce.
      Returns:
      The eventual amount of gauge units reduced.
    • tick

      public void tick()
    • reapply

      public void reapply(Element element, double gaugeUnits)
      Reapplies this Elemental Application, given that element is the same element as this ElementalApplication.
      Parameters:
      element - The element to reapply for this application.
      gaugeUnits - The amount of Elemental Gauge Units to reapply.
    • reapply

      public abstract void reapply(ElementalApplication application)
      Reapplies this Elemental Application, given that application has the same element as this one.
      Parameters:
      application - The Elemental Application to reapply using this application.
    • asAura

      public abstract ElementalApplication asAura()
    • asNonAura

      public abstract ElementalApplication asNonAura()
    • asNbt

      public NbtCompound asNbt()
    • updateFromNbt

      public void updateFromNbt(NbtElement nbt, long syncedAt)