Record Class SpellDataComponentMap
java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.spell.SpellDataComponentMap
- Record Components:
shapeGroups- TheSpellShapeGroup-specificPatchedDataComponentMaps.grammar- TheSpellGrammar-specificPatchedDataComponentMap.
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SpellDataComponentMap> static final SpellDataComponentMapstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SpellDataComponentMap> -
Constructor Summary
ConstructorsConstructorDescriptionSpellDataComponentMap(List<net.minecraft.core.component.PatchedDataComponentMap> shapeGroups, net.minecraft.core.component.PatchedDataComponentMap grammar) Creates an instance of aSpellDataComponentMaprecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.core.component.PatchedDataComponentMapget(int index) net.minecraft.core.component.PatchedDataComponentMapgrammar()Returns the value of thegrammarrecord component.final inthashCode()Returns a hash code value for this object.List<net.minecraft.core.component.PatchedDataComponentMap> Returns the value of theshapeGroupsrecord component.final StringtoString()Returns a string representation of this record class.updateGrammar(Consumer<net.minecraft.core.component.PatchedDataComponentMap> consumer) updateShapeGroup(int index, Consumer<net.minecraft.core.component.PatchedDataComponentMap> consumer)
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SpellDataComponentMap> STREAM_CODEC -
EMPTY
-
-
Constructor Details
-
SpellDataComponentMap
public SpellDataComponentMap(List<net.minecraft.core.component.PatchedDataComponentMap> shapeGroups, net.minecraft.core.component.PatchedDataComponentMap grammar) Creates an instance of aSpellDataComponentMaprecord class.- Parameters:
shapeGroups- the value for theshapeGroupsrecord componentgrammar- the value for thegrammarrecord 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
PatchedDataComponentMapfor 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
-
hashCode
-
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). -
shapeGroups
Returns the value of theshapeGroupsrecord component.- Returns:
- the value of the
shapeGroupsrecord component
-
grammar
-