MCItemStackMutable
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.
import crafttweaker.api.item.MCItemStackMutable;
Implements
MCItemStackMutable
implements the following interfaces:
FabricItemStack
,IItemStack
,IIngredient
,IIngredientWithAmount
,CommandStringDisplayable
Operators
myIIngredient in myMCItemStackMutable
Parameters:
Return Type:
bool
// (MCItemStackMutable == (o as Object)) as boolmyMCItemStackMutable == myObject
Parameters:
o: Object
Type: Object
Return Type:
bool
// (MCItemStackMutable * (amount as int)) as IIngredientWithAmountmyMCItemStackMutable * myInt
Parameters:
amount: int
Type: int
Return Type:
IIngredientWithAmount
myMCItemStackMutable | myIIngredient
Parameters:
other: IIngredient
Type: IIngredient
Return Type:
IIngredientList
myMCItemStackMutable % myDouble
Parameters:
percentage: double
Type: double
Return Type:
Percentaged<IItemStack>
// (MCItemStackMutable * (amount as int)) as IItemStackmyMCItemStackMutable * myInt
Parameters:
amount: int
Type: int
- new amount
Return Type:
IItemStack
Members
Attributes added with this method appear on all ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to have the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withAttributeModifier
// MCItemStackMutable.addGlobalAttributeModifier(attribute as Attribute, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[]);myMCItemStackMutable.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);
Parameters:
name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method appear on all ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to have the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withAttributeModifier
// MCItemStackMutable.addGlobalAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[]);myMCItemStackMutable.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);
Parameters:
uuid: string
Type: string
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method appear on all ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to have the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withAttributeModifier
// MCItemStackMutable.addGlobalAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[]);myMCItemStackMutable.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, IItemStack.BASE_ATTACK_DAMAGE_UUID, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);
Parameters:
uuid: UUID
Type: UUID
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. // MCItemStackMutable.amount as intmyMCItemStackMutable.amount
Return Type:
int
// MCItemStackMutable.amount as intmyMCItemStackMutable.amount
Return Type:
int
myMCItemStackMutable.asIIngredientWithAmount();
Return Type:
IIngredientWithAmount
// MCItemStackMutable as IIngredientWithAmountmyMCItemStackMutable as IIngredientWithAmount
Return Type:
IIngredientWithAmount
// MCItemStackMutable as IIngredientWithAmountmyMCItemStackMutable as IIngredientWithAmount
Return Type:
IIngredientWithAmount
myMCItemStackMutable.asVanillaIngredient();
Return Type:
Ingredient
// MCItemStackMutable as IngredientmyMCItemStackMutable as Ingredient
Return Type:
Ingredient
myMCItemStackMutable as Percentaged<IItemStack>
Return Type:
Percentaged<IItemStack>
// MCItemStackMutable.BASE_ATTACK_DAMAGE_UUID as UUIDMCItemStackMutable.BASE_ATTACK_DAMAGE_UUID
Return Type:
UUID
// MCItemStackMutable.BASE_ATTACK_SPEED_UUID as UUIDMCItemStackMutable.BASE_ATTACK_SPEED_UUID
Return Type:
UUID
// MCItemStackMutable.baseRepairCost as intmyMCItemStackMutable.baseRepairCost
Return Type:
int
// MCItemStackMutable.burnTime as intmyMCItemStackMutable.burnTime
Return Type:
int
// MCItemStackMutable.burnTime = (time as int);myMCItemStackMutable.burnTime = myInt;
Parameters:
time: int
Type: int
- the new burn time // MCItemStackMutable.burnTime(time as int);myMCItemStackMutable.burnTime(500);
Parameters:
time: int
Type: int
- the new burn time // MCItemStackMutable.clearTooltip(leaveName as bool = false);myMCItemStackMutable.clearTooltip(myBool);
Parameters:
leaveName: bool
(optional) Type: bool
Default Value: false
// MCItemStackMutable.commandString as stringmyMCItemStackMutable.commandString
Return Type:
string
// MCItemStackMutable.commandString as stringmyMCItemStackMutable.commandString
Return Type:
string
// MCItemStackMutable.commandString() as string;myMCItemStackMutable.commandString();
Return Type:
string
myMCItemStackMutable.contains((<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>));
Parameters:
Return Type:
bool
// MCItemStackMutable.CRAFTTWEAKER_DATA_KEY as stringMCItemStackMutable.CRAFTTWEAKER_DATA_KEY
Return Type:
string
// MCItemStackMutable.damage as intmyMCItemStackMutable.damage
Return Type:
int
// MCItemStackMutable.damageableItem as boolmyMCItemStackMutable.damageableItem
Return Type:
bool
// MCItemStackMutable.damaged as boolmyMCItemStackMutable.damaged
Return Type:
bool
// MCItemStackMutable.definition as ItemDefinitionmyMCItemStackMutable.definition
Return Type:
ItemDefinition
// MCItemStackMutable as ItemDefinitionmyMCItemStackMutable as Item
Return Type:
ItemDefinition
// MCItemStackMutable.descriptionId as stringmyMCItemStackMutable.descriptionId
Return Type:
string
// MCItemStackMutable.empty as boolmyMCItemStackMutable.empty
Return Type:
bool
Returns: true if empty, false otherwise
// MCItemStackMutable.empty() as bool;myMCItemStackMutable.empty();
Return Type:
bool
myMCItemStackMutable.enchantments
Return Type:
Integer[Enchantment]
myMCItemStackMutable.enchantments = myMap;
Parameters:
Returns: This itemStack if it is mutable, a new one with the enchantments otherwise
myMCItemStackMutable.enchantments(myMap);
Parameters:
Return Type:
IItemStack
// MCItemStackMutable.fireResistant as boolmyMCItemStackMutable.fireResistant
Return Type:
bool
If true, the item will not burn when thrown into fire or lava.
// MCItemStackMutable.fireResistant = (fireResistant as bool);myMCItemStackMutable.fireResistant = myBool;
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire. Returns: True if this IItemStack is immune to fire. False otherwise.
// MCItemStackMutable.fireResistant() as bool;myMCItemStackMutable.fireResistant();
Return Type:
bool
If true, the item will not burn when thrown into fire or lava.
// MCItemStackMutable.fireResistant(fireResistant as bool);myMCItemStackMutable.fireResistant(myBool);
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire. // MCItemStackMutable.food as FoodPropertiesmyMCItemStackMutable.food
Return Type:
FoodProperties
myMCItemStackMutable.food = myFoodProperties;
Parameters:
food: FoodProperties
Type: FoodProperties
myMCItemStackMutable.food(myFoodProperties);
Parameters:
food: FoodProperties
Type: FoodProperties
Returns: A Map of Attribute to a List of AttributeModifier for the given EquipmentSlot.
// MCItemStackMutable.getAttributes(slotType as EquipmentSlot) as List<AttributeModifier>[Attribute];myMCItemStackMutable.getAttributes(<constant:minecraft:equipmentslot:chest>);
Parameters:
Return Type:
List<AttributeModifier>[Attribute]
myMCItemStackMutable.getEnchantmentLevel(myEnchantment);
Parameters:
enchantment: Enchantment
Type: Enchantment
Return Type:
int
myMCItemStackMutable.getRemainingItem(<item:minecraft:iron_ingot>);
Parameters:
Return Type:
IItemStack
Returns: This IItemStack if mutable, a new one with the new amount otherwise.
myMCItemStackMutable.grow(2);
Parameters:
amount: int
(optional) Type: int
- The amount to grow by.
Default Value: 1
Return Type:
IItemStack
// MCItemStackMutable.hasCustomHoverName as boolmyMCItemStackMutable.hasCustomHoverName
Return Type:
bool
Foil is the glint / effect that is added to enchanted ItemStacks (and other items).
// MCItemStackMutable.hasFoil as boolmyMCItemStackMutable.hasFoil
Return Type:
bool
// MCItemStackMutable.hasTag as boolmyMCItemStackMutable.hasTag
Return Type:
bool
// MCItemStackMutable.ingredient as IIngredientmyMCItemStackMutable.ingredient
Return Type:
IIngredient
// MCItemStackMutable.isEdible as boolmyMCItemStackMutable.isEdible
Return Type:
bool
// MCItemStackMutable.isEdible() as bool;myMCItemStackMutable.isEdible();
Return Type:
bool
// MCItemStackMutable.isEnchantable as boolmyMCItemStackMutable.isEnchantable
Return Type:
bool
// MCItemStackMutable.isEnchanted as boolmyMCItemStackMutable.isEnchanted
Return Type:
bool
// MCItemStackMutable.isMutable as boolmyMCItemStackMutable.isMutable
Return Type:
bool
// MCItemStackMutable.isMutable() as bool;myMCItemStackMutable.isMutable();
Return Type:
bool
myMCItemStackMutable.matches(<item:minecraft:iron_ingot>);
Parameters:
Return Type:
bool
myMCItemStackMutable.matches(<item:minecraft:iron_ingot>, myBool);
Parameters:
ignoreDamage: bool
Type: bool
- Should damage be checked?
Return Type:
bool
// MCItemStackMutable.maxDamage as intmyMCItemStackMutable.maxDamage
Return Type:
int
Setting the damage to
0
will make the item unbreakable.// MCItemStackMutable.maxDamage = (newMaxDamage as int);myMCItemStackMutable.maxDamage = myInt;
Parameters:
newMaxDamage: int
Type: int
- The new max damage of the ItemStack // MCItemStackMutable.maxStackSize as intmyMCItemStackMutable.maxStackSize
Return Type:
int
// MCItemStackMutable.maxStackSize = (newMaxStackSize as int);myMCItemStackMutable.maxStackSize = myInt;
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item. Returns: Max stack size of the Item.
// MCItemStackMutable.maxStackSize() as int;myMCItemStackMutable.maxStackSize();
Return Type:
int
// MCItemStackMutable.maxStackSize(newMaxStackSize as int);myMCItemStackMutable.maxStackSize(16);
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item. // MCItemStackMutable.modifyShiftTooltip(shiftedFunction as ITooltipFunction, unshiftedFunction as ITooltipFunction = null);myMCItemStackMutable.modifyShiftTooltip(myITooltipFunction, myITooltipFunction);
Parameters:
shiftedFunction: ITooltipFunction
Type: ITooltipFunction
myMCItemStackMutable.modifyTooltip(myITooltipFunction);
Parameters:
function: ITooltipFunction
Type: ITooltipFunction
myMCItemStackMutable.mul(myInt);
Parameters:
amount: int
Type: int
Return Type:
IIngredientWithAmount
// MCItemStackMutable.only(condition as IIngredientCondition<IIngredient>) as IngredientConditioned<IIngredient>;myMCItemStackMutable.only(myIIngredientCondition);
Parameters:
condition: IIngredientCondition<IIngredient>
Type: IIngredientCondition<IIngredient>
Return Type:
IngredientConditioned<IIngredient>
myMCItemStackMutable.onlyDamagedAtLeast(myInt);
Parameters:
minDamage: int
Type: int
Return Type:
IngredientConditioned<IIngredient>
myMCItemStackMutable.onlyDamagedAtMost(myInt);
Parameters:
maxDamage: int
Type: int
Return Type:
IngredientConditioned<IIngredient>
// MCItemStackMutable.onlyIf(uid as string, function as function(t as IItemStack) as bool = null) as IngredientConditioned<IIngredient>;myMCItemStackMutable.onlyIf(myString, myPredicate);
Parameters:
uid: string
Type: string
function: function(t as IItemStack) as bool
(optional) Type: function(t as IItemStack) as bool
Default Value: null
Return Type:
IngredientConditioned<IIngredient>
// MCItemStackMutable.owner as stringmyMCItemStackMutable.owner
Return Type:
string
myMCItemStackMutable.percent(myDouble);
Parameters:
percentage: double
Type: double
Return Type:
Percentaged<IItemStack>
// MCItemStackMutable.registryName as ResourceLocationmyMCItemStackMutable.registryName
Return Type:
ResourceLocation
Returns: This itemStack if it is mutable, a new one with the enchantment removed otherwise
myMCItemStackMutable.removeEnchantment(<enchantment:minecraft:riptide>);
Parameters:
Return Type:
IItemStack
Attributes removed with this method are removed from ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to remove the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withoutAttribute.
This method can only remove default Attributes from an ItemStack, it is still possible that an ItemStack can override it.
myMCItemStackMutable.removeGlobalAttribute(<attribute:minecraft:generic.attack_damage>, [<constant:minecraft:equipmentslot:chest>]);
Parameters:
myMCItemStackMutable.removeGlobalAttributeModifier("8c1b5535-9f79-448b-87ae-52d81480aaa3", [<constant:minecraft:equipmentslot:chest>]);
Parameters:
uuid: string
Type: string
- The unique id of the AttributeModifier to remove. myMCItemStackMutable.removeGlobalAttributeModifier(IItemStack.BASE_ATTACK_DAMAGE_UUID, [<constant:minecraft:equipmentslot:chest>]);
Parameters:
uuid: UUID
Type: UUID
- The unique id of the AttributeModifier to remove. // MCItemStackMutable.removeTooltip(regex as string);myMCItemStackMutable.removeTooltip(myString);
Parameters:
regex: string
Type: string
// MCItemStackMutable.resetHoverName();myMCItemStackMutable.resetHoverName();
Returns: This IItemStack if mutable, a new one with the new amount otherwise.
myMCItemStackMutable.shrink(2);
Parameters:
amount: int
(optional) Type: int
- The amount to shrink by.
Default Value: 1
Return Type:
IItemStack
// MCItemStackMutable.stackable as boolmyMCItemStackMutable.stackable
Return Type:
bool
// MCItemStackMutable.transform(transformer as IIngredientTransformer<IIngredient>) as IIngredientTransformed<IIngredient>;myMCItemStackMutable.transform(myIIngredientTransformer);
Parameters:
transformer: IIngredientTransformer<IIngredient>
Type: IIngredientTransformer<IIngredient>
Return Type:
IIngredientTransformed<IIngredient>
// MCItemStackMutable.transformCustom(uid as string, function as function(r as IItemStack) as IItemStack = null) as IIngredientTransformed<IIngredient>;myMCItemStackMutable.transformCustom(myString, myFunction);
Parameters:
uid: string
Type: string
function: function(r as IItemStack) as IItemStack
(optional) Type: function(r as IItemStack) as IItemStack
Default Value: null
Return Type:
IIngredientTransformed<IIngredient>
myMCItemStackMutable.transformDamage(myInt);
Parameters:
amount: int
(optional) Type: int
Default Value: 1
Return Type:
IIngredientTransformed<IIngredient>
// MCItemStackMutable.transformReplace(replaceWith as IItemStack) as IIngredientTransformed<IIngredient>;myMCItemStackMutable.transformReplace(myIItemStack);
Parameters:
replaceWith: IItemStack
Type: IItemStack
Return Type:
IIngredientTransformed<IIngredient>
// MCItemStackMutable.useDuration as intmyMCItemStackMutable.useDuration
Return Type:
int
// MCItemStackMutable.useOnRelease as boolmyMCItemStackMutable.useOnRelease
Return Type:
bool
The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method will only appear on this specific IItemStack.
By defaults, adding a modifier will remove the default Attribute Modifiers on the Item, like the Diamond Chestplate's Armor and Toughness values. When
preserveDefaults
is set to true (by default it is false.), the default Attribute Modifiers will be preserved when adding this modifier. This means that if you were adding the forge:nametag_distance
attribute to an Item, it would keep its default attributes (like Armor and Toughness values).// MCItemStackMutable.withAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;myMCItemStackMutable.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);
Parameters:
uuid: string
Type: string
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. preserveDefaults: bool
(optional) Type: bool
- Should the default Item Attribute Modifiers be preserved when adding this modifier.
Default Value: false
Return Type:
IItemStack
The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method will only appear on this specific IItemStack.
By defaults, adding a modifier will remove the default Attribute Modifiers on the Item, like the Diamond Chestplate's Armor and Toughness values. When
preserveDefaults
is set to true (by default it is false.), the default Attribute Modifiers will be preserved when adding this modifier. This means that if you were adding the forge:nametag_distance
attribute to an Item, it would keep its default attributes (like Armor and Toughness values).// MCItemStackMutable.withAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;myMCItemStackMutable.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);
Parameters:
uuid: UUID
Type: UUID
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. preserveDefaults: bool
(optional) Type: bool
- Should the default Item Attribute Modifiers be preserved when adding this modifier.
Default Value: false
Return Type:
IItemStack
The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method will only appear on this specific IItemStack.
By defaults, adding a modifier will remove the default Attribute Modifiers on the Item, like the Diamond Chestplate's Armor and Toughness values. When
preserveDefaults
is set to true (by default it is false.), the default Attribute Modifiers will be preserved when adding this modifier. This means that if you were adding the forge:nametag_distance
attribute to an Item, it would keep its default attributes (like Armor and Toughness values).// MCItemStackMutable.withAttributeModifier(attribute as Attribute, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;myMCItemStackMutable.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);
Parameters:
name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. preserveDefaults: bool
(optional) Type: bool
- Should the default Item Attribute Modifiers be preserved when adding this modifier.
Default Value: false
Return Type:
IItemStack
myMCItemStackMutable.withDamage(10);
Parameters:
damage: int
Type: int
- the new damage value
Return Type:
IItemStack
myMCItemStackMutable.withDisplayName("totally not dirt");
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the enchantment added otherwise
myMCItemStackMutable.withEnchantment(<enchantment:minecraft:riptide>, 2);
Parameters:
level: int
(optional) Type: int
- The level of the enchantment
Default Value: 1
Return Type:
IItemStack
myMCItemStackMutable.withLore(new crafttweaker.api.text.TextComponent("I am the lore I speak for the trees"););
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the changed property otherwise
myMCItemStackMutable.withoutTag();
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the changed property otherwise
myMCItemStackMutable.withTag({Display: {lore: ["Hello"]}});
Return Type:
IItemStack