Record Class SpellStat
java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.spell.SpellStat
- Record Components:
id- The id of the stat.genericModifierFunction- A function to be used by genericSpellModifiers (e.g. Solar or Lunar), to create aSpellStatModifierfrom a given multiplier. If empty, genericSpellModifiers will ignore this stat.
public record SpellStat(net.minecraft.resources.Identifier id, Optional<DoubleFunction<SpellStatModifier>> genericModifierFunction)
extends Record
Represents a stat that can be modified, e.g. by
SpellModifiers. No registration is necessary, equality is checked via equals(Object).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSpellStat(net.minecraft.resources.Identifier id) Represents a stat that can be modified, e.g.SpellStat(net.minecraft.resources.Identifier id, DoubleFunction<SpellStatModifier> genericModifierFunction) Represents a stat that can be modified, e.g.SpellStat(net.minecraft.resources.Identifier id, Optional<DoubleFunction<SpellStatModifier>> genericModifierFunction) Creates an instance of aSpellStatrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.Returns the value of thegenericModifierFunctionrecord component.static Map<SpellStat, SpellStatModifier> genericModifiers(ToDoubleFunction<SpellCastContext> multiplierFunction) Creation helper for a genericSpellModifier.getAll()inthashCode()Returns a hash code value for this object.net.minecraft.resources.Identifierid()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
COLOR
-
-
Constructor Details
-
SpellStat
public SpellStat(net.minecraft.resources.Identifier id, Optional<DoubleFunction<SpellStatModifier>> genericModifierFunction) Creates an instance of aSpellStatrecord class.- Parameters:
id- the value for theidrecord componentgenericModifierFunction- the value for thegenericModifierFunctionrecord component
-
SpellStat
public SpellStat(net.minecraft.resources.Identifier id) Represents a stat that can be modified, e.g. bySpellModifiers.- Parameters:
id- The id of the stat.
-
SpellStat
public SpellStat(net.minecraft.resources.Identifier id, DoubleFunction<SpellStatModifier> genericModifierFunction) Represents a stat that can be modified, e.g. bySpellModifiers.- Parameters:
id- The id of the stat.genericModifierFunction- A function to be used by genericSpellModifiers (e.g. Solar or Lunar), to create aSpellStatModifierfrom a given multiplier.
-
-
Method Details
-
getAll
-
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). -
hashCode
-
genericModifiers
public static Map<SpellStat, SpellStatModifier> genericModifiers(ToDoubleFunction<SpellCastContext> multiplierFunction) Creation helper for a genericSpellModifier. Returns a map ofSpellStatModifiers based on a multiplier function. On invocation of theSpellModifier, the multiplier is calculated using theSpellStatModifier'sSpellCastContext. TheSpellStatModifieris then wrapped and passed along, containing the genericSpellModifier's modifications.- Parameters:
multiplierFunction- The multiplier function to use.- Returns:
- A map to be passed into
SpellModifier(Map).
-
toString
-
id
-
genericModifierFunction
Returns the value of thegenericModifierFunctionrecord component.- Returns:
- the value of the
genericModifierFunctionrecord component
-