Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

ItemStack

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.item.ItemStack;

Description

This is the vanilla ItemStack. It is recommended that you use IItemStack whenever possible


They can be cast from each other, though.

Extends

ItemStack extends CapabilityProvider<ItemStack>.

Implements

ItemStack implements the following interfaces:

ICapabilityProviderImpl<ICapabilityProviderImpl>,ICapabilityProvider

Undocumented Interfaces

IItemStackExtension,ICapabilitySerializable<CompoundTag>,INBTSerializable<Tag>

Members

asIIngredient() as IIngredient
script.zs
// ItemStack.asIIngredient() as IIngredient;
myItemStack.asIIngredient();

Return Type: IIngredient

implicit as IIngredient
script.zs
// ItemStack as IIngredient
myItemStack as IIngredient

Return Type: IIngredient

asIItemStack() as IItemStack
script.zs
// ItemStack.asIItemStack() as IItemStack;
myItemStack.asIItemStack();

Return Type: IItemStack

implicit as IItemStack
script.zs
// ItemStack as IItemStack
myItemStack as IItemStack

Return Type: IItemStack

getCapability(cap as Capability<T>, side as Direction) as T?
Gets the capability for the given side.

Returns: The found capability or null.

script.zs
// ItemStack.getCapability<T>(cap as Capability<T>, side as Direction) as T?;
myItemStack.getCapability<T>(Capabilities.ENERGY, <constant:minecraft:direction:north>);

Parameters:

cap Type: Capability<T> - The capability to get.
side Type: Direction - The side to get the capability from, can be null.

Return Type: T?

getCapability(cap as Capability<T>) as T?
Gets the capability.

Returns: The found capability or null.

script.zs
// ItemStack.getCapability<T>(cap as Capability<T>) as T?;
myItemStack.getCapability<T>(Capabilities.ENERGY);

Parameters:

cap Type: Capability<T> - The capability to get.

Return Type: T?