Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

IItemStack

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.

script.zs
import crafttweaker.api.item.IItemStack;

Implements

IItemStack implements the following interfaces:

IIngredient,IIngredientWithAmount,CommandStringDisplayable

Operators

in(ingredient as IIngredient) as bool
Does the ingredient contain the given ingredient?
script.zs
// ((ingredient as IIngredient) in IItemStack) as bool
myIIngredient in myIItemStack

Parameters:

ingredient Type: IIngredient - The ingredient to check

Return Type: bool

*(amount as int) as IIngredientWithAmount
Use this in contexts where machines accept more than one item to state that fact.
script.zs
// (IItemStack * (amount as int)) as IIngredientWithAmount
myIItemStack * myInt

Parameters:

amount Type: int

Return Type: IIngredientWithAmount

|(other as IIngredient) as IIngredientList
script.zs
// (IItemStack | (other as IIngredient)) as IIngredientList
myIItemStack | myIIngredient

Parameters:

other Type: IIngredient

Return Type: IIngredientList

%(percentage as double) as Percentaged<IItemStack>
script.zs
// (IItemStack % (percentage as double)) as Percentaged<IItemStack>
myIItemStack % myDouble

Parameters:

percentage Type: double

Return Type: Percentaged<IItemStack>

*(amount as int) as IItemStack
Sets the amount of the ItemStack
script.zs
// (IItemStack * (amount as int)) as IItemStack
myIItemStack * myInt

Parameters:

amount Type: int - new amount

Return Type: IItemStack

Members

addGlobalAttributeModifier(attribute as Attribute, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[])
Adds an AttributeModifier to this IIngredient.
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
script.zs
// IItemStack.addGlobalAttributeModifier(attribute as Attribute, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[]);
myIItemStack.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);

Parameters:

attribute Type: Attribute - The Attribute of the modifier.
name Type: string - The name of the modifier.
value Type: double - The value of the modifier.
operation Type: AttributeOperation - The operation of the modifier.
slotTypes Type: EquipmentSlot[] - What slots the modifier is valid for.
addGlobalAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[])
Adds an AttributeModifier to this IIngredient using a specific UUID.
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
script.zs
// IItemStack.addGlobalAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[]);
myIItemStack.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);

Parameters:

attribute Type: Attribute - The Attribute of the modifier.
uuid Type: string - The unique identifier of the modifier to replace.
name Type: string - The name of the modifier.
value Type: double - The value of the modifier.
operation Type: AttributeOperation - The operation of the modifier.
slotTypes Type: EquipmentSlot[] - What slots the modifier is valid for.
addGlobalAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[])
Adds an AttributeModifier to this IIngredient using a specific UUID.
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
script.zs
// IItemStack.addGlobalAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[]);
myIItemStack.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, IItemStack.BASE_ATTACK_DAMAGE_UUID, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);

Parameters:

attribute Type: Attribute - The Attribute of the modifier.
uuid Type: UUID - The unique identifier of the modifier to replace.
name Type: string - The name of the modifier.
value Type: double - The value of the modifier.
operation Type: AttributeOperation - The operation of the modifier.
slotTypes Type: EquipmentSlot[] - What slots the modifier is valid for.
addShiftTooltip(content as Component, showMessage as Component = null)
script.zs
// IItemStack.addShiftTooltip(content as Component, showMessage as Component = null);
myIItemStack.addShiftTooltip(myComponent, myComponent);

Parameters:

content Type: Component
showMessage (optional) Type: Component

Default Value: null

addTooltip(content as Component)
script.zs
// IItemStack.addTooltip(content as Component);
myIItemStack.addTooltip(myComponent);

Parameters:

content Type: Component
Getter
Gets the amount of Items in the ItemStack
script.zs
// IItemStack.amount as int
myIItemStack.amount

Return Type: int

anyDamage() as IIngredientConditioned<IIngredient>
script.zs
// IItemStack.anyDamage() as IIngredientConditioned<IIngredient>;
myIItemStack.anyDamage();

