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

public record ShapeGroup(List<ISpellPart> parts, List<com.mojang.datafixers.util.Pair<ISpellShape,List<ISpellModifier>>> shapesWithModifiers) extends Record
A shape group is a part of a spell, which can be exchanged to change the casting, but not the effect of a spell.
  • Field Details

    • CODEC

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

      public static final ShapeGroup EMPTY
  • Constructor Details

    • ShapeGroup

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

    • of

      Creates a shape group from a list of parts.
      Parameters:
      parts - The list of parts to create the shape group from.
      Returns:
      The newly created shape group.
      Throws:
      ShapeGroup.MalformedShapeGroupException - If there are components present, or if a modifier is the first element of the parts list.
    • of

      Creates a shape group from a list of parts.
      Parameters:
      parts - The list of parts to create the shape group from.
      Returns:
      The newly created shape group.
      Throws:
      ShapeGroup.MalformedShapeGroupException - If there are components present, or if a modifier is the first element of the parts list.
    • 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
    • shapesWithModifiers

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

      public boolean isEmpty()
      Returns:
      Whether this shape group 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