Record Class ShapeGroup
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException thrown when the shape group is malformed. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ShapeGroup>static final ShapeGroup -
Constructor Summary
ConstructorsConstructorDescriptionShapeGroup(List<ISpellPart> parts, List<com.mojang.datafixers.util.Pair<ISpellShape, List<ISpellModifier>>> shapesWithModifiers) Creates an instance of aShapeGrouprecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.booleanisEmpty()static ShapeGroupof(ISpellPart... parts) Creates a shape group from a list of parts.static ShapeGroupof(List<ISpellPart> parts) Creates a shape group from a list of parts.@UnmodifiableView List<ISpellPart>parts()Returns the value of thepartsrecord component.@UnmodifiableView List<com.mojang.datafixers.util.Pair<ISpellShape,List<ISpellModifier>>> Returns the value of theshapesWithModifiersrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
EMPTY
-
-
Constructor Details
-
ShapeGroup
public ShapeGroup(List<ISpellPart> parts, List<com.mojang.datafixers.util.Pair<ISpellShape, List<ISpellModifier>>> shapesWithModifiers) Creates an instance of aShapeGrouprecord class.- Parameters:
parts- the value for thepartsrecord componentshapesWithModifiers- the value for theshapesWithModifiersrecord 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
Returns the value of thepartsrecord component.- Returns:
- the value of the
partsrecord component
-
shapesWithModifiers
@Contract(pure=true) public @UnmodifiableView List<com.mojang.datafixers.util.Pair<ISpellShape,List<ISpellModifier>>> shapesWithModifiers()Returns the value of theshapesWithModifiersrecord component.- Returns:
- the value of the
shapesWithModifiersrecord component
-
isEmpty
public boolean isEmpty()- Returns:
- Whether this shape group is empty or not.
-
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
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. -
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.
-