Return Type: IngredientConditioned<IIngredient>

asIIngredientWithAmount() as IIngredientWithAmount
script.zs
// IItemStack.asIIngredientWithAmount() as IIngredientWithAmount;
myIItemStack.asIIngredientWithAmount();

Return Type: IIngredientWithAmount

implicit as IIngredientWithAmount
script.zs
// IItemStack as IIngredientWithAmount
myIItemStack as IIngredientWithAmount

Return Type: IIngredientWithAmount

asImmutable() as IItemStack
script.zs
// IItemStack.asImmutable() as IItemStack;
myIItemStack.asImmutable();

Return Type: IItemStack

asItemLike() as ItemLike
script.zs
// IItemStack.asItemLike() as ItemLike;
myIItemStack.asItemLike();

Return Type: ItemLike

implicit as ItemLike
script.zs
// IItemStack as ItemLike
myIItemStack as ItemLike

Return Type: ItemLike

implicit as MapData
script.zs
// IItemStack as MapData
myIItemStack as MapData

Return Type: MapData

asMutable() as IItemStack
script.zs
// IItemStack.asMutable() as IItemStack;
myIItemStack.asMutable();

Return Type: IItemStack

implicit as Percentaged<IItemStack>
script.zs
// IItemStack as Percentaged<IItemStack>
myIItemStack as Percentaged<IItemStack>

Return Type: Percentaged<IItemStack>

Field
script.zs
// IItemStack.BASE_ATTACK_DAMAGE_UUID as UUID
IItemStack.BASE_ATTACK_DAMAGE_UUID

Return Type: UUID

Field
script.zs
// IItemStack.BASE_ATTACK_SPEED_UUID as UUID
IItemStack.BASE_ATTACK_SPEED_UUID

Return Type: UUID

Getter
Gets the base repair cost of the ItemStack, or 0 if no repair is defined.
script.zs
// IItemStack.baseRepairCost as int
myIItemStack.baseRepairCost

Return Type: int

Getter
script.zs
// IItemStack.burnTime as int
myIItemStack.burnTime

Return Type: int

Setter
Sets the burn time of this ingredient, for use in the furnace and other machines
script.zs
// IItemStack.burnTime = (time as int);
myIItemStack.burnTime = myInt;

Parameters:

time Type: int - the new burn time
burnTime(time as int)
Sets the burn time of this ingredient, for use in the furnace and other machines
script.zs
// IItemStack.burnTime(time as int);
myIItemStack.burnTime(500);

Parameters:

time Type: int - the new burn time
clearTooltip(leaveName as bool = false)
script.zs
// IItemStack.clearTooltip(leaveName as bool = false);
myIItemStack.clearTooltip(myBool);

Parameters:

leaveName (optional) Type: bool

Default Value: false

contains(ingredient as IIngredient) as bool
Does the ingredient contain the given ingredient?
script.zs
// IItemStack.contains(ingredient as IIngredient) as bool;
myIItemStack.contains((<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>));

Parameters:

ingredient Type: IIngredient - The ingredient to check

Return Type: bool

copy() as IItemStack
Creates a copy
script.zs
// IItemStack.copy() as IItemStack;
myIItemStack.copy();

Return Type: IItemStack

Field
script.zs
// IItemStack.CRAFTTWEAKER_DATA_KEY as string
IItemStack.CRAFTTWEAKER_DATA_KEY

Return Type: string

Getter
script.zs
// IItemStack.damage as int
myIItemStack.damage

Return Type: int

Getter
Returns if the ItemStack is damageable I.E Swords and tools are damageable, sticks are not.
script.zs
// IItemStack.damageableItem as bool
myIItemStack.damageableItem

Return Type: bool

Getter
Returns if the ItemStack is damaged I.E a Swords that is no at full durability is damaged.
script.zs
// IItemStack.damaged as bool
myIItemStack.damaged

Return Type: bool

Getter
script.zs
// IItemStack.definition as Item
myIItemStack.definition

Return Type: ItemDefinition

