MCItemStackMutable

An MCItemStackMutable object is the same as any other IItemStack. The only difference is that changes made to it will not create a new ItemStack, but instead modify the stack given.

This is useful for example when you are dealing with Event Handlers and need to shrink the stack the player is using without assigning a new stack.

Diese Klasse importieren

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.

ZenScript
Copy
import crafttweaker.api.item.MCItemStackMutable;

Implemented Interfaces

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

Casters

Methoden

addShiftTooltip

Return Type: void

ZenScript
Copy
MCItemStackMutable.addShiftTooltip(content as MCTextComponent, showMessage as MCTextComponent) as void
ParameterTypeBeschreibungOptionalDefaultValue
inhaltMCTextkomponenteNo Description Providedfalse
showMessageMCTextkomponenteNo Description Providedtrue
addTooltip

Return Type: void

ZenScript
Copy
MCItemStackMutable.addTooltip(content as MCTextComponent) as void
ParameterTypeBeschreibung
inhaltMCTextkomponenteNo Description Provided
anyDamage

Return Type: MCIngredientConditioned<IIngredient>

ZenScript
Copy
MCItemStackMutable.anyDamage() as MCIngredientConditioned<IIngredient>
<item:minecraft:dirt>.mutable().anyDamage();
asIIngredientWithAmount

Return Type: IIngredientWithAmount

ZenScript
Copy
MCItemStackMutable.asIIngredientWithAmount() as IIngredientWithAmount
<item:minecraft:dirt>.mutable().asIIngredientWithAmount();
clearCustomName

Clears any custom name set for this ItemStack

Return Type: void

ZenScript
Copy
MCItemStackMutable.clearCustomName() as void
<item:minecraft:dirt>.mutable().clearCustomName();
clearTooltip

Return Type: void

ZenScript
Copy
MCItemStackMutable.clearTooltip() as void
<item:minecraft:dirt>.mutable().clearTooltip();
contains

Does the ingredient contain the given ingredient?

Return Type: boolean

ZenScript
Copy
MCItemStackMutable.contains(ingredient as IIngredient) as boolean
<item:minecraft:dirt>.mutable().contains((<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>));
ParameterTypeBeschreibung
ingredientIIngredientThe ingredient to check
getDefinition

Return Type: MCItemDefinition

ZenScript
Copy
MCItemStackMutable.getDefinition() as MCItemDefinition
<item:minecraft:dirt>.mutable().getDefinition();
getRemainingItem

When this ingredient stack is crafted, what will remain in the grid? Does not check if the stack matches though! Used e.g. in Crafting Table recipes.

Return Type: IItemStack

ZenScript
Copy
MCItemStackMutable.getRemainingItem(stack as IItemStack) as IItemStack
<item:minecraft:dirt>.mutable().getRemainingItem(<item:minecraft:iron_ingot>);
ParameterTypeBeschreibung
stackIItemStackThe stack to provide for this ingredient.
matches

Does the given stack match the ingredient?

Return Type: boolean

ZenScript
Copy
MCItemStackMutable.matches(stack as IItemStack) as boolean
<item:minecraft:dirt>.mutable().matches(<item:minecraft:iron_ingot>);
ParameterTypeBeschreibung
stackIItemStackThe stack to check
modifyTooltip

Return Type: void

ZenScript
Copy
MCItemStackMutable.modifyTooltip(function as ITooltipFunction) as void
ParameterTypeBeschreibung
functionITooltipFunctionNo Description Provided
only

Use this if you already have the condition from another ingredient

Return Type: MCIngredientConditioned<IIngredient>

ZenScript
Copy
MCItemStackMutable.only(condition as IIngredientCondition<IIngredient>) as MCIngredientConditioned<IIngredient>
ParameterTypeBeschreibung
conditionIIngredientCondition<IIngredient>No Description Provided
onlyDamaged

Return Type: MCIngredientConditioned<IIngredient>

ZenScript
Copy
MCItemStackMutable.onlyDamaged() as MCIngredientConditioned<IIngredient>
<item:minecraft:dirt>.mutable().onlyDamaged();
onlyIf

Return Type: MCIngredientConditioned<IIngredient>

ZenScript
Copy
MCItemStackMutable.onlyIf(uid as string, function as Predicate<IItemStack>) as MCIngredientConditioned<IIngredient>
ParameterTypeBeschreibungOptionalDefaultValue
uidstringNo Description Providedfalse
functionPredicate<IItemStack>No Description Providedtrue
removeTooltip

Return Type: void

ZenScript
Copy
MCItemStackMutable.removeTooltip(regex as string) as void
ParameterTypeBeschreibung
regexstringNo Description Provided
weight

Return Type: MCWeightedItemStack

ZenScript
Copy
MCItemStackMutable.weight(weight as double) as MCWeightedItemStack
ParameterTypeBeschreibung
weightdoubleNo Description Provided

Operatoren

CONTAINS

Does the ingredient contain the given ingredient?

ZenScript
Copy
ingredient as IIngredient in myMCItemStackMutable
(<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>) in <item:minecraft:dirt>.mutable()
EQUALS
ZenScript
Copy
myMCItemStackMutable == o as Object
MOD
ZenScript
Copy
myMCItemStackMutable % percentage as int
OR
ZenScript
Copy
myMCItemStackMutable | other as IIngredient

Properties

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