Class DataComponent<T extends DataComponent<T>>
java.lang.Object
net.ixdarklord.coolcatcore.api.data.DataComponent<T>
- Direct Known Subclasses:
ItemDataComponent
A piece of data saved with a
Codec under its id in a CompoundTag. 1.20.1 has no data components:
this is CoolCatLib's NBT-backed stand-in, stored as "<id>": {...}.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataComponent(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.resources.ResourceLocationgetId()static <T> Optional<T>load(@Nullable net.minecraft.nbt.CompoundTag compoundTag, net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec) Reads the data saved underidincompoundTag, if there is any and it can be read.protected voidsave(net.minecraft.nbt.CompoundTag compoundTag)
-
Field Details
-
id
protected final net.minecraft.resources.ResourceLocation id -
codec
-
-
Constructor Details
-
DataComponent
protected DataComponent(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec)
-
-
Method Details
-
getId
public net.minecraft.resources.ResourceLocation getId() -
onClientUpdate
-
save
protected void save(net.minecraft.nbt.CompoundTag compoundTag) -
load
public static <T> Optional<T> load(@Nullable @Nullable net.minecraft.nbt.CompoundTag compoundTag, net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<T> codec) Reads the data saved underidincompoundTag, if there is any and it can be read.
-