definition() as Item
script.zs
// IItemStack.definition() as Item;
myIItemStack.definition();

Return Type: ItemDefinition

implicit as Item
script.zs
// IItemStack as Item
myIItemStack as Item

Return Type: ItemDefinition

Getter
Returns the unlocalized Name of the Item in the ItemStack
script.zs
// IItemStack.descriptionId as string
myIItemStack.descriptionId

Return Type: string

Getter
Gets the display name of the ItemStack
script.zs
// IItemStack.displayName as Component
myIItemStack.displayName

Return Type: Component

Getter
script.zs
// IItemStack.enchantments as Integer[Enchantment]
myIItemStack.enchantments

Return Type: Integer[Enchantment]

Setter
Sets the enchantments on this IItemStack.
script.zs
// IItemStack.enchantments = (enchantments as Integer[Enchantment]);
myIItemStack.enchantments = myMap;

Parameters:

enchantments Type: Integer[Enchantment] - The new enchantments
enchantments() as Integer[Enchantment]
script.zs
// IItemStack.enchantments() as Integer[Enchantment];
myIItemStack.enchantments();

Return Type: Integer[Enchantment]

enchantments(enchantments as Integer[Enchantment]) as IItemStack
Sets the enchantments on this IItemStack.

Returns: This itemStack if it is mutable, a new one with the enchantments otherwise

script.zs
// IItemStack.enchantments(enchantments as Integer[Enchantment]) as IItemStack;
myIItemStack.enchantments(myMap);

Parameters:

enchantments Type: Integer[Enchantment] - The new enchantments

Return Type: IItemStack

Getter
Checks if this IItemStack burns when thrown into fire / lava or damaged by fire.
script.zs
// IItemStack.fireResistant as bool
myIItemStack.fireResistant

Return Type: bool

Setter
Sets if this IItemStack is immune to fire / lava.
If true, the item will not burn when thrown into fire or lava.
script.zs
// IItemStack.fireResistant = (fireResistant as bool);
myIItemStack.fireResistant = myBool;

Parameters:

fireResistant Type: bool - Should the item be immune to fire.
fireResistant() as bool
Checks if this IItemStack burns when thrown into fire / lava or damaged by fire.

Returns: True if this IItemStack is immune to fire. False otherwise.

script.zs
// IItemStack.fireResistant() as bool;
myIItemStack.fireResistant();

Return Type: bool

fireResistant(fireResistant as bool)
Sets if this IItemStack is immune to fire / lava.
If true, the item will not burn when thrown into fire or lava.
script.zs
// IItemStack.fireResistant(fireResistant as bool);
myIItemStack.fireResistant(myBool);

Parameters:

fireResistant Type: bool - Should the item be immune to fire.
Getter
script.zs
// IItemStack.food as FoodProperties
myIItemStack.food

Return Type: FoodProperties

Setter
script.zs
// IItemStack.food = (food as FoodProperties);
myIItemStack.food = myFoodProperties;

Parameters:

food() as FoodProperties
script.zs
// IItemStack.food() as FoodProperties;
myIItemStack.food();

Return Type: FoodProperties

food(food as FoodProperties)
script.zs
// IItemStack.food(food as FoodProperties);
myIItemStack.food(myFoodProperties);

Parameters:

getAttributes(slotType as EquipmentSlot) as List<AttributeModifier>[Attribute]
Gets the Attributes and the AttributeModifiers on this IItemStack for the given EquipmentSlot

Returns: A Map of Attribute to a List of AttributeModifier for the given EquipmentSlot.

script.zs
// IItemStack.getAttributes(slotType as EquipmentSlot) as List<AttributeModifier>[Attribute];
myIItemStack.getAttributes(<constant:minecraft:equipmentslot:chest>);

Parameters:

slotType Type: EquipmentSlot - The slot to get the Attributes for.

Return Type: List<AttributeModifier>[Attribute]

getEnchantmentLevel(enchantment as Enchantment) as int
Gets the level of the given enchantment on the item. Returns 0 if the item doesn't have the given enchantment.
script.zs
// IItemStack.getEnchantmentLevel(enchantment as Enchantment) as int;
myIItemStack.getEnchantmentLevel(myEnchantment);

