Interface IItemStack

All Known Subinterfaces:
IItemArmor, IItemBlock, IItemBook, IItemScripted

public interface IItemStack
  • Method Details

    • getStackSize

      int getStackSize()
    • setStackSize

      void setStackSize(int size)
      Parameters:
      size - The size of the itemstack. A number between 1 and 64
    • getMaxStackSize

      int getMaxStackSize()
    • isDamageable

      boolean isDamageable()
    • getDamage

      int getDamage()
      Returns:
      Returns the damage of this item. Only for items that have durability.
    • setDamage

      void setDamage(int value)
      Parameters:
      value - The value to be set as item damage. Only for items that have durability.
    • getMaxDamage

      int getMaxDamage()
    • getAttackDamage

      double getAttackDamage()
    • damageItem

      void damageItem(int damage, IMob living)
    • addEnchantment

      void addEnchantment(String id, int strenght)
      Parameters:
      id - The enchantment id
      strenght - The strenght of the enchantment
    • isEnchanted

      boolean isEnchanted()
    • hasEnchant

      boolean hasEnchant(String id)
      Parameters:
      id - The enchantment id
    • removeEnchant

      boolean removeEnchant(String id)
      Parameters:
      id - The enchantment id
      Returns:
      Returns whether something was removed or not
    • isBlock

      boolean isBlock()
      Deprecated.
      Returns:
      Returns whether or not this item is a block
    • isWearable

      boolean isWearable()
    • hasCustomName

      boolean hasCustomName()
      Returns:
      Return whether or not the item has a custom name
    • setCustomName

      void setCustomName(String name)
      Parameters:
      name - The custom name this item will get
    • getDisplayName

      String getDisplayName()
      Returns:
      Return the ingame displayed name. This is either the item name or the custom name if it has one.
    • getItemName

      String getItemName()
      Returns:
      Get the items ingame name. Use this incase the item ingame has custom name and you want the original name.
    • getName

      String getName()
      Returns:
      The minecraft name for this item
    • isBook

      boolean isBook()
      Deprecated.
      Returns:
      Whether this is a writable book item. If it is check IItemBook for more info
    • copy

      IItemStack copy()
      Returns:
      A copy of the ItemStack
    • getMCItemStack

      net.minecraft.world.item.ItemStack getMCItemStack()
      No support is given for this method. Dont use if you dont know what you are doing.
      Returns:
      Minecraft ItemStack
    • getNbt

      INbt getNbt()
      Returns:
      Used to get the extra NBT, which is used by enchantments and customname
    • hasNbt

      boolean hasNbt()
      Returns:
      Returns false if the nbt of this itemstack is null or empty
    • removeNbt

      void removeNbt()
      Removes the nbt from the itemstack
    • getItemNbt

      INbt getItemNbt()
      Returns:
      The entire item as nbt
    • isEmpty

      boolean isEmpty()
      Returns:
      Returns true if this itemstack is air or the stacksize is 0
    • getType

      int getType()
    • getLore

      String[] getLore()
    • setLore

      void setLore(String[] lore)
    • setAttribute

      void setAttribute(String name, double value)
      Deprecated.
      Replaced by setAttribute(String name, double value, int slot)
      Parameters:
      name - Attribute name see (https://minecraft.gamepedia.com/Attribute)
      value -
    • setAttribute

      void setAttribute(String name, double value, int slot)
      Parameters:
      name - Attribute name see (https://minecraft.gamepedia.com/Attribute)
      value -
      slot - Slot in which the attribute is active -1:ALL, 0:MAINHAND, 1:OFFHAND, 2:FEET, 3:LEGS, 4:CHEST, 5:HEAD
    • getAttribute

      double getAttribute(String name)
      Parameters:
      name - Attribute name see (https://minecraft.gamepedia.com/Attribute)
      Returns:
      Returns the value of this attribute
    • hasAttribute

      boolean hasAttribute(String name)
      Parameters:
      name - Attribute name see (https://minecraft.gamepedia.com/Attribute)
      Returns:
      Whether or not this item has the attribute
    • getTempdata

      IData getTempdata()
      Temp data stores anything but only untill it's reloaded
    • getStoreddata

      IData getStoreddata()
      Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved
    • getFoodLevel

      int getFoodLevel()
      Returns:
      Returns 0 if the item isnt food and otherwise the amount it restores hunger
    • compare

      boolean compare(IItemStack item, boolean ignoreNBT)