Package com.ldtteam.structurize.items
Record Class AbstractItemWithPosSelector.PosSelection
java.lang.Object
java.lang.Record
com.ldtteam.structurize.items.AbstractItemWithPosSelector.PosSelection
- Enclosing class:
AbstractItemWithPosSelector
public static record AbstractItemWithPosSelector.PosSelection(Optional<net.minecraft.core.BlockPos> startPos, Optional<net.minecraft.core.BlockPos> endPos)
extends Record
Data components for storing start and end pos
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<AbstractItemWithPosSelector.PosSelection> static final AbstractItemWithPosSelector.PosSelectionstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, AbstractItemWithPosSelector.PosSelection> -
Constructor Summary
ConstructorsConstructorDescriptionPosSelection(Optional<net.minecraft.core.BlockPos> startPos, Optional<net.minecraft.core.BlockPos> endPos) Creates an instance of aPosSelectionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionOptional<net.minecraft.core.BlockPos> endPos()Returns the value of theendPosrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanreadFromItemStack(net.minecraft.world.item.ItemStack itemStack) setEndpos(net.minecraft.core.BlockPos pos) For use withItemStack.update(DataComponentType, Object, UnaryOperator)setSelection(net.minecraft.core.BlockPos startPos, net.minecraft.core.BlockPos endPos) For use withItemStack.update(DataComponentType, Object, UnaryOperator)setStartPos(net.minecraft.core.BlockPos pos) For use withItemStack.update(DataComponentType, Object, UnaryOperator)Optional<net.minecraft.core.BlockPos> startPos()Returns the value of thestartPosrecord component.final StringtoString()Returns a string representation of this record class.static voidupdateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<AbstractItemWithPosSelector.PosSelection> updater) Performs updating of posSelection in given itemStackvoidwriteToItemStack(net.minecraft.world.item.ItemStack itemStack) Writes this posSelection into given itemStack.
-
Field Details
-
EMPTY
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,AbstractItemWithPosSelector.PosSelection> STREAM_CODEC
-
-
Constructor Details
-
Method Details
-
hasSelection
public boolean hasSelection()- Returns:
- true if both start and end positions are set
-
setStartPos
For use withItemStack.update(DataComponentType, Object, UnaryOperator) -
setEndpos
For use withItemStack.update(DataComponentType, Object, UnaryOperator) -
setSelection
public AbstractItemWithPosSelector.PosSelection setSelection(net.minecraft.core.BlockPos startPos, net.minecraft.core.BlockPos endPos) For use withItemStack.update(DataComponentType, Object, UnaryOperator) -
writeToItemStack
public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack) Writes this posSelection into given itemStack.- See Also:
-
readFromItemStack
public static AbstractItemWithPosSelector.PosSelection readFromItemStack(net.minecraft.world.item.ItemStack itemStack) - Returns:
- posSelection stored in given itemStack (or empty instance)
-
updateItemStack
public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<AbstractItemWithPosSelector.PosSelection> updater) Performs updating of posSelection 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). -
startPos
Returns the value of thestartPosrecord component.- Returns:
- the value of the
startPosrecord component
-
endPos
Returns the value of theendPosrecord component.- Returns:
- the value of the
endPosrecord component
-