Class AttachmentInternals
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentInternals
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
Marks a stack that has attachments and an empty NBT tag ({}). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable CompoundTag
addAttachmentsToTag
(@Nullable CompoundTag tag, ItemStack stack, boolean fullCopy) static @Nullable CompoundTag
cleanTag
(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 void
static void
copyStackAttachments
(ItemStack from, ItemStack to) static void
static void
onPlayerClone
(PlayerEvent.Clone event) static ItemStack
reconstructItemStack
(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
-