Package top.girlkisser.lazuli.api.item
Class GhostItemStack
java.lang.Object
top.girlkisser.lazuli.api.item.GhostItemStack
- All Implemented Interfaces:
net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
@ParametersAreNonnullByDefault
public class GhostItemStack
extends Object
implements net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
A fake item stack. Mimics the public methods from
ItemStack.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<GhostItemStack> A codec forGhostItemStacks, based onItemStack.OPTIONAL_CODEC.static final GhostItemStackAn emptyGhostItemStack. -
Constructor Summary
ConstructorsConstructorDescriptionGhostItemStack(net.minecraft.core.Holder<net.minecraft.world.item.Item> item) A fake item stack.GhostItemStack(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, int count) A fake item stack.GhostItemStack(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, int count, net.minecraft.core.component.DataComponentPatch components) A fake item stack.GhostItemStack(net.minecraft.world.level.ItemLike item) A fake item stack.GhostItemStack(net.minecraft.world.level.ItemLike item, int count) A fake item stack. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Copies the stack.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.nbt.CompoundTag tag) net.minecraft.core.component.DataComponentMapGet the ghost stack's data components.net.minecraft.core.component.DataComponentPatchGet the ghost stack's data component patches.intgetCount()Get the stack's count.net.minecraft.world.item.ItemgetItem()Get the stack's item.net.minecraft.world.item.ItemStackgetStack()Get the held stack.static GhostItemStackof(net.minecraft.world.item.ItemStack stack) Create a ghost item stack of the given stack with a count of 1.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider registries)
-
Field Details
-
CODEC
A codec forGhostItemStacks, based onItemStack.OPTIONAL_CODEC. -
EMPTY
An emptyGhostItemStack.
-
-
Constructor Details
-
GhostItemStack
public GhostItemStack(net.minecraft.world.level.ItemLike item) A fake item stack. Mimics the public methods fromItemStack.- Parameters:
item- The ghost stack's item.
-
GhostItemStack
public GhostItemStack(net.minecraft.core.Holder<net.minecraft.world.item.Item> item) A fake item stack. Mimics the public methods fromItemStack.- Parameters:
item- The ghost stack's item.
-
GhostItemStack
public GhostItemStack(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, int count, net.minecraft.core.component.DataComponentPatch components) A fake item stack. Mimics the public methods fromItemStack.- Parameters:
item- The ghost stack's item.count- The ghost stack's count.components- The ghost stack's data components.
-
GhostItemStack
public GhostItemStack(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, int count) A fake item stack. Mimics the public methods fromItemStack.- Parameters:
item- The ghost stack's item.count- The ghost stack's count.
-
GhostItemStack
public GhostItemStack(net.minecraft.world.level.ItemLike item, int count) A fake item stack. Mimics the public methods fromItemStack.- Parameters:
item- The ghost stack's item.count- The ghost stack's count.
-
-
Method Details
-
getItem
public net.minecraft.world.item.Item getItem()Get the stack's item.- Returns:
- The item.
-
getCount
public int getCount()Get the stack's count.- Returns:
- The count.
-
getComponents
public net.minecraft.core.component.DataComponentMap getComponents()Get the ghost stack's data components.- Returns:
- The data components.
-
getComponentsPatch
public net.minecraft.core.component.DataComponentPatch getComponentsPatch()Get the ghost stack's data component patches.- Returns:
- The data component patches.
-
getStack
public net.minecraft.world.item.ItemStack getStack()Get the held stack.- Returns:
- The stack.
-
copy
Copies the stack.- Returns:
- The copy.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider registries) - Specified by:
serializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.nbt.CompoundTag tag) - Specified by:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
of
Create a ghost item stack of the given stack with a count of 1.- Parameters:
stack- The stack.- Returns:
- The ghost stack.
-