Record Class BundleLikeData
java.lang.Object
java.lang.Record
net.ntrdeal.realapi.item.component.custom.BundleLikeData
public record BundleLikeData(net.minecraft.core.component.DataComponentType<StackHolder<?>> type)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BundleLikeData> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, BundleLikeData> -
Constructor Summary
ConstructorsConstructorDescriptionBundleLikeData(net.minecraft.core.component.DataComponentType<StackHolder<?>> type) Creates an instance of aBundleLikeDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionintdisplayCount(net.minecraft.world.item.ItemStack stack) final booleanIndicates whether some other object is "equal to" this one.static Optional<BundleLikeData> getData(net.minecraft.world.item.ItemStack stack) final inthashCode()Returns a hash code value for this object.intindex(net.minecraft.world.item.ItemStack stack) @Nullable net.minecraft.world.item.ItemStackTemplateselected(net.minecraft.world.item.ItemStack stack) <T extends StackHolder<T>>
voidsetIndex(net.minecraft.world.item.ItemStack stack, int index) final StringtoString()Returns a string representation of this record class.net.minecraft.core.component.DataComponentType<StackHolder<?>> type()Returns the value of thetyperecord component.
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, BundleLikeData> STREAM_CODEC
-
-
Constructor Details
-
BundleLikeData
Creates an instance of aBundleLikeDatarecord class.- Parameters:
type- the value for thetyperecord component
-
-
Method Details
-
setIndex
public <T extends StackHolder<T>> void setIndex(net.minecraft.world.item.ItemStack stack, int index) -
index
public int index(net.minecraft.world.item.ItemStack stack) -
displayCount
public int displayCount(net.minecraft.world.item.ItemStack stack) -
selected
public @Nullable net.minecraft.world.item.ItemStackTemplate selected(net.minecraft.world.item.ItemStack stack) -
getData
-
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). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-