Package com.ldtteam.structurize.items
Record Class ItemTagTool.TagData
java.lang.Object
java.lang.Record
com.ldtteam.structurize.items.ItemTagTool.TagData
- Enclosing class:
ItemTagTool
public static record ItemTagTool.TagData(Optional<net.minecraft.core.BlockPos> anchorPos, Optional<String> currentTag)
extends Record
Data components for storing start and end pos
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ItemTagTool.TagData> static final ItemTagTool.TagDatastatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, ItemTagTool.TagData> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOptional<net.minecraft.core.BlockPos> Returns the value of theanchorPosrecord component.Returns the value of thecurrentTagrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static ItemTagTool.TagDatareadFromItemStack(net.minecraft.world.item.ItemStack itemStack) setAnchorPos(net.minecraft.core.BlockPos pos) For use withItemStack.update(DataComponentType, Object, UnaryOperator)setCurrentTag(String currentTag) For use withItemStack.update(DataComponentType, Object, UnaryOperator)final StringtoString()Returns a string representation of this record class.static voidupdateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<ItemTagTool.TagData> updater) Performs updating of tagData in given itemStackvoidwriteToItemStack(net.minecraft.world.item.ItemStack itemStack) Writes this tagData into given itemStack.
-
Field Details
-
EMPTY
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,ItemTagTool.TagData> STREAM_CODEC
-
-
Constructor Details
-
TagData
Creates an instance of aTagDatarecord class.- Parameters:
anchorPos- the value for theanchorPosrecord componentcurrentTag- the value for thecurrentTagrecord component
-
-
Method Details
-
setAnchorPos
For use withItemStack.update(DataComponentType, Object, UnaryOperator) -
setCurrentTag
For use withItemStack.update(DataComponentType, Object, UnaryOperator) -
writeToItemStack
public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack) Writes this tagData into given itemStack.- See Also:
-
readFromItemStack
- Returns:
- tagData stored in given itemStack (or empty instance)
-
updateItemStack
public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<ItemTagTool.TagData> updater) Performs updating of tagData in given itemStack -
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. -
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. -
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). -
anchorPos
Returns the value of theanchorPosrecord component.- Returns:
- the value of the
anchorPosrecord component
-
currentTag
Returns the value of thecurrentTagrecord component.- Returns:
- the value of the
currentTagrecord component
-