Class DataComponentUtil
java.lang.Object
net.neoforged.neoforge.common.util.DataComponentUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
logDataComponentSaveError
(net.minecraft.core.component.DataComponentHolder componentHolder, Exception original, @Nullable net.minecraft.nbt.Tag tag) Logs component information and tag data for a DataComponentHolder that failed to save.static <T extends net.minecraft.core.component.DataComponentHolder>
net.minecraft.nbt.TagwrapEncodingExceptions
(T componentHolder, com.mojang.serialization.Codec<T> codec, net.minecraft.core.HolderLookup.Provider provider) Wraps encoding exceptions and adds additional logging for a DataComponentHolder that failed to save.static <T extends net.minecraft.core.component.DataComponentHolder>
net.minecraft.nbt.TagwrapEncodingExceptions
(T componentHolder, com.mojang.serialization.Codec<T> codec, net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.Tag tag) Wraps encoding exceptions and adds additional logging for a DataComponentHolder that failed to save.
-
Constructor Details
-
DataComponentUtil
public DataComponentUtil()
-
-
Method Details
-
wrapEncodingExceptions
public static <T extends net.minecraft.core.component.DataComponentHolder> net.minecraft.nbt.Tag wrapEncodingExceptions(T componentHolder, com.mojang.serialization.Codec<T> codec, net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.Tag tag) Wraps encoding exceptions and adds additional logging for a DataComponentHolder that failed to save. -
wrapEncodingExceptions
public static <T extends net.minecraft.core.component.DataComponentHolder> net.minecraft.nbt.Tag wrapEncodingExceptions(T componentHolder, com.mojang.serialization.Codec<T> codec, net.minecraft.core.HolderLookup.Provider provider) Wraps encoding exceptions and adds additional logging for a DataComponentHolder that failed to save. -
logDataComponentSaveError
public static void logDataComponentSaveError(net.minecraft.core.component.DataComponentHolder componentHolder, Exception original, @Nullable @Nullable net.minecraft.nbt.Tag tag) Logs component information and tag data for a DataComponentHolder that failed to save. SeeItemStack.save(net.minecraft.core.HolderLookup.Provider, net.minecraft.nbt.Tag)
orFluidStack.save(net.minecraft.core.HolderLookup.Provider, net.minecraft.nbt.Tag)
Example: Error saving [1 minecraft:dirt]. Original cause: java.lang.NullPointerException With components: { neoforge:test=>Test[s=null] minecraft:max_stack_size=>64 minecraft:lore=>ItemLore[lines=[], styledLines=[]] minecraft:enchantments=>ItemEnchantments{enchantments={}, showInTooltip=true} minecraft:repair_cost=>0 minecraft:attribute_modifiers=>ItemAttributeModifiers[modifiers=[], showInTooltip=true] minecraft:rarity=>COMMON } With tag: {}
-