java.lang.Object
com.viaversion.viaversion.api.minecraft.item.DataItem
All Implemented Interfaces:
Item

public class DataItem extends Object implements Item
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    DataItem(int identifier, byte amount, short data, @Nullable com.viaversion.nbt.tag.CompoundTag tag)
     
    DataItem(int identifier, byte amount, @Nullable com.viaversion.nbt.tag.CompoundTag tag)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the item amount.
    Returns a copy of the item.
    short
    Returns the item data.
    Returns the data container for item data components.
    boolean
     
    int
     
    int
    Returns the item identifier.
    void
    setAmount(int amount)
    Returns the item amount.
    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.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 class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

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

    isEmpty
  • Constructor Details

    • DataItem

      public DataItem()
    • DataItem

      public DataItem(int identifier, byte amount, @Nullable com.viaversion.nbt.tag.CompoundTag tag)
    • DataItem

      public DataItem(int identifier, byte amount, short data, @Nullable com.viaversion.nbt.tag.CompoundTag tag)
  • Method Details

    • identifier

      public int identifier()
      Description copied from interface: Item
      Returns the item identifier.
      Specified by:
      identifier in interface Item
      Returns:
      item identifier
    • setIdentifier

      public void setIdentifier(int identifier)
      Description copied from interface: Item
      Sets the item identifier.
      Specified by:
      setIdentifier in interface Item
      Parameters:
      identifier - item identifier
    • amount

      public int amount()
      Description copied from interface: Item
      Returns the item amount.
      Specified by:
      amount in interface Item
      Returns:
      item amount
    • setAmount

      public void setAmount(int amount)
      Description copied from interface: Item
      Returns the item amount.
      Specified by:
      setAmount in interface Item
      Parameters:
      amount - item amount
    • data

      public short data()
      Description copied from interface: Item
      Returns the item data. Always 0 for 1.13+ items.
      Specified by:
      data in interface Item
      Returns:
      item data
    • setData

      public void setData(short data)
      Description copied from interface: Item
      Sets the item data used in versions before 1.13.
      Specified by:
      setData in interface Item
      Parameters:
      data - item data
    • tag

      public @Nullable com.viaversion.nbt.tag.CompoundTag tag()
      Description copied from interface: Item
      Returns the item compound tag if present.
      Specified by:
      tag in interface Item
      Returns:
      item tag
    • setTag

      public void setTag(@Nullable com.viaversion.nbt.tag.CompoundTag tag)
      Description copied from interface: Item
      Sets the item compound tag.
      Specified by:
      setTag in interface Item
      Parameters:
      tag - item tag
    • dataContainer

      public StructuredDataContainer dataContainer()
      Description copied from interface: Item
      Returns the data container for item data components.
      Specified by:
      dataContainer in interface Item
      Returns:
      the data container
    • copy

      public DataItem copy()
      Description copied from interface: Item
      Returns a copy of the item.
      Specified by:
      copy in interface Item
      Returns:
      copy of the item
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object