IItemStack

This represents an item. It can be retrieved using an Item BEP. Is an IIngredient

This class was added by a mod with mod-id crafttweaker. So you need to have this mod installed if you want to use this feature.

Importing the class

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 at the very top of the file.

import crafttweaker.api.item.IItemStack;

Implemented Interfaces

IItemStack implements the following interfaces. That means all methods defined in these interfaces are also available in IItemStack

Casters

Methods

addShiftTooltip

Return Type: void

IItemStack.addShiftTooltip(content as MCTextComponent, showMessage as MCTextComponent) as void
ParameterTypeDescriptionOptionalDefaultValue
contentMCTextComponentNo Description Providedfalse
showMessageMCTextComponentNo Description Providedtrue
### addTooltip

Return Type: void

IItemStack.addTooltip(content as MCTextComponent) as void
ParameterTypeDescription
contentMCTextComponentNo Description Provided

asIIngredientWithAmount

Return Type: IIngredientWithAmount

IItemStack.asIIngredientWithAmount() as IIngredientWithAmount
<item:minecraft:dirt>.asIIngredientWithAmount();

clearCustomName

Clears any custom name set for this ItemStack

Return Type: void

IItemStack.clearCustomName() as void
<item:minecraft:dirt>.clearCustomName();

clearTooltip

Return Type: void

IItemStack.clearTooltip() as void
<item:minecraft:dirt>.clearTooltip();

copy

Creates a copy

Return Type: IItemStack

IItemStack.copy() as IItemStack
<item:minecraft:dirt>.copy();

getDefinition

Return Type: MCItemDefinition

IItemStack.getDefinition() as MCItemDefinition
<item:minecraft:dirt>.getDefinition();

getInternal

Gets the internal ItemStack for this IItemStack.

Return Type: ItemStack

IItemStack.getInternal() as ItemStack
<item:minecraft:dirt>.getInternal();

modifyTooltip

Return Type: void

IItemStack.modifyTooltip(function as ITooltipFunction) as void
ParameterTypeDescription
functionITooltipFunctionNo Description Provided

mutable

Return Type: IItemStack

IItemStack.mutable() as IItemStack
<item:minecraft:dirt>.mutable();

removeTooltip

Return Type: void

IItemStack.removeTooltip(regex as string) as void
ParameterTypeDescription
regexstringNo Description Provided

setDisplayName

Sets the display name of the ItemStack

Return Type: IItemStack

IItemStack.setDisplayName(name as string) as IItemStack
<item:minecraft:dirt>.setDisplayName("totally not dirt");
ParameterTypeDescription
namestringNew name of the stack.

weight

Return Type: MCWeightedItemStack

IItemStack.weight(weight as double) as MCWeightedItemStack
ParameterTypeDescription
weightdoubleNo Description Provided

withDamage

Sets the damage of the ItemStack

Return Type: IItemStack

IItemStack.withDamage(damage as int) as IItemStack
<item:minecraft:dirt>.withDamage(10);
ParameterTypeDescription
damageintthe new damage value

withTag

Sets the tag for the ItemStack.

Return Type: IItemStack

IItemStack.withTag(tag as IData) as IItemStack
<item:minecraft:dirt>.withTag({Display: {lore: ["Hello"]}});
ParameterTypeDescription
tagIDataThe tag to set.

Operators

MOD

myIItemStack % percentage as int

MUL

Sets the amount of the ItemStack

myIItemStack * amount as int
<item:minecraft:dirt> * 3

Properties

NameTypeHas GetterHas Setter
amountinttruefalse
burnTimeinttruetrue
damageinttruefalse
damageablebooleantruefalse
damagedbooleantruefalse
definitionMCItemDefinitiontruefalse
displayNamestringtruefalse
emptybooleantruefalse
foodMCFoodtruetrue
getOrCreateIDatatruefalse
getRepairCostinttruefalse
hasDisplayNamebooleantruefalse
hasEffectbooleantruefalse
hasTagbooleantruefalse
isCrossbowbooleantruefalse
isEnchantablebooleantruefalse
isEnchantedbooleantruefalse
maxDamageinttruefalse
maxStackSizeinttruefalse
ownerstringtruefalse
registryNameMCResourceLocationtruefalse
stackablebooleantruefalse
tagIDatatruefalse
translationKeystringtruefalse
useDurationinttruefalse