public interface IItemStack extends IIngredient
Item stacks can be retrieved using its name (or ID, in 1.6.4) with the bracket syntax. When using the bracket syntax, by default, the item stack will match any size when used as ingredient. Item stacks can be multiplied with an integer to create a stack of different size.
Item stacks are immutable. You can, however, easily create modified stacks using the helper methods. Adding conditions and transformations will turn the item stack into an ingredients.
Modifier and Type | Method and Description |
---|---|
void |
addEnchantment(IEnchantment enchantment) |
IItemStack |
amount(int amount)
Creates a new item stack with a different stack size.
|
IItemStack |
anyAmount()
Creates an item stack with wildcard stack size.
|
IIngredient |
anyDamage()
Creates an item stack with the same item and stack size, but accepting
any damage value.
|
IBlock |
asBlock()
Converts this item stack into a block.
|
boolean |
canApplyAtEnchantingTable(IEnchantmentDefinition enchantment) |
boolean |
canDestroy(IBlockDefinition block) |
boolean |
canEditBlocks() |
boolean |
canHarvestBlock(IBlockState block) |
boolean |
canPlaceOn(IBlockDefinition block) |
void |
clearCustomName() |
IEntityItem |
createEntityItem(IWorld world,
IBlockPos pos) |
IEntityItem |
createEntityItem(IWorld world,
int x,
int y,
int z) |
void |
damageItem(int amount,
IEntity entity) |
float |
getBlockHardness()
Gets the block hardness
|
IItemStack |
getContainerItem()
Gets the item's container ItemStack.
|
int |
getDamage()
Gets the item damage.
|
IItemDefinition |
getDefinition()
Gets the item definition.
|
java.lang.String |
getDisplayName()
Gets the display name.
|
java.util.List<IEnchantment> |
getEnchantments() |
boolean |
getHasSubtypes() |
int |
getItemBurnTime() |
int |
getItemEnchantability() |
ILiquidStack |
getLiquid()
Gets the liquid contained in this item, if any.
|
int |
getMaxDamage()
Gets the maximum item damage.
|
int |
getMaxStackSize()
Gets the max stack size for an item
|
int |
getMetadata() |
java.lang.String |
getName()
Gets the unlocalized item name.
|
java.util.List<IOreDictEntry> |
getOres()
Retrieves all the ores referring to this item.
|
int |
getRepairCost()
Checks the NBT-Tag for the repairCost and returns it as int.
|
float |
getStrengthAgainstBlock(IBlockState blockState) |
IData |
getTag()
Gets the item tag.
|
java.util.List<java.lang.String> |
getToolClasses() |
boolean |
hasContainerItem() |
boolean |
hasCustomEntity() |
boolean |
hasDisplayName() |
boolean |
hasEffect() |
boolean |
hasTag() |
boolean |
isBeaconPayment() |
boolean |
isDamageable() |
boolean |
isEmpty()
Checks if the IItemStack either has an amount of 0 or represents the AIR item.
|
boolean |
isItemDamaged() |
boolean |
isItemEnchantable() |
boolean |
isItemEnchanted() |
boolean |
isOnItemFrame() |
boolean |
isStackable() |
WeightedItemStack |
percent(float p)
Creates a weighted item stack with the given percentage chance.
|
IItemStack |
removeTag(java.lang.String tag)
Creates an item stack without the given nbt tag.
|
void |
setBlockHardness(float hardness)
Sets the block hardness
|
void |
setDisplayName(java.lang.String name)
Sets the display name.
|
void |
setMaxDamage(int damage)
Sets the max Itemstack damage
|
void |
setMaxStackSize(int size)
Sets the ItemStack max stack size.
|
void |
setRepairCost(int repairCost)
Writes the repairCost to the NBT-Tag
|
boolean |
showsDurabilityBar() |
IItemStack |
splitStack(int amount)
Splits the current itemStack and returns the new one.
|
IItemStack |
updateTag(IData tagUpdate)
Creates an item stack with updated nbt tag.
|
WeightedItemStack |
weight(float p)
Creates a weighted item stack with the given weight.
|
IItemStack |
withAmount(int amount)
Creates an item stack with the specified stack size.
|
IItemStack |
withDamage(int damage)
Creates an item stack with the specified damage.
|
IItemStack |
withDisplayName(java.lang.String name)
Adds a display name to the Item, even if it already has nbt
|
IItemStack |
withEmptyTag()
Create an item stack with an empty nbt tag.
|
IItemStack |
withLore(java.lang.String[] lore)
Adds a Lore to the Item, even if it already has nbt
|
IItemStack |
withTag(IData tag)
Creates an item stack with the given nbt tag.
|
applyNewTransform, applyTransform, contains, getAmount, getInternal, getItemArray, getItems, getLiquids, getMark, hasNewTransformers, hasTransformers, marked, matches, matches, matchesExact, only, or, toCommandString, transform, transformNew
IItemDefinition getDefinition()
java.lang.String getName()
java.lang.String getDisplayName()
void setDisplayName(java.lang.String name)
name
- item display nameint getMaxStackSize()
void setMaxStackSize(int size)
size
- the new max sizefloat getBlockHardness()
void setBlockHardness(float hardness)
hardness
- the new hardnessint getDamage()
int getMaxDamage()
void setMaxDamage(int damage)
damage
- the new max damageIData getTag()
ILiquidStack getLiquid()
IItemStack amount(int amount)
amount
in interface IIngredient
amount
- new item stack sizeWeightedItemStack percent(float p)
p
- probability, with percentWeightedItemStack weight(float p)
p
- item weightIIngredient anyDamage()
IItemStack withDamage(int damage)
damage
- damage valueIItemStack withAmount(int amount)
amount
- stack sizeIItemStack anyAmount()
IItemStack withTag(IData tag)
tag
- item tag to be assignedIItemStack withEmptyTag()
IItemStack removeTag(java.lang.String tag)
tag
- item tag to be removedIItemStack updateTag(IData tagUpdate)
tagUpdate
- item tag updatesIBlock asBlock()
java.util.List<IOreDictEntry> getOres()
IItemStack withDisplayName(java.lang.String name)
name
- supports color codes with "§"IItemStack withLore(java.lang.String[] lore)
lore
- supports color codes with "§"java.util.List<java.lang.String> getToolClasses()
int getItemEnchantability()
IItemStack getContainerItem()
boolean isBeaconPayment()
boolean canPlaceOn(IBlockDefinition block)
boolean canDestroy(IBlockDefinition block)
boolean canHarvestBlock(IBlockState block)
int getRepairCost()
void setRepairCost(int repairCost)
repairCost
- boolean canEditBlocks()
boolean isOnItemFrame()
boolean isItemEnchanted()
boolean isItemDamaged()
boolean isDamageable()
boolean isStackable()
void addEnchantment(IEnchantment enchantment)
boolean canApplyAtEnchantingTable(IEnchantmentDefinition enchantment)
java.util.List<IEnchantment> getEnchantments()
boolean isItemEnchantable()
boolean hasEffect()
boolean hasDisplayName()
void clearCustomName()
boolean hasTag()
void damageItem(int amount, IEntity entity)
int getMetadata()
boolean getHasSubtypes()
float getStrengthAgainstBlock(IBlockState blockState)
IItemStack splitStack(int amount)
amount
- amount to splitboolean isEmpty()
int getItemBurnTime()
boolean showsDurabilityBar()
boolean hasCustomEntity()
boolean hasContainerItem()
IEntityItem createEntityItem(IWorld world, int x, int y, int z)
IEntityItem createEntityItem(IWorld world, IBlockPos pos)