Interface Item

  • All Known Implementing Classes:
    DataItem

    public interface Item
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      int amount()
      Returns the item amount.
      default short data()
      Returns the item data.
      int identifier()
      Returns the item identifier.
      void setAmount​(int amount)
      Returns the item amount.
      default void setData​(short data)
      Sets the item data used in versions before 1.13.
      void setIdentifier​(int identifier)
      Sets the item identifier.
      void setTag​(@Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag tag)
      Sets the item compound tag.
      @Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag tag()
      Returns the item compound tag if present.
    • Method Detail

      • identifier

        int identifier()
        Returns the item identifier.
        Returns:
        item identifier
      • setIdentifier

        void setIdentifier​(int identifier)
        Sets the item identifier.
        Parameters:
        identifier - item identifier
      • amount

        int amount()
        Returns the item amount.
        Returns:
        item amount
      • setAmount

        void setAmount​(int amount)
        Returns the item amount.
        Parameters:
        amount - item amount
      • 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:
        java.lang.UnsupportedOperationException - if the item implementation does not store data
      • tag

        @Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag tag()
        Returns the item compound tag if present.
        Returns:
        item tag
      • setTag

        void setTag​(@Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag tag)
        Sets the item compound tag.
        Parameters:
        tag - item tag