Class ItemDataComponent<T extends ItemDataComponent<T>>
java.lang.Object
net.ixdarklord.coolcatcore.api.data.DataComponent<T>
net.ixdarklord.coolcatcore.api.data.ItemDataComponent<T>
A
DataComponent kept in an item stack's NBT tag, under its id.-
Field Summary
FieldsFields inherited from class net.ixdarklord.coolcatcore.api.data.DataComponent
codec, id -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedItemDataComponent(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStackgetStack()static <T extends ItemDataComponent<T>>
Tload(net.minecraft.world.item.ItemStack stack, net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec, Supplier<T> fallback) The data saved in a stack, bound to it, orfallback's (also bound) when there's none.voidsave()Writes the data into its stack's tag.setStack(net.minecraft.world.item.ItemStack stack) Methods inherited from class net.ixdarklord.coolcatcore.api.data.DataComponent
getId, load, onClientUpdate, save
-
Field Details
-
stack
protected net.minecraft.world.item.ItemStack stack
-
-
Constructor Details
-
ItemDataComponent
protected ItemDataComponent(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec)
-
-
Method Details
-
getStack
public net.minecraft.world.item.ItemStack getStack() -
setStack
-
save
public void save()Writes the data into its stack's tag. -
load
public static <T extends ItemDataComponent<T>> T load(net.minecraft.world.item.ItemStack stack, net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec, Supplier<T> fallback) The data saved in a stack, bound to it, orfallback's (also bound) when there's none.
-