Record Class SpellShapeGroup

java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.spell.SpellShapeGroup
Record Components:
parts - A List of all parts. Used mainly for serialization, use the other fields for gameplay.
primaryShape - The PrimarySpellShape of the shape group.
primaryModifiers - A List of SpellModifiers for the PrimarySpellShape.
secondaryShape - The SecondarySpellShape of the shape group.
secondaryModifiers - A List of SpellModifiers for the SecondarySpellShape.

public record SpellShapeGroup(List<SpellPart> parts, @Nullable PrimarySpellShape primaryShape, List<SpellModifier> primaryModifiers, @Nullable SecondarySpellShape secondaryShape, List<SpellModifier> secondaryModifiers) extends Record
Represents a spell's shape group. One spell may have up to Spell.MAX_SHAPE_GROUPS different shape groups. All fields are immutable by contract.
  • Field Details

    • MAX_PARTS

      public static final int MAX_PARTS
      See Also:
    • EMPTY

      public static final SpellShapeGroup EMPTY
    • CODEC

      public static final com.mojang.serialization.Codec<SpellShapeGroup> CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SpellShapeGroup> STREAM_CODEC
  • Constructor Details

  • Method Details

    • of

      public static SpellShapeGroup of(List<SpellPart> parts)
      Validates the given List of SpellParts and constructs a SpellShapeGroup from it.
      Parameters:
      parts - The List of SpellParts.
      Returns:
      A new SpellShapeGroup, or EMPTY if validation failed.
    • equals

      public boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • isEmpty

      public boolean isEmpty()
      Returns:
      Whether the spell shape group is considered empty.
    • isContinuous

      public boolean isContinuous()
      Returns:
      Whether this spell shape group is continuous, i.e., can be cast by holding down the spell.
    • getManaCost

      public double getManaCost(net.minecraft.core.RegistryAccess registryAccess)
      Parameters:
      registryAccess - The RegistryAccess to use.
      Returns:
      The combined mana cost of the spell shape group.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • parts

      public List<SpellPart> parts()
      Returns the value of the parts record component.
      Returns:
      the value of the parts record component
    • primaryShape

      public @Nullable PrimarySpellShape primaryShape()
      Returns the value of the primaryShape record component.
      Returns:
      the value of the primaryShape record component
    • primaryModifiers

      public List<SpellModifier> primaryModifiers()
      Returns the value of the primaryModifiers record component.
      Returns:
      the value of the primaryModifiers record component
    • secondaryShape

      public @Nullable SecondarySpellShape secondaryShape()
      Returns the value of the secondaryShape record component.
      Returns:
      the value of the secondaryShape record component
    • secondaryModifiers

      public List<SpellModifier> secondaryModifiers()
      Returns the value of the secondaryModifiers record component.
      Returns:
      the value of the secondaryModifiers record component