An IItemStack Object consists of an item definition, a meta/damage value and NBT data.
In other words, it refers to an item or to a block.

Importing the package

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
import crafttweaker.item.IItemStack;

Calling an IItemStack

There are several methods that return an IItemStack

Calling an IItemStack[] or a IItemStack List

If you call these functions, you will most likely do so to iterate through the resulting lists/Arrays


So what can we do with that now?

Extending IIngredient

IItemStack extends IIngredient.
That means all functionality that is available to IIngredient objects also is applicable to IItemStacks.

Derived Methods


Read how to use them here. Also, check out the examples below.

ZenGetter/ZenMethod ZenSetter/ZenMethod Type
definition IItemDefinition
name string
displayName displayName string
maxStackSize maxStackSize int
hardness hardness float
damage int
maxDamage maxDamage int
hasTag bool
tag withTag(tag) IData
ores List<IOreDictEntry>
toolClasses List<string>
itemEnchantability int
containerItem IItemStack
hasContainerItem bool
repairCost repairCost int
canEditBlocks bool
isOnItemFrame bool
isEnchantable bool
isEnchanted bool
isDamaged bool
isDamageable bool
isStackable bool
isBeaconPayment bool
hasEffect bool
hasDisplayName bool
metadata int
hasSubtypes bool
isEmpty bool
burnTime int
showsDurabilityBar bool
hasCustomEntity bool
enchantments List<IEnchantment>


Method call Returns ParameterTypes
stack.anyAmount() A new IItemStack with the changed property
stack.amount(int amount) A new IItemStack with the changed property int
stack.withAmount(int amount) A new IItemStack with the changed property int
stack * amount A new IItemStack with the changed property int
stack.splitStack(int amount) The split IItemStack. The old one will be reduced accordingly. int


Method call Returns ParameterTypes
stack.percent(float chance) A WeightedItemStack float (100 = 100%)
stack.weight(float chance) A WeightedItemStack float (1 = 100%)


Method call Returns ParameterTypes
stack.anyDamage() A new IItemStack with the changed property
stack.withDamage(int damage) A new IItemStack with the changed property int
stack.damageItem(int amount, IEntity entity) void (nothing) int, IEntity


Method call Returns ParameterTypes
stack.withEmtpyTag() A new IItemStack with the changed property
stack.withTag(IData tag) A new IItemStack with the changed property IData
stack.removeTag(String name) A new IItemStack with the changed property string
stack.updateTag(IData tag) A new IItemStack with the changed property IData

Block Casting

Method call Returns
stack.asBlock() A new IBlock object.
stack as IBlock A new IBlock object.


Method call Returns ParameterTypes
stack.withDisplayName(String name) A new IItemStack with the changed property. Unlike the displayName setter, this only applies to this single item. string (supports color codes with “§”)
stack.withLore(String[] lore) A new IItemStack with the changed property. string[] (supports color codes with “§”)
stack.clearCustomName() void (nothing)


Method call Returns ParameterTypes
stack.canApplyAtCraftingTable(IEnchantmentDefinition enchantment) A bool. IEnchantmentDefinition
stack.addEnchantment(IEnchantment enchantment) void (nothing) IEnchantment


Method call Returns ParameterTypes
stack.canPlaceOn(IBlockPos pos) A bool that tells if the item can be placed on the block. IBlockPos
stack.canDestroy(IBlockPos pos) A bool that tells if the item can destroy the block. IBlockPos
stack.canHarvestBlock(IBlockPos pos) A bool that tells if the item can harvest the block. IBlockPos
stack.getStrengthAgainstBlock(IBlockPos pos) A float that represents the item’s strength against the block. IBlockPos

ItemTransformers and ItemConditions

You can find how to use these either in the IIngredient page or in their respecive entries:
Item Conditions
Item Transformers



Globally (translates the item to the new name).

val apple = <minecraft:apple>;

//prints "Apple"

//Sets apples Display Name to "Tomato"
apple.displayName = "Tomato";

//prints "Tomato"

Locally (only this single item).

<minecraft:coal>.withDisplayName("Black Gold");


<minecraft:coal>.withLore(["This function","requires a","string[]"]);

Maximum Stack Size

The maximum Stack Size is how many items fit in one Stack, for example, wool’s Stack size is 64 and Buckets’ only 16.

val apple = <minecraft:apple>;
val bucket = <minecraft:bucket>;

//prints 64

//sets apples Max Stack size to 32
apple.maxStackSize = 32;

//prints 32

//sets apples Max Stack size to Bucket's Max Stack size
apple.maxStackSize = bucket.maxStackSize;

//prints 16


The Hardness is how long it takes to break the referred block. Only works if the object refers to a block.

val grass = <minecraft:grass>;

//prints 1.0

//sets grass Hardness to 10.0
grass.hardness = 10.0;

//prints 10.0


The damage for items that cannot be damaged is 0.

val pick = <minecraft:diamond_pickaxe>;

//prints 1561

//sets the max damage of the Diamond Pickaxe to 256
pick.maxDamage = 256;

//prints 256

//Damage doesn't matter, used in recipes

//With the given damage


The tag is an IData object.
If the item does not contain a tag, it will return an empty tag, never null.

//creates apple with the given tag
//Removes existing tags
<minecraft:apple>.withTag({Unbreakable: 1});

//creates apple with an emtpy tag

//removes a tag by its name

//update the existing tag
//If the tag doesn't override an existing tag, they will stay constant.
item.updateTag({Unbreakable: 1});


Returns the liquid contained in a single item (if multiple) or null if the item is no container.
Returns an ILiquidStack Object or null.

val lav = <minecraft:lava_bucket>;


How many apples are there?


//1 Apple
val apple = <minecraft:apple>;

//2 Apples
val moreApples = apple * 2;

//3 Apples
val evenMoreApples = <minecraft:apple> * 3;


Returns a weightedItemStack with the provided percentage.

val apple = <minecraft:apple>;

//Creates a weightedItemStack with 100 percent chance
var applePercentage = apple % 100;

//Does the same as the above
applePercentage = apple.weight(1.0);


Returns a List of IOreDictEntries referring to this item.


Casting to IBlock

You can cast an IItemStack to an IBlock, as long as you are referring to a block, otherwise the cast will throw an exception.

<minecraft:dirt> as crafttweaker.block.IBlock;