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
Return Type: void
IItemStack.addShiftTooltip(content as MCTextComponent, showMessage as MCTextComponent) as void
Parameter | Type | Description | Optional | DefaultValue |
---|
content | MCTextComponent | No Description Provided | false | |
showMessage | MCTextComponent | No Description Provided | true | |
### addTooltip |
Return Type: void
IItemStack.addTooltip(content as MCTextComponent) as void
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();
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();
Return Type: void
IItemStack.modifyTooltip(function as ITooltipFunction) as void
mutable
Return Type: IItemStack
IItemStack.mutable() as IItemStack
<item:minecraft:dirt>.mutable();
Return Type: void
IItemStack.removeTooltip(regex as string) as void
Parameter | Type | Description |
---|
regex | string | No 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");
Parameter | Type | Description |
---|
name | string | New name of the stack. |
weight
Return Type: MCWeightedItemStack
IItemStack.weight(weight as double) as MCWeightedItemStack
Parameter | Type | Description |
---|
weight | double | No Description Provided |
withDamage
Sets the damage of the ItemStack
Return Type: IItemStack
IItemStack.withDamage(damage as int) as IItemStack
<item:minecraft:dirt>.withDamage(10);
Parameter | Type | Description |
---|
damage | int | the 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"]}});
Parameter | Type | Description |
---|
tag | IData | The 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
Name | Type | Has Getter | Has Setter |
---|
amount | int | true | false |
burnTime | int | true | true |
damage | int | true | false |
damageable | boolean | true | false |
damaged | boolean | true | false |
definition | MCItemDefinition | true | false |
displayName | string | true | false |
empty | boolean | true | false |
food | MCFood | true | true |
getOrCreate | IData | true | false |
getRepairCost | int | true | false |
hasDisplayName | boolean | true | false |
hasEffect | boolean | true | false |
hasTag | boolean | true | false |
isCrossbow | boolean | true | false |
isEnchantable | boolean | true | false |
isEnchanted | boolean | true | false |
maxDamage | int | true | false |
maxStackSize | int | true | false |
owner | string | true | false |
registryName | MCResourceLocation | true | false |
stackable | boolean | true | false |
tag | IData | true | false |
translationKey | string | true | false |
useDuration | int | true | false |