java.lang.Object
java.lang.Record
com.github.minecraftschurlimods.arsmagicalegacy.api.spell.SpellStack

public record SpellStack(List<ISpellPart> parts, List<com.mojang.datafixers.util.Pair<ISpellPart,List<ISpellModifier>>> partsWithModifiers) extends Record
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<SpellStack> CODEC
    • EMPTY

      public static final SpellStack EMPTY
  • Constructor Details

    • SpellStack

      public SpellStack(List<ISpellPart> parts, List<com.mojang.datafixers.util.Pair<ISpellPart,List<ISpellModifier>>> partsWithModifiers)
      Creates an instance of a SpellStack record class.
      Parameters:
      parts - the value for the parts record component
      partsWithModifiers - the value for the partsWithModifiers record component
  • Method Details

    • of

      Creates a spell stack from a list of parts.
      Parameters:
      parts - The list of parts to create the spell stack from.
      Returns:
      The newly created spell stack.
      Throws:
      ShapeGroup.MalformedShapeGroupException - If a modifier is the first element of the parts list.
      SpellStack.MalformedSpellStackException
    • of

      Creates a spell stack from a list of parts.
      Parameters:
      parts - The list of parts to create the spell stack from.
      Returns:
      The newly created spell stack.
      Throws:
      ShapeGroup.MalformedShapeGroupException - If a modifier is the first element of the parts list.
      SpellStack.MalformedSpellStackException
    • parts

      @Contract(pure=true) public @UnmodifiableView List<ISpellPart> parts()
      Returns the value of the parts record component.
      Returns:
      the value of the parts record component
    • partsWithModifiers

      @Contract(pure=true) public @UnmodifiableView List<com.mojang.datafixers.util.Pair<ISpellPart,List<ISpellModifier>>> partsWithModifiers()
      Returns the value of the partsWithModifiers record component.
      Returns:
      the value of the partsWithModifiers record component
    • isEmpty

      public boolean isEmpty()
      Returns:
      Whether this spell stack is empty or not.
    • 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
    • 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