Interface ElementComponent
- All Superinterfaces:
dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent,dev.onyxstudios.cca.api.v3.component.tick.ClientTickingComponent,dev.onyxstudios.cca.api.v3.component.tick.CommonTickingComponent,dev.onyxstudios.cca.api.v3.component.Component,dev.onyxstudios.cca.api.v3.component.sync.ComponentPacketWriter,dev.onyxstudios.cca.api.v3.component.sync.PlayerSyncPredicate,dev.onyxstudios.cca.api.v3.component.tick.ServerTickingComponent
- All Known Implementing Classes:
ElementComponentImpl
public interface ElementComponent
extends dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent, dev.onyxstudios.cca.api.v3.component.tick.CommonTickingComponent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final dev.onyxstudios.cca.api.v3.component.ComponentKey<ElementComponent> -
Method Summary
Modifier and TypeMethodDescriptionaddElementalApplication(ElementalApplication application, InternalCooldownContext icdContext) default List<ElementalReaction>addElementalApplication(Element element, InternalCooldownContext icdContext, double gaugeUnits) default List<ElementalReaction>addElementalApplication(Element element, InternalCooldownContext icdContext, double gaugeUnits, double duration) static ElementalDamageSourceapplyElementalInfusions(DamageSource source, LivingEntity target) Applies anElementalDamageSourceto this entity, possibly triggering multipleElementalReactions.private static Optional<ElementalDamageSource>attemptDamageTypeInfusions(DamageSource source, LivingEntity target) private static Optional<ElementalDamageSource>attemptEntityDamageInfusions(DamageSource source, LivingEntity target) private static Optional<ElementalDamageSource>attemptProjectileInfusions(DamageSource source, LivingEntity target) default booleancanApplyElement(Element element, InternalCooldownContext icdContext) Checks if the element can be applied.booleancanApplyElement(Element element, InternalCooldownContext icdContext, boolean handleICD) Checks if the element can be applied.static <T extends LivingEntity>
voiddenyElementsFor(Class<T> entityClass) Denies Elemental Applications for the specific entity class.private static <T> TGets all currently applied elements as aArray.@Nullable LivingEntityGets the current Crystallize Shield of this entity.@Nullable LivingEntitydefault ElementalApplicationgetElementalApplication(Element element) Gets an Elemental Application with the specifiedelement.getElementHolder(Element element) doubleGets the current decay time modifier for the Freeze aura.Gets the lowestpriorityvalue from the currently applied Elements as anOptional.getOwner()Gets all currently prioritized applied elements as anArray.default booleanhasElementalApplication(Element element) Checks if this entity has a specified Elemental Application with the providedelement.default booleandefault booleanbooleanbooleanfloatreduceCrystallizeShield(DamageSource source, float amount) Reduces the Crystallize shield and returns the effective amount of DMG reduced.booleanReturns whether the Crystallize Shield has been reduced in the current tick.default doublereduceElementalApplication(Element element, double gaugeUnits) Reduces the amount of gauge units in a specified element, then returns the eventual amount of gauge units reduced.voidvoidvoidsetBurningOrigin(@Nullable LivingEntity origin) voidsetCrystallizeShield(Element element, double amount) Grants this entity a Crystallize shield.voidsetElectroChargedOrigin(@Nullable LivingEntity origin) default voidsetOrRetainBurningOrigin(@Nullable LivingEntity origin) default voidsetOrRetainElectroChargedOrigin(@Nullable LivingEntity origin) static voidMethods inherited from interface dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent
applySyncPacket, shouldSyncWith, writeSyncPacketMethods inherited from interface dev.onyxstudios.cca.api.v3.component.tick.CommonTickingComponent
clientTick, serverTick, tickMethods inherited from interface dev.onyxstudios.cca.api.v3.component.Component
equals, readFromNbt, writeToNbt
-
Field Details
-
KEY
-
-
Method Details
-
denyElementsFor
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
-
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
-
getOwner
LivingEntity getOwner() -
getElementHolder
-
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
-
setBurningOrigin
-
getElectroChargedOrigin
-
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
sum(max(0, t_frozen_i - 2 t_unfrozen_i))
iis a Frozen and unfrozen instance, and since we reset only when it is 0 due to being negative, we could drop thesum()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
-
setOrRetainBurningOrigin
-
setCrystallizeShield
Grants this entity a Crystallize shield.- Parameters:
element- The element of this Crystallize shield.amount- The amount of HP this shield has.
-
getCrystallizeShield
Gets the current Crystallize Shield of this entity. -
reduceCrystallizeShield
Reduces the Crystallize shield and returns the effective amount of DMG reduced.- Parameters:
source- TheDamageSource. If this isn't an instance ofElementalDamageSource,0is 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
Checks if the element can be applied.- Parameters:
element- The element to check.icdContext- TheInternalCooldownContextof the Element to be applied.
-
canApplyElement
Checks if the element can be applied.- Parameters:
element- The element to check.icdContext- TheInternalCooldownContextof 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
Checks if this entity has a specified Elemental Application with the providedelement.- Parameters:
element- The element to check.- Returns:
- Whether the entity has the specified element applied.
-
reduceElementalApplication
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 thangaugeUnits. However, if this value is-1.0, the providedelementwas not found or did not exist. - See Also:
-
getElementalApplication
Gets an Elemental Application with the specifiedelement.- Parameters:
element- TheElementto get an Elemental Application from.- Returns:
- The
ElementalApplication, if one exists forelement.
-
getAppliedElements
Array<ElementalApplication> getAppliedElements()Gets all currently applied elements as aArray. -
applyFromDamageSource
Applies anElementalDamageSourceto this entity, possibly triggering multipleElementalReactions. If no reactions were triggered, the list will be empty.- Parameters:
source- TheElementalDamageSourceto apply to this entity.- Returns:
- The triggered
ElementalReactions.
-
getHighestElementPriority
Gets the lowestpriorityvalue from the currently applied Elements as anOptional.
If theOptionalhas no value, this means that there are no Elements currently applied. -
getPrioritizedElements
Array<ElementalApplication> getPrioritizedElements()Gets all currently prioritized applied elements as anArray.
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 of1, while Element B has a priority of2. Element A's application must be consumed entirely before Element B could be reacted with or reapplied. -
sync
-