Record Class ElementalInfusionComponent
java.lang.Object
java.lang.Record
io.github.xrickastley.sevenelements.component.ElementalInfusionComponent
- All Implemented Interfaces:
TooltipAppender
public record ElementalInfusionComponent(ElementalApplication.Builder elementalInfusion, InternalCooldownContext.Builder internalCooldown)
extends Record
implements TooltipAppender
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ElementalInfusionComponent> private final ElementalApplication.BuilderThe field for theelementalInfusionrecord component.private final InternalCooldownContext.BuilderThe field for theinternalCooldownrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionElementalInfusionComponent(ElementalApplication.Builder elementalInfusion, InternalCooldownContext.Builder internalCooldown) Creates an instance of aElementalInfusionComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendTooltip(Item.TooltipContext context, Consumer<Text> textConsumer, TooltipType tooltipType, ComponentsAccess components) apply(DamageSource source, Entity target) static voidapplyInfusion(ItemStack stack, ElementalApplication.Builder applicationBuilder, InternalCooldownContext.Builder icdBuilder) static Optional<ElementalDamageSource> applyToDamageSource(DamageSource source, Entity target) Returns the value of theelementalInfusionrecord component.booleanIndicates whether some other object is "equal to" this one.@Nullable Element@Nullable ElementalApplicationgetElementalInfusion(LivingEntity target) doublebooleanfinal inthashCode()Returns a hash code value for this object.static booleanhasInfusion(ItemStack stack) Returns the value of theinternalCooldownrecord component.static ElementalInfusionComponentofNone()static booleanremoveInfusion(ItemStack stack) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
elementalInfusion
The field for theelementalInfusionrecord component. -
internalCooldown
The field for theinternalCooldownrecord component. -
CODEC
-
-
Constructor Details
-
ElementalInfusionComponent
public ElementalInfusionComponent(@Nullable ElementalApplication.Builder elementalInfusion, @Nullable InternalCooldownContext.Builder internalCooldown) Creates an instance of aElementalInfusionComponentrecord class.- Parameters:
elementalInfusion- the value for theelementalInfusionrecord componentinternalCooldown- the value for theinternalCooldownrecord component
-
-
Method Details
-
applyToDamageSource
public static Optional<ElementalDamageSource> applyToDamageSource(DamageSource source, Entity target) -
applyInfusion
public static void applyInfusion(ItemStack stack, ElementalApplication.Builder applicationBuilder, InternalCooldownContext.Builder icdBuilder) -
removeInfusion
-
hasInfusion
-
ofNone
-
hasElementalInfusion
public boolean hasElementalInfusion() -
getElementalInfusion
-
getElement
-
getGaugeUnits
public double getGaugeUnits() -
apply
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
appendTooltip
public void appendTooltip(Item.TooltipContext context, Consumer<Text> textConsumer, TooltipType tooltipType, ComponentsAccess components) - Specified by:
appendTooltipin interfaceTooltipAppender
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
elementalInfusion
Returns the value of theelementalInfusionrecord component.- Returns:
- the value of the
elementalInfusionrecord component
-
internalCooldown
Returns the value of theinternalCooldownrecord component.- Returns:
- the value of the
internalCooldownrecord component
-