Parameters:

enchantment Type: Enchantment

Return Type: int

getImmutableInternal() as ItemStack
script.zs
// IItemStack.getImmutableInternal() as ItemStack;
myIItemStack.getImmutableInternal();

Return Type: ItemStack

getInternal() as ItemStack
Gets the internal ItemStack for this IItemStack.

Returns: internal ItemStack

script.zs
// IItemStack.getInternal() as ItemStack;
myIItemStack.getInternal();

Return Type: ItemStack

implicit as ItemStack
Gets the internal ItemStack for this IItemStack.
script.zs
// IItemStack as ItemStack
myIItemStack as ItemStack

Return Type: ItemStack

getOrCreateTag() as IData
Returns the NBT tag attached to this ItemStack or makes a new tag.

Returns: MapData of the ItemStack NBT Tag, empty tag if it doesn't exist.

script.zs
// IItemStack.getOrCreateTag() as IData;
myIItemStack.getOrCreateTag();

Return Type: IData

getRemainingItem(stack as IItemStack) as IItemStack
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.
script.zs
// IItemStack.getRemainingItem(stack as IItemStack) as IItemStack;
myIItemStack.getRemainingItem(<item:minecraft:iron_ingot>);

Parameters:

stack Type: IItemStack - The stack to provide for this ingredient.

Return Type: IItemStack

grow(amount as int = 1) as IItemStack
Grows this IItemStack's stack size by the given amount, or 1 if no amount is given.

Returns: This IItemStack if mutable, a new one with the new amount otherwise.

script.zs
// IItemStack.grow(amount as int = 1) as IItemStack;
myIItemStack.grow(2);

Parameters:

amount (optional) Type: int - The amount to grow by.

Default Value: 1

Return Type: IItemStack

Getter
Returns true if the ItemStack has a display name.
script.zs
// IItemStack.hasCustomHoverName as bool
myIItemStack.hasCustomHoverName

Return Type: bool

Getter
Returns true if this ItemStack has a foil effect.
Foil is the glint / effect that is added to enchanted ItemStacks (and other items).
script.zs
// IItemStack.hasFoil as bool
myIItemStack.hasFoil

Return Type: bool

Getter
Returns true if this ItemStack has a Tag
script.zs
// IItemStack.hasTag as bool
myIItemStack.hasTag

Return Type: bool

Getter
Gets the hover name of the ItemStack.

This will give the raw name without the formatting that 'displayName' applies.

script.zs
// IItemStack.hoverName as Component
myIItemStack.hoverName

Return Type: Component

hoverName() as Component
Gets the hover name of the ItemStack.

This will give the raw name without the formatting that 'displayName' applies.

Returns: The hover name of the ItemStack.

script.zs
// IItemStack.hoverName() as Component;
myIItemStack.hoverName();

Return Type: Component

Getter
script.zs
// IItemStack.isEdible as bool
myIItemStack.isEdible

Return Type: bool

isEdible() as bool
script.zs
// IItemStack.isEdible() as bool;
myIItemStack.isEdible();

Return Type: bool

Getter
Can this ItemStack be enchanted?
script.zs
// IItemStack.isEnchantable as bool
myIItemStack.isEnchantable

Return Type: bool

Getter
Is this ItemStack enchanted?
script.zs
// IItemStack.isEnchanted as bool
myIItemStack.isEnchanted

Return Type: bool

Getter
script.zs
// IItemStack.isImmutable as bool
myIItemStack.isImmutable

Return Type: bool

isImmutable() as bool
script.zs
// IItemStack.isImmutable() as bool;
myIItemStack.isImmutable();

Return Type: bool

Getter
script.zs
// IItemStack.isMutable as bool
myIItemStack.isMutable

Return Type: bool

isMutable() as bool
script.zs
// IItemStack.isMutable() as bool;
myIItemStack.isMutable();

Return Type: bool

