Interface ItemVariant

All Superinterfaces:
TransferVariant<Item>

@NonExtendable public interface ItemVariant extends TransferVariant<Item>
An immutable count-less ItemStack, i.e. an immutable association of an item and its data components.

Do not implement, use the static of(...) functions instead.

  • Field Details

  • Method Details

    • blank

      static ItemVariant blank()
      Retrieve a blank ItemVariant.
    • of

      static ItemVariant of(ItemStack stack)
      Retrieve an ItemVariant with the item and tag of a stack.
    • of

      static ItemVariant of(ItemConvertible item)
      Retrieve an ItemVariant with an item and without a tag.
    • of

      static ItemVariant of(ItemConvertible item, ComponentChanges components)
      Retrieve an ItemVariant with an item and an optional tag.
    • matches

      default boolean matches(ItemStack stack)
      Return true if the item and tag of this variant match those of the passed stack, and false otherwise.
    • getItem

      default Item getItem()
      Return the item of this variant.
    • getRegistryEntry

      default RegistryEntry<Item> getRegistryEntry()
    • toStack

      default ItemStack toStack()
      Create a new item stack with count 1 from this variant.
    • toStack

      default ItemStack toStack(int count)
      Create a new item stack from this variant.
      Parameters:
      count - The count of the returned stack. It may lead to counts higher than maximum stack size.