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.

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.MCItemStackMutable;

Implemented Interfaces

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

Casters

Methods

addShiftTooltip

Return Type: void

MCItemStackMutable.addShiftTooltip(content as MCTextComponent, showMessage as MCTextComponent) as void
ParameterTypeDescriptionOptionalDefaultValue
コンテンツMCTextComponentNo Description Providedfalse
showMessageMCTextComponentNo Description Providedtrue
addTooltip

Return Type: void

MCItemStackMutable.addTooltip(content as MCTextComponent) as void
ParameterTypeDescription
コンテンツMCTextComponentNo Description Provided
anyDamage

Return Type: MCIngredientConditioned<IIngredient>

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

Return Type: IIngredientWithAmount

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

ItemStackに設定されているカスタムネームを取り除きます。

Return Type: void

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

Return Type: void

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

Does the ingredient contain the given ingredient?

Return Type: boolean

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

Return Type: MCItemDefinition

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

この材料スタックでクラフトが行われると、グリッド上になにが残るか? ただし、スタックが一致するかどうかのチェックは行いません! Used e.g. in Crafting Table recipes.

Return Type: IItemStack

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

Does the given stack match the ingredient?

Return Type: boolean

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

Return Type: void

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

Use this if you already have the condition from another ingredient

Return Type: MCIngredientConditioned<IIngredient>

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

Return Type: MCIngredientConditioned<IIngredient>

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

Return Type: MCIngredientConditioned<IIngredient>

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

Return Type: void

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

Return Type: MCWeightedItemStack

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

演算子

CONTAINS

Does the ingredient contain the given ingredient?

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

Properties

名称TypeHas GetterHas Setter
amountinttruefalse
burnTimeinttruetrue
damageableboolean型truefalse
damagedboolean型truefalse
definitionMCItemDefinitiontruefalse
displayNamestringtruefalse
emptyboolean型truefalse
getOrCreateIDatatruefalse
getRepairCostinttruefalse
hasDisplayNameboolean型truefalse
hasEffectboolean型truefalse
hasTagboolean型truefalse
isCrossbowboolean型truefalse
isEnchantableboolean型truefalse
isEnchantedboolean型truefalse
maxDamageinttruefalse
maxStackSizeinttruefalse
ownerstringtruefalse
registryNameMCResourceLocationtruefalse
stackableboolean型truefalse
tagIDatatruefalse
translationKeystringtruefalse
useDurationinttruefalse