All Superinterfaces:
Copyable, ItemBase
All Known Implementing Classes:
DataItem, StructuredItem, StructuredItemTemplate

public interface Item extends ItemBase
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a copy of the item.
    default short
    Returns the item data.
    Returns the data container for item data components.
    static boolean
    isEmpty(@Nullable Item item)
    Returns whether the item is null or empty.
    default boolean
    Returns whether the item is a template item.
    default void
    setData(short data)
    Sets the item data used in versions before 1.13.
    void
    setTag(@Nullable com.viaversion.nbt.tag.CompoundTag tag)
    Sets the item compound tag.
    @Nullable com.viaversion.nbt.tag.CompoundTag
    tag()
    Returns the item compound tag if present.

    Methods inherited from interface com.viaversion.viaversion.api.minecraft.item.ItemBase

    amount, identifier, isEmpty, setAmount, setIdentifier
  • Method Details

    • data

      default short data()
      Returns the item data. Always 0 for 1.13+ items.
      Returns:
      item data
    • setData

      default void setData(short data)
      Sets the item data used in versions before 1.13.
      Parameters:
      data - item data
      Throws:
      UnsupportedOperationException - if the item implementation does not store data
    • tag

      @Nullable com.viaversion.nbt.tag.CompoundTag tag()
      Returns the item compound tag if present.
      Returns:
      item tag
    • setTag

      void setTag(@Nullable com.viaversion.nbt.tag.CompoundTag tag)
      Sets the item compound tag.
      Parameters:
      tag - item tag
    • dataContainer

      StructuredDataContainer dataContainer()
      Returns the data container for item data components.
      Returns:
      the data container
    • copy

      Item copy()
      Returns a copy of the item.
      Specified by:
      copy in interface Copyable
      Specified by:
      copy in interface ItemBase
      Returns:
      copy of the item
    • isTemplate

      default boolean isTemplate()
      Returns whether the item is a template item.
      Returns:
      whether the item is a template item
    • isEmpty

      static boolean isEmpty(@Nullable Item item)
      Returns whether the item is null or empty.
      Parameters:
      item - item
      Returns:
      whether the item is null or empty