Record Class CapturedBlock
java.lang.Object
java.lang.Record
com.ldtteam.structurize.component.CapturedBlock
- Record Components:
blockState- state of captured blockserializedBE- related blockEntity data if neededitemStack- itemStack representing both block and blockEntity
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<CapturedBlock> static final CapturedBlockstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, CapturedBlock> -
Constructor Summary
ConstructorsConstructorDescriptionCapturedBlock(net.minecraft.world.level.block.state.BlockState blockState, Optional<net.minecraft.nbt.CompoundTag> serializedBE, net.minecraft.world.item.ItemStack itemStack) Creates an instance of aCapturedBlockrecord class.CapturedBlock(net.minecraft.world.level.block.state.BlockState blockState, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.core.HolderLookup.Provider provider, net.minecraft.world.item.ItemStack itemStack) Serializes given BE. -
Method Summary
Modifier and TypeMethodDescriptionapplyRotationMirror(RotationMirror rotationMirror, net.minecraft.world.level.Level level) net.minecraft.world.level.block.state.BlockStateReturns the value of theblockStaterecord component.final booleanIndicates whether some other object is "equal to" this one.booleanfinal inthashCode()Returns a hash code value for this object.net.minecraft.world.item.ItemStackReturns the value of theitemStackrecord component.static CapturedBlockreadFromItemStack(net.minecraft.world.item.ItemStack itemStack) Optional<net.minecraft.nbt.CompoundTag> Returns the value of theserializedBErecord component.final StringtoString()Returns a string representation of this record class.static voidupdateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<CapturedBlock> 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,CapturedBlock> STREAM_CODEC
-
-
Constructor Details
-
CapturedBlock
public CapturedBlock(net.minecraft.world.level.block.state.BlockState blockState, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.core.HolderLookup.Provider provider, net.minecraft.world.item.ItemStack itemStack) Serializes given BE.- Parameters:
blockState- state of captured blockblockEntity- related blockEntity data if neededprovider- registry accessitemStack- itemStack representing both block and blockEntity
-
CapturedBlock
public CapturedBlock(net.minecraft.world.level.block.state.BlockState blockState, Optional<net.minecraft.nbt.CompoundTag> serializedBE, net.minecraft.world.item.ItemStack itemStack) Creates an instance of aCapturedBlockrecord class.- Parameters:
blockState- the value for theblockStaterecord componentserializedBE- the value for theserializedBErecord componentitemStack- the value for theitemStackrecord component
-
-
Method Details
-
applyRotationMirror
public CapturedBlock applyRotationMirror(RotationMirror rotationMirror, net.minecraft.world.level.Level level) - Parameters:
rotationMirror- relative rotation and mirrorlevel- registry access
-
hasBlockEntity
public boolean hasBlockEntity() -
writeToItemStack
public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack) Writes this posSelection into given itemStack.- See Also:
-
readFromItemStack
- Returns:
- posSelection stored in given itemStack (or empty instance)
-
updateItemStack
public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<CapturedBlock> 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). -
blockState
public net.minecraft.world.level.block.state.BlockState blockState()Returns the value of theblockStaterecord component.- Returns:
- the value of the
blockStaterecord component
-
serializedBE
Returns the value of theserializedBErecord component.- Returns:
- the value of the
serializedBErecord component
-
itemStack
public net.minecraft.world.item.ItemStack itemStack()Returns the value of theitemStackrecord component.- Returns:
- the value of the
itemStackrecord component
-