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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected doubleprotected static final DecimalFormatprotected final Elementprotected final LivingEntityprotected static final DecimalFormatprotected doubleprotected final booleanprotected final ElementalApplication.Typeprotected final UUID -
Constructor Summary
ConstructorsConstructorDescriptionElementalApplication(ElementalApplication.Type type, LivingEntity entity, Element element, UUID uuid, double gaugeUnits, boolean isAura) -
Method Summary
Modifier and TypeMethodDescriptionabstract ElementalApplicationasAura()asNbt()abstract ElementalApplicationlonglongGets the number of ticks this Elemental Application has been applied for.doubleprotected abstract doubleGets the default decay rate of this Elemental Application.Gets theElementof to this Elemental Application.doubleabstract intgetText()getText(@Nullable DecimalFormat gaugeFormat) abstract TextgetText(@Nullable DecimalFormat gaugeFormat, @Nullable DecimalFormat durationFormat) getType()Gets the Type of this Elemental Application.getUuid()booleanReturns whether this Elemental Application is an aura element.booleanReturns whether this Elemental Application is using a specified duration.abstract booleanisEmpty()Returns whether this Elemental Application is empty.booleanReturns whether this Elemental Application is using Gauge Units.booleanisOfElement(Element element) Checks if the element in this Elemental Application is of the givenelement.abstract voidreapply(ElementalApplication application) Reapplies this Elemental Application, given thatapplicationhas the same element as this one.voidReapplies this Elemental Application, given thatelementis the same element as thisElementalApplication.doublereduceGauge(double gaugeUnits) Reduces the amount of gauge units in this Elemental Application, then returns the eventual amount of gauge units reduced.voidtick()voidupdateFromNbt(NbtElement nbt, long syncedAt)
-
Field Details
-
GAUGE_UNIT_FORMAT
-
DURATION_FORMAT
-
type
-
element
-
entity
-
isAura
protected final boolean isAura -
uuid
-
gaugeUnits
protected double gaugeUnits -
currentGauge
protected double currentGauge -
appliedAt
protected long appliedAt
-
-
Constructor Details
-
ElementalApplication
ElementalApplication(ElementalApplication.Type type, LivingEntity entity, Element element, UUID uuid, double gaugeUnits, boolean isAura)
-
-
Method Details
-
getType
Gets the Type of this Elemental Application. -
getElement
Gets theElementof to this Elemental Application. -
getEntity
-
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
-
getText
-
getText
-
getText
-
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
Checks if the element in this Elemental Application is of the givenelement.- Parameters:
element- TheElementto 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
Reapplies this Elemental Application, given thatelementis the same element as thisElementalApplication.- Parameters:
element- The element to reapply for this application.gaugeUnits- The amount of Elemental Gauge Units to reapply.
-
reapply
Reapplies this Elemental Application, given thatapplicationhas the same element as this one.- Parameters:
application- The Elemental Application to reapply using this application.
-
asAura
-
asNonAura
-
asNbt
-
updateFromNbt
-