Module gomint.api

Interface ItemStack

    • Method Detail

      • getType

        ItemType getType()
        Get the type of this item stack. This should only be used for fast lookup in switch tables. When you need to check for a item interface (you want to use the API interface of a sign for example) you always need to instanceof check for the interface.
        Returns:
        type of the item
      • getAmount

        byte getAmount()
        Get the amount of items in this stack
        Returns:
        amount of items in stack
      • getMaximumAmount

        byte getMaximumAmount()
        Get maximum amount which should be possible to store in this stack
        Returns:
        maximum amount of items possible
      • setAmount

        ItemStack setAmount​(int amount)
        Set the amount of items in this stack. This is silently capped to getMaximumAmount(), also this item stack returns air when amount is <= 0
        Parameters:
        amount - of items which should be in this stack
        Returns:
        the itemstack instance for further manipulation
      • getData

        short getData()
        Get the metadata from this item stack
        Returns:
        metadata from this item stack
      • setData

        ItemStack setData​(short data)
        Set the data of this item stack
        Parameters:
        data - to set into this stack
        Returns:
        the itemstack instance for further manipulation
      • setCustomName

        ItemStack setCustomName​(String name)
        Set a custom name for this item stack
        Parameters:
        name - of this item stack
        Returns:
        the itemstack instance for further manipulation
      • getCustomName

        String getCustomName()
        Get the custom name of this item
        Returns:
        custom name or null when there is none
      • setLore

        ItemStack setLore​(String... lore)
        Set the lore of this item stack
        Parameters:
        lore - which should be used in this item stack
        Returns:
        the itemstack instance for further manipulation
      • getLore

        String[] getLore()
        Get the lore of this item stack
        Returns:
        lore of this item stack or null when there is none
      • clone

        ItemStack clone()
        Clone this item stack
        Returns:
        cloned item stack
      • addEnchantment

        ItemStack addEnchantment​(Class<? extends Enchantment> clazz,
                                 short level)
        Add enchantment based on class and level
        Parameters:
        clazz - of the enchantment
        level - of the enchantment
        Returns:
        the itemstack instance for further manipulation
      • getEnchantment

        <T extends Enchantment> T getEnchantment​(Class<? extends Enchantment> clazz)
        Get the enchantment or null
        Type Parameters:
        T - type of enchantment object
        Parameters:
        clazz - of the enchantment
        Returns:
        enchantment object or null
      • removeEnchantment

        ItemStack removeEnchantment​(Class<? extends Enchantment> clazz)
        Remove a enchantment from this item stack
        Parameters:
        clazz - of the enchantment
        Returns:
        the itemstack instance for further manipulation