Class AttachmentInternals
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentInternals
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringMarks a stack that has attachments and an empty NBT tag ({}). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable CompoundTagaddAttachmentsToTag(@Nullable CompoundTag tag, ItemStack stack, boolean fullCopy) static @Nullable CompoundTagcleanTag(CompoundTag tag) Clean tag of its contained attachments (as set byaddAttachmentsToTag(net.minecraft.nbt.CompoundTag, net.minecraft.world.item.ItemStack, boolean)).private static <H extends AttachmentHolder>
voidcopyAttachments(H from, H to, Predicate<AttachmentType<?>> filter) Copy some attachments to another holder.static voidstatic voidcopyStackAttachments(ItemStack from, ItemStack to) static voidstatic voidonPlayerClone(PlayerEvent.Clone event) static ItemStackreconstructItemStack(Item item, int count, @Nullable CompoundTag tag) Perform the inverse operation ofaddAttachmentsToTag(net.minecraft.nbt.CompoundTag, net.minecraft.world.item.ItemStack, boolean)on stack reception.
-
Field Details
-
EMPTY_TAG_KEY
Marks a stack that has attachments and an empty NBT tag ({}). If this marker is absent, we set the tag back to null after reading the attachments.- See Also:
-
-
Constructor Details
-
AttachmentInternals
private AttachmentInternals()
-
-
Method Details
-
addAttachmentsToTag
@Nullable public static @Nullable CompoundTag addAttachmentsToTag(@Nullable @Nullable CompoundTag tag, ItemStack stack, boolean fullCopy) -
reconstructItemStack
public static ItemStack reconstructItemStack(Item item, int count, @Nullable @Nullable CompoundTag tag) Perform the inverse operation ofaddAttachmentsToTag(net.minecraft.nbt.CompoundTag, net.minecraft.world.item.ItemStack, boolean)on stack reception. -
cleanTag
Clean tag of its contained attachments (as set byaddAttachmentsToTag(net.minecraft.nbt.CompoundTag, net.minecraft.world.item.ItemStack, boolean)). -
copyAttachments
private static <H extends AttachmentHolder> void copyAttachments(H from, H to, Predicate<AttachmentType<?>> filter) Copy some attachments to another holder. -
copyStackAttachments
-
copyChunkAttachmentsOnPromotion
public static void copyChunkAttachmentsOnPromotion(AttachmentHolder.AsField from, AttachmentHolder.AsField to) -
onPlayerClone
-
onLivingConvert
-