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.

Импорт класса

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

Утилиты

Тип результатаЯвляется неявным
IDatatrue
IIngredientWithAmounttrue
MapDatatrue
MCItemDefinitiontrue
MCWeightedItemStacktrue

Methods

addShiftTooltip

Return Type: void

MCItemStackMutable.addShiftTooltip(content as MCTextComponent, showMessage as MCTextComponent) as void
ПараметрТипDescriptionOptionalDefaultValue
контентКомпонент MCTextcomponentNo Description Providedfalse
showMessageКомпонент MCTextcomponentNo Description Providedtrue
addTooltip

Return Type: void

MCItemStackMutable.addTooltip(content as MCTextComponent) as void
ПараметрТипDescription
контентКомпонент 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

Clears any custom name set for this 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>));
ПараметрТипDescription
ingredientIIngredientThe ingredient to check
getDefinition

Return Type: MCItemDefinition

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

MCItemStackMutable.getRemainingItem(stack as IItemStack) as IItemStack
<item:minecraft:dirt>.mutable().getRemainingItem(<item:minecraft:iron_ingot>);
ПараметрТипDescription
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>);
ПараметрТипDescription
stackIItemStackThe stack to check
modifyTooltip

Return Type: void

MCItemStackMutable.modifyTooltip(function as ITooltipFunction) as void
ПараметрТипDescription
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>
ПараметрТипDescription
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>
ПараметрТипDescriptionOptionalDefaultValue
uidstringNo Description Providedfalse
functionPredicate<IItemStack>No Description Providedtrue
removeTooltip

Return Type: void

MCItemStackMutable.removeTooltip(regex as string) as void
ПараметрТипDescription
regexstringNo Description Provided
weight

Return Type: MCWeightedItemStack

MCItemStackMutable.weight(weight as double) as MCWeightedItemStack
ПараметрТипDescription
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

Свойства

НазваниеТипИмеет GetterИмеет Setter
amountinttruefalse
burnTimeinttruetrue
damageablebooleantruefalse
damagedbooleantruefalse
definitionMCItemDefinitiontruefalse
displayNamestringtruefalse
emptybooleantruefalse
getOrCreateIDatatruefalse
getRepairCostinttruefalse
hasDisplayNamebooleantruefalse
hasEffectbooleantruefalse
hasTagbooleantruefalse
isCrossbowbooleantruefalse
isEnchantablebooleantruefalse
isEnchantedbooleantruefalse
maxDamageinttruefalse
maxStackSizeinttruefalse
ownerstringtruefalse
registryNameРасположение MCResource-ресурсовtruefalse
stackablebooleantruefalse
tagIDatatruefalse
translationKeystringtruefalse
useDurationinttruefalse