Package noppes.npcs.api.item
Interface IItemStack
- All Known Subinterfaces:
IItemArmor
,IItemBlock
,IItemBook
,IItemScripted
public interface IItemStack
-
Method Summary
Modifier and Type Method Description void
addEnchantment(java.lang.String id, int strenght)
boolean
compare(IItemStack item, boolean ignoreNBT)
IItemStack
copy()
void
damageItem(int damage, IEntityLiving living)
double
getAttackDamage()
double
getAttribute(java.lang.String name)
java.lang.String
getDisplayName()
int
getFoodLevel()
int
getItemDamage()
java.lang.String
getItemName()
INbt
getItemNbt()
java.lang.String[]
getLore()
int
getMaxItemDamage()
int
getMaxStackSize()
net.minecraft.item.ItemStack
getMCItemStack()
No support is given for this method.java.lang.String
getName()
INbt
getNbt()
int
getStackSize()
IData
getStoreddata()
Stored data persists through world restart.IData
getTempdata()
Temp data stores anything but only untill it's reloadedint
getType()
boolean
hasAttribute(java.lang.String name)
boolean
hasCustomName()
boolean
hasEnchant(java.lang.String id)
boolean
hasNbt()
boolean
isBlock()
Deprecated.boolean
isBook()
Deprecated.boolean
isEmpty()
boolean
isEnchanted()
boolean
isWearable()
boolean
removeEnchant(java.lang.String id)
void
removeNbt()
Removes the nbt from the itemstackvoid
setAttribute(java.lang.String name, double value)
Deprecated.Replaced by setAttribute(String name, double value, int slot)void
setAttribute(java.lang.String name, double value, int slot)
void
setCustomName(java.lang.String name)
void
setItemDamage(int value)
void
setLore(java.lang.String[] lore)
void
setStackSize(int size)
-
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() -
getItemDamage
int getItemDamage()- Returns:
- Returns the item damage of this item. For tools this is the durability for other items the color and more.
-
setItemDamage
void setItemDamage(int value)- Parameters:
value
- The value to be set as item damage. For tools this is the durability for other items the color and more.
-
getMaxItemDamage
int getMaxItemDamage() -
getAttackDamage
double getAttackDamage() -
damageItem
-
addEnchantment
void addEnchantment(java.lang.String id, int strenght)- Parameters:
id
- The enchantment idstrenght
- The strenght of the enchantment
-
isEnchanted
boolean isEnchanted() -
hasEnchant
boolean hasEnchant(java.lang.String id)- Parameters:
id
- The enchantment id
-
removeEnchant
boolean removeEnchant(java.lang.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(java.lang.String name)- Parameters:
name
- The custom name this item will get
-
getDisplayName
java.lang.String getDisplayName()- Returns:
- Return the ingame displayed name. This is either the item name or the custom name if it has one.
-
getItemName
java.lang.String getItemName()- Returns:
- Get the items ingame name. Use this incase the item ingame has custom name and you want the original name.
-
getName
java.lang.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.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
java.lang.String[] getLore() -
setLore
void setLore(java.lang.String[] lore) -
setAttribute
void setAttribute(java.lang.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(java.lang.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(java.lang.String name)- Parameters:
name
- Attribute name see (https://minecraft.gamepedia.com/Attribute)- Returns:
- Returns the value of this attribute
-
hasAttribute
boolean hasAttribute(java.lang.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
-