Package noppes.npcs.api.item
Interface IItemStack
- All Known Subinterfaces:
IItemArmor,IItemBlock,IItemBook,IItemScripted
public interface IItemStack
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEnchantment(String id, int strenght) booleancompare(IItemStack item, boolean ignoreNBT) copy()voiddamageItem(int damage, IMob living) doubledoublegetAttribute(String name) intintString[]getLore()intintnet.minecraft.world.item.ItemStackNo support is given for this method.getName()getNbt()intStored data persists through world restart.Temp data stores anything but only untill it's reloadedintgetType()booleanhasAttribute(String name) booleanbooleanhasEnchant(String id) booleanhasNbt()booleanisBlock()Deprecated.booleanisBook()Deprecated.booleanbooleanisEmpty()booleanbooleanbooleanremoveEnchant(String id) voidRemoves the nbt from the itemstackvoidsetAttribute(String name, double value) Deprecated.Replaced by setAttribute(String name, double value, int slot)voidsetAttribute(String name, double value, int slot) voidsetCustomName(String name) voidsetDamage(int value) voidvoidsetStackSize(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() -
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
-
addEnchantment
- Parameters:
id- The enchantment idstrenght- The strenght of the enchantment
-
isEnchanted
boolean isEnchanted() -
hasEnchant
- Parameters:
id- The enchantment id
-
removeEnchant
- 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
- 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
-
setAttribute
Deprecated.Replaced by setAttribute(String name, double value, int slot)- Parameters:
name- Attribute name see (https://minecraft.gamepedia.com/Attribute)value-
-
setAttribute
- 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
- Parameters:
name- Attribute name see (https://minecraft.gamepedia.com/Attribute)- Returns:
- Returns the value of this attribute
-
hasAttribute
- 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
-