Package noppes.npcs.api.item
Interface IItemStack
- All Known Subinterfaces:
IItemArmor
,IItemBlock
,IItemBook
,IItemScripted
public interface IItemStack
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEnchantment
(String id, int strenght) boolean
compare
(IItemStack item, boolean ignoreNBT) copy()
void
damageItem
(int damage, IMob living) double
double
getAttribute
(String name) int
int
String[]
getLore()
int
int
net.minecraft.world.item.ItemStack
No support is given for this method.getName()
getNbt()
int
Stored data persists through world restart.Temp data stores anything but only untill it's reloadedint
getType()
boolean
hasAttribute
(String name) boolean
boolean
hasEnchant
(String id) boolean
hasNbt()
boolean
isBlock()
Deprecated.boolean
isBook()
Deprecated.boolean
boolean
isEmpty()
boolean
boolean
boolean
removeEnchant
(String id) void
Removes the nbt from the itemstackvoid
setAttribute
(String name, double value) Deprecated.Replaced by setAttribute(String name, double value, int slot)void
setAttribute
(String name, double value, int slot) void
setCustomName
(String name) void
setDamage
(int value) void
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() -
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
-