Record Class SpellGrammar
java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.spell.SpellGrammar
- Record Components:
parts- AListof all parts. Used mainly for serialization, usecomponentsfor gameplay.components- A view ofpartsthat lists the parts asSpellComponents with their associatedSpellModifiers.
public record SpellGrammar(List<SpellPart> parts, List<com.mojang.datafixers.util.Pair<SpellComponent, List<SpellModifier>>> components)
extends Record
Represents a spell's grammar. All fields are immutable by contract.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SpellGrammar> static final SpellGrammarstatic final intstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SpellGrammar> -
Constructor Summary
ConstructorsConstructorDescriptionSpellGrammar(List<SpellPart> parts, List<com.mojang.datafixers.util.Pair<SpellComponent, List<SpellModifier>>> components) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionaffinityShifts(net.minecraft.core.RegistryAccess registryAccess) List<com.mojang.datafixers.util.Pair<SpellComponent, List<SpellModifier>>> Returns the value of thecomponentsrecord component.booleanIndicates whether some other object is "equal to" this one.doublegetBurnoutCost(net.minecraft.core.RegistryAccess registryAccess) doublegetManaCost(net.minecraft.core.RegistryAccess registryAccess) inthashCode()Returns a hash code value for this object.booleanisEmpty()static SpellGrammarparts()Returns the value of thepartsrecord component.net.minecraft.resources.ResourceKey<Affinity> primaryAffinity(net.minecraft.core.RegistryAccess registryAccess) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
MAX_PARTS
public static final int MAX_PARTS- See Also:
-
EMPTY
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SpellGrammar> STREAM_CODEC
-
-
Constructor Details
-
SpellGrammar
@Deprecated public SpellGrammar(List<SpellPart> parts, List<com.mojang.datafixers.util.Pair<SpellComponent, List<SpellModifier>>> components) Deprecated.Creates an instance of aSpellGrammarrecord class.- Parameters:
parts- the value for thepartsrecord componentcomponents- the value for thecomponentsrecord component
-
-
Method Details
-
of
- Parameters:
parts- TheListofSpellParts.- Returns:
- A new
SpellGrammar, orEMPTYif validation failed.
-
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
-
isEmpty
public boolean isEmpty()- Returns:
- Whether the spell grammar is considered empty.
-
getManaCost
public double getManaCost(net.minecraft.core.RegistryAccess registryAccess) - Parameters:
registryAccess- TheRegistryAccessto use.- Returns:
- The combined mana cost of the spell grammar.
-
getBurnoutCost
public double getBurnoutCost(net.minecraft.core.RegistryAccess registryAccess) - Parameters:
registryAccess- TheRegistryAccessto use.- Returns:
- The combined burnout cost of the spell grammar.
-
affinityShifts
-
-
toString
-
parts
-
components
Returns the value of thecomponentsrecord component.- Returns:
- the value of the
componentsrecord component
-