Getter
script.zs
// IItemStack.items as IItemStack[]
myIItemStack.items

Return Type: IItemStack[]

matches(stack as IItemStack) as bool
Does the given stack match the ingredient?
script.zs
// IItemStack.matches(stack as IItemStack) as bool;
myIItemStack.matches(<item:minecraft:iron_ingot>);

Parameters:

stack Type: IItemStack - The stack to check

Return Type: bool

Getter
Returns the max damage of the ItemStack This is the max durability of the ItemStack.
script.zs
// IItemStack.maxDamage as int
myIItemStack.maxDamage

Return Type: int

Setter
Sets the max damage of the ItemStack.
Setting the damage to 0 will make the item unbreakable.
script.zs
// IItemStack.maxDamage = (newMaxDamage as int);
myIItemStack.maxDamage = myInt;

Parameters:

newMaxDamage Type: int - The new max damage of the ItemStack
Getter
Returns the max stack size of the Item in the ItemStack
script.zs
// IItemStack.maxStackSize as int
myIItemStack.maxStackSize

Return Type: int

Setter
Sets the max stacksize of the Item.
script.zs
// IItemStack.maxStackSize = (newMaxStackSize as int);
myIItemStack.maxStackSize = myInt;

Parameters:

newMaxStackSize Type: int - The new max stack size of the Item.
maxStackSize() as int
Returns the max stack size of the Item in the ItemStack

Returns: Max stack size of the Item.

script.zs
// IItemStack.maxStackSize() as int;
myIItemStack.maxStackSize();

Return Type: int

maxStackSize(newMaxStackSize as int)
Sets the max stacksize of the Item.
script.zs
// IItemStack.maxStackSize(newMaxStackSize as int);
myIItemStack.maxStackSize(16);

Parameters:

newMaxStackSize Type: int - The new max stack size of the Item.
modifyShiftTooltip(shiftedFunction as ITooltipFunction, unshiftedFunction as ITooltipFunction = null)
script.zs
// IItemStack.modifyShiftTooltip(shiftedFunction as ITooltipFunction, unshiftedFunction as ITooltipFunction = null);
myIItemStack.modifyShiftTooltip(myITooltipFunction, myITooltipFunction);

Parameters:

shiftedFunction Type: ITooltipFunction
unshiftedFunction (optional) Type: ITooltipFunction

Default Value: null

modifyTooltip(function as ITooltipFunction)
script.zs
// IItemStack.modifyTooltip(function as ITooltipFunction);
myIItemStack.modifyTooltip(myITooltipFunction);

Parameters:

mul(amount as int) as IIngredientWithAmount
Use this in contexts where machines accept more than one item to state that fact.
script.zs
// IItemStack.mul(amount as int) as IIngredientWithAmount;
myIItemStack.mul(myInt);

Parameters:

amount Type: int

Return Type: IIngredientWithAmount

only(condition as IIngredientCondition<IIngredient>) as IIngredientConditioned<IIngredient>
Use this if you already have the condition from another ingredient
script.zs
// IItemStack.only(condition as IIngredientCondition<IIngredient>) as IIngredientConditioned<IIngredient>;
myIItemStack.only(myIIngredientCondition);

Return Type: IngredientConditioned<IIngredient>

onlyDamaged() as IIngredientConditioned<IIngredient>
script.zs
// IItemStack.onlyDamaged() as IIngredientConditioned<IIngredient>;
myIItemStack.onlyDamaged();

Return Type: IngredientConditioned<IIngredient>

onlyDamagedAtLeast(minDamage as int) as IIngredientConditioned<IIngredient>
script.zs
// IItemStack.onlyDamagedAtLeast(minDamage as int) as IIngredientConditioned<IIngredient>;
myIItemStack.onlyDamagedAtLeast(myInt);

Parameters:

minDamage Type: int

Return Type: IngredientConditioned<IIngredient>

onlyDamagedAtMost(maxDamage as int) as IIngredientConditioned<IIngredient>
script.zs
// IItemStack.onlyDamagedAtMost(maxDamage as int) as IIngredientConditioned<IIngredient>;
myIItemStack.onlyDamagedAtMost(myInt);

