NeoForgeIItemStackExpansions

Expands

This class expands IItemStack, meaning that the content found on this page can be called on that type directly.

Members

canPerformAction(action as ItemAbility) as bool
Checks if this item can perform the given ItemAbility.

Returns: True if it can perform the action, false otherwise.

script.zs
// IItemStack.canPerformAction(action as ItemAbility) as bool;
myIItemStack.canPerformAction(myItemAbility);

Parameters:

action Type: ItemAbility - The action to perform.

Return Type: bool

getCapability(cap as ItemCapability<Void, T>) as T?
script.zs
// IItemStack.getCapability<T>(cap as ItemCapability<Void, T>) as T?;
myIItemStack.getCapability<T>(myItemCapability);

Parameters:

cap Type: ItemCapability<Void, T>

Return Type: T?

getCapabilityWithContext(cap as ItemCapability<C, T>, context as C?) as T?
script.zs
// IItemStack.getCapabilityWithContext<C, T>(cap as ItemCapability<C, T>, context as C?) as T?;
myIItemStack.getCapabilityWithContext<C, T>(myItemCapability, myC);

Parameters:

cap Type: ItemCapability<C, T>
context Type: C?

Return Type: T?