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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<GhostItemStack>
    A codec for GhostItemStacks, based on ItemStack.OPTIONAL_CODEC.
    static final GhostItemStack
    An empty GhostItemStack.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GhostItemStack(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 Type
    Method
    Description
    Copies the stack.
    void
    deserializeNBT(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.nbt.CompoundTag tag)
     
    net.minecraft.core.component.DataComponentMap
    Get the ghost stack's data components.
    net.minecraft.core.component.DataComponentPatch
    Get the ghost stack's data component patches.
    int
    Get the stack's count.
    net.minecraft.world.item.Item
    Get the stack's item.
    net.minecraft.world.item.ItemStack
    Get the held stack.
    of(net.minecraft.world.item.ItemStack stack)
    Create a ghost item stack of the given stack with a count of 1.
    net.minecraft.nbt.CompoundTag
    serializeNBT(net.minecraft.core.HolderLookup.Provider registries)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • GhostItemStack

      public GhostItemStack(net.minecraft.world.level.ItemLike item)
      A fake item stack. Mimics the public methods from ItemStack.
      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 from ItemStack.
      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 from ItemStack.
      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 from ItemStack.
      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 from ItemStack.
      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

      public GhostItemStack copy()
      Copies the stack.
      Returns:
      The copy.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(net.minecraft.core.HolderLookup.Provider registries)
      Specified by:
      serializeNBT in interface net.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:
      deserializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • of

      public static GhostItemStack of(net.minecraft.world.item.ItemStack stack)
      Create a ghost item stack of the given stack with a count of 1.
      Parameters:
      stack - The stack.
      Returns:
      The ghost stack.