Parameters:

maxDamage Type: int

Return Type: IngredientConditioned<IIngredient>

onlyIf(uid as string, function as function(t as IItemStack) as bool = null) as IIngredientConditioned<IIngredient>
script.zs
// IItemStack.onlyIf(uid as string, function as function(t as IItemStack) as bool = null) as IIngredientConditioned<IIngredient>;
myIItemStack.onlyIf(myString, myPredicate);

Parameters:

uid Type: string
function (optional) Type: function(t as IItemStack) as bool

Default Value: null

Return Type: IngredientConditioned<IIngredient>

Getter
Gets owning mod for the Item in this IItemStack
script.zs
// IItemStack.owner as string
myIItemStack.owner

Return Type: string

percent(percentage as double) as Percentaged<IItemStack>
script.zs
// IItemStack.percent(percentage as double) as Percentaged<IItemStack>;
myIItemStack.percent(myDouble);

Parameters:

percentage Type: double

Return Type: Percentaged<IItemStack>

Getter
Returns the rarity of the Item in the ItemStack
script.zs
// IItemStack.rarity as Rarity
myIItemStack.rarity

Return Type: Rarity

Setter
Sets the rarity of the Item.
script.zs
// IItemStack.rarity = (newRarity as Rarity);
myIItemStack.rarity = myRarity;

Parameters:

newRarity Type: Rarity - The new rarity of the Item.
rarity() as Rarity
Returns the rarity of the Item in the ItemStack

Returns: Rarity of the Item.

script.zs
// IItemStack.rarity() as Rarity;
myIItemStack.rarity();

Return Type: Rarity

rarity(newRarity as Rarity)
Sets the rarity of the Item.
script.zs
// IItemStack.rarity(newRarity as Rarity);
myIItemStack.rarity(Rarity.UNCOMMON);

Parameters:

newRarity Type: Rarity - The new rarity of the Item.
Getter
Gets the registry name for the Item in this IItemStack
script.zs
// IItemStack.registryName as ResourceLocation
myIItemStack.registryName

Return Type: ResourceLocation

removeEnchantment(enchantment as Enchantment) as IItemStack
Removes the given enchantment from this IItemStack.

Returns: This itemStack if it is mutable, a new one with the enchantment removed otherwise

script.zs
// IItemStack.removeEnchantment(enchantment as Enchantment) as IItemStack;
myIItemStack.removeEnchantment(<enchantment:minecraft:riptide>);

Parameters:

enchantment Type: Enchantment - The enchantment to remove.

Return Type: IItemStack

removeGlobalAttribute(attribute as Attribute, slotTypes as EquipmentSlot[])
Removes all AttributeModifiers that use the given Attribute from this IIngredient.
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.
script.zs
// IItemStack.removeGlobalAttribute(attribute as Attribute, slotTypes as EquipmentSlot[]);
myIItemStack.removeGlobalAttribute(<attribute:minecraft:generic.attack_damage>, [<constant:minecraft:equipmentslot:chest>]);

Parameters:

attribute Type: Attribute - The attribute to remove.
slotTypes Type: EquipmentSlot[] - The slot types to remove it from.
removeGlobalAttributeModifier(uuid as string, slotTypes as EquipmentSlot[])
Removes all AttributeModifiers who's ID is the same as the given uuid from this IIngredient.
script.zs
// IItemStack.removeGlobalAttributeModifier(uuid as string, slotTypes as EquipmentSlot[]);
myIItemStack.removeGlobalAttributeModifier("8c1b5535-9f79-448b-87ae-52d81480aaa3", [<constant:minecraft:equipmentslot:chest>]);

Parameters:

