Record Class SpellDataComponentMap

java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.spell.SpellDataComponentMap
Record Components:
shapeGroups - The SpellShapeGroup-specific PatchedDataComponentMaps.
grammar - The SpellGrammar-specific PatchedDataComponentMap.

public record SpellDataComponentMap(List<net.minecraft.core.component.PatchedDataComponentMap> shapeGroups, net.minecraft.core.component.PatchedDataComponentMap grammar) extends Record
Represents the data components of a Spell. All fields are immutable by contract. To change the values of a field, call updateShapeGroup(int, Consumer) or updateGrammar(Consumer).
  • Field Details

  • Constructor Details

    • SpellDataComponentMap

      public SpellDataComponentMap(List<net.minecraft.core.component.PatchedDataComponentMap> shapeGroups, net.minecraft.core.component.PatchedDataComponentMap grammar)
      Creates an instance of a SpellDataComponentMap record class.
      Parameters:
      shapeGroups - the value for the shapeGroups record component
      grammar - the value for the grammar record component
  • Method Details

    • get

      public net.minecraft.core.component.PatchedDataComponentMap get(int index)
      Parameters:
      index - The index of the data components to return. If positive, will return the corresponding shape group. If negative, will return the grammar.
      Returns:
      The PatchedDataComponentMap for the specified index.
    • update

      public SpellDataComponentMap update(int index, Consumer<net.minecraft.core.component.PatchedDataComponentMap> consumer)
      Parameters:
      index - The index of the data components to modify. If positive, will modify the corresponding shape group. If negative, will modify the grammar.
      consumer - The modifications to apply.
      Returns:
      A new spell data component map with the modifications to the data components applied.
    • updateShapeGroup

      public SpellDataComponentMap updateShapeGroup(int index, Consumer<net.minecraft.core.component.PatchedDataComponentMap> consumer)
      Parameters:
      index - The index of the data components to modify.
      consumer - The modifications to apply.
      Returns:
      A new spell data component map with the modifications to the data components applied.
    • updateGrammar

      public SpellDataComponentMap updateGrammar(Consumer<net.minecraft.core.component.PatchedDataComponentMap> consumer)
      Parameters:
      consumer - The modifications to apply.
      Returns:
      A new spell data component map with the modifications to the data components applied.
    • 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
    • hashCode

      public final 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
    • equals

      public final 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.
    • shapeGroups

      public List<net.minecraft.core.component.PatchedDataComponentMap> shapeGroups()
      Returns the value of the shapeGroups record component.
      Returns:
      the value of the shapeGroups record component
    • grammar

      public net.minecraft.core.component.PatchedDataComponentMap grammar()
      Returns the value of the grammar record component.
      Returns:
      the value of the grammar record component