uuid Type: string - The unique id of the AttributeModifier to remove.
slotTypes Type: EquipmentSlot[] - The slot types to remove it from.
removeGlobalAttributeModifier(uuid as UUID, slotTypes as EquipmentSlot[])
Removes all AttributeModifiers who's ID is the same as the given uuid from this IIngredient.
script.zs
// IItemStack.removeGlobalAttributeModifier(uuid as UUID, slotTypes as EquipmentSlot[]);
myIItemStack.removeGlobalAttributeModifier(IItemStack.BASE_ATTACK_DAMAGE_UUID, [<constant:minecraft:equipmentslot:chest>]);

Parameters:

uuid Type: UUID - The unique id of the AttributeModifier to remove.
slotTypes Type: EquipmentSlot[] - The slot types to remove it from.
removeTooltip(regex as string)
script.zs
// IItemStack.removeTooltip(regex as string);
myIItemStack.removeTooltip(myString);

Parameters:

regex Type: string
resetHoverName()
Clears any custom name set for this ItemStack
script.zs
// IItemStack.resetHoverName();
myIItemStack.resetHoverName();
reuse() as IIngredientTransformed<IIngredient>
script.zs
// IItemStack.reuse() as IIngredientTransformed<IIngredient>;
myIItemStack.reuse();

Return Type: IIngredientTransformed<IIngredient>

shrink(amount as int = 1) as IItemStack
Shrinks this IItemStack's stack size by the given amount, or 1 if no amount is given.

Returns: This IItemStack if mutable, a new one with the new amount otherwise.

script.zs
// IItemStack.shrink(amount as int = 1) as IItemStack;
myIItemStack.shrink(2);

Parameters:

amount (optional) Type: int - The amount to shrink by.

Default Value: 1

Return Type: IItemStack

Getter
Returns if the ItemStack can have an amount greater than 1 I.E Swords and tools are not stackable, sticks are.
script.zs
// IItemStack.stackable as bool
myIItemStack.stackable

Return Type: bool

Getter
Returns the NBT tag attached to this ItemStack.
script.zs
// IItemStack.tag as IData
myIItemStack.tag

Return Type: IData

transform(transformer as IIngredientTransformer<IIngredient>) as IIngredientTransformed<IIngredient>
Use this if you already have the transformer from another ingredient
script.zs
// IItemStack.transform(transformer as IIngredientTransformer<IIngredient>) as IIngredientTransformed<IIngredient>;
myIItemStack.transform(myIIngredientTransformer);

Return Type: IIngredientTransformed<IIngredient>

transformCustom(uid as string, function as function(r as IItemStack) as IItemStack = null) as IIngredientTransformed<IIngredient>
script.zs
// IItemStack.transformCustom(uid as string, function as function(r as IItemStack) as IItemStack = null) as IIngredientTransformed<IIngredient>;
myIItemStack.transformCustom(myString, myFunction);

Parameters:

uid Type: string
function (optional) Type: function(r as IItemStack) as IItemStack

Default Value: null

Return Type: IIngredientTransformed<IIngredient>

transformDamage(amount as int = 1) as IIngredientTransformed<IIngredient>
script.zs
// IItemStack.transformDamage(amount as int = 1) as IIngredientTransformed<IIngredient>;
myIItemStack.transformDamage(myInt);

Parameters:

amount (optional) Type: int

Default Value: 1

Return Type: IIngredientTransformed<IIngredient>

transformReplace(replaceWith as IItemStack) as IIngredientTransformed<IIngredient>
script.zs
// IItemStack.transformReplace(replaceWith as IItemStack) as IIngredientTransformed<IIngredient>;
myIItemStack.transformReplace(myIItemStack);

Parameters:

replaceWith Type: IItemStack

Return Type: IIngredientTransformed<IIngredient>

Getter
Gets the use duration of the ItemStack
script.zs
// IItemStack.useDuration as int
myIItemStack.useDuration

Return Type: int

Getter
Returns true if this stack is considered a crossbow item
script.zs
// IItemStack.useOnRelease as bool
myIItemStack.useOnRelease

Return Type: bool

withAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack
Adds an AttributeModifier to this IItemStack using a specific UUID.
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).
script.zs
// IItemStack.withAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;
myIItemStack.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);

Parameters:

attribute Type: Attribute - The Attribute of the modifier.
uuid Type: string - The unique identifier of the modifier to replace.
name Type: string - The name of the modifier.
value Type: double - The value of the modifier.
operation Type: AttributeOperation - The operation of the modifier.
slotTypes Type: EquipmentSlot[] - What slots the modifier is valid for.
preserveDefaults (optional) Type: bool - Should the default Item Attribute Modifiers be preserved when adding this modifier.

Default Value: false

Return Type: IItemStack

withAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack
Adds an AttributeModifier to this IItemStack using a specific UUID.
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).
script.zs
// IItemStack.withAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;
myIItemStack.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);

Parameters:

attribute Type: Attribute - The Attribute of the modifier.
uuid Type: UUID - The unique identifier of the modifier to replace.
name Type: string - The name of the modifier.
value Type: double - The value of the modifier.
operation Type: AttributeOperation - The operation of the modifier.
slotTypes Type: EquipmentSlot[] - What slots the modifier is valid for.
preserveDefaults (optional) Type: bool - Should the default Item Attribute Modifiers be preserved when adding this modifier.

Default Value: false

Return Type: IItemStack

withAttributeModifier(attribute as Attribute, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack
Adds an AttributeModifier to this 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).
script.zs
// IItemStack.withAttributeModifier(attribute as Attribute, name as string, value as double, operation as Operation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;
myIItemStack.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);

Parameters:

attribute Type: Attribute - The Attribute of the modifier.
name Type: string - The name of the modifier.
value Type: double - The value of the modifier.
operation Type: AttributeOperation - The operation of the modifier.
slotTypes Type: EquipmentSlot[] - What slots the modifier is valid for.
preserveDefaults (optional) Type: bool - Should the default Item Attribute Modifiers be preserved when adding this modifier.

Default Value: false

Return Type: IItemStack

withDamage(damage as int) as IItemStack
Sets the damage of the ItemStack
script.zs
// IItemStack.withDamage(damage as int) as IItemStack;
myIItemStack.withDamage(10);

Parameters:

damage Type: int - the new damage value

Return Type: IItemStack

withDisplayName(name as Component) as IItemStack
Sets the display name of the ItemStack
script.zs
// IItemStack.withDisplayName(name as Component) as IItemStack;
myIItemStack.withDisplayName("totally not dirt");

Parameters:

name Type: Component - New name of the stack.

Return Type: IItemStack

withEnchantment(enchantment as Enchantment, level as int = 1) as IItemStack
Enchants this IItemStack with the given Enchantment.

Returns: This itemStack if it is mutable, a new one with the enchantment added otherwise

script.zs
// IItemStack.withEnchantment(enchantment as Enchantment, level as int = 1) as IItemStack;
myIItemStack.withEnchantment(<enchantment:minecraft:riptide>, 2);

Parameters:

enchantment Type: Enchantment - The enchantment to add.
level (optional) Type: int - The level of the enchantment

Default Value: 1

Return Type: IItemStack

withLore(lore as Component[]) as IItemStack
Sets the lore of the ItemStack
script.zs
// IItemStack.withLore(lore as Component[]) as IItemStack;
myIItemStack.withLore(new crafttweaker.api.text.TextComponent("I am the lore I speak for the trees"););

Parameters:

lore Type: Component[] - the new Lore of the ItemStack.

Return Type: IItemStack

withoutTag() as IItemStack
Removes the tag from this ItemStack.

Returns: This itemStack if it is mutable, a new one with the changed property otherwise

script.zs
// IItemStack.withoutTag() as IItemStack;
myIItemStack.withoutTag();

Return Type: IItemStack

withTag(tag as MapData) as IItemStack
Sets the tag for the ItemStack.

Returns: This itemStack if it is mutable, a new one with the changed property otherwise

script.zs
// IItemStack.withTag(tag as MapData) as IItemStack;
myIItemStack.withTag({Display: {lore: ["Hello"]}});

Parameters:

tag Type: MapData - The tag to set.

Return Type: IItemStack