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 . IItemStack;
IItemStack
implements the following interfaces:
IIngredient
,IIngredientWithAmount
,CommandStringDisplayable
Does the ingredient contain the given ingredient? // ((ingredient as IIngredient) in IItemStack) as bool
myIIngredient in myIItemStack
Return Type:
bool
Use this in contexts where machines accept more than one item to state that fact. // (IItemStack * (amount as int)) as IIngredientWithAmount
Return Type:
IIngredientWithAmount
// (IItemStack | (other as IIngredient)) as IIngredientList
myIItemStack | myIIngredient
Return Type:
IIngredientList
// (IItemStack % (percentage as double)) as Percentaged<IItemStack>
Parameters:
percentage: double
Type: double
Return Type:
Percentaged <IItemStack >
Sets the amount of the ItemStack // (IItemStack * (amount as int)) as IItemStack
Parameters:
amount: int
Type: int
- new amount
Return Type:
IItemStack
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 // 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:
name: string
Type: string
- The name of the modifier.
value: double
Type: double
- The value of the modifier.
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 // 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:
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.
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 // 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:
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.
// IItemStack.addShiftTooltip(content as Component, showMessage as Component = null);
myIItemStack . addShiftTooltip(myComponent, myComponent);
// IItemStack.addTooltip(content as Component);
myIItemStack . addTooltip(myComponent);
Gets the amount of Items in the ItemStack // IItemStack.amount as int
Return Type:
int
// IItemStack.asIIngredientWithAmount() as IIngredientWithAmount;
myIItemStack . asIIngredientWithAmount();
Return Type:
IIngredientWithAmount
// IItemStack as IIngredientWithAmount
myIItemStack as IIngredientWithAmount
Return Type:
IIngredientWithAmount
// IItemStack.asImmutable() as IItemStack;
myIItemStack . asImmutable();
Return Type:
IItemStack
// IItemStack.asItemLike() as ItemLike;
myIItemStack . asItemLike();
Return Type:
ItemLike
// IItemStack as ItemLike
Return Type:
ItemLike
// IItemStack.asMutable() as IItemStack;
myIItemStack . asMutable();
Return Type:
IItemStack
// IItemStack as Percentaged<IItemStack>
myIItemStack as Percentaged < IItemStack>
Return Type:
Percentaged <IItemStack >
// IItemStack.BASE_ATTACK_DAMAGE_UUID as UUID
IItemStack . BASE_ATTACK_DAMAGE_UUID
Return Type:
UUID
// IItemStack.BASE_ATTACK_SPEED_UUID as UUID
IItemStack . BASE_ATTACK_SPEED_UUID
Return Type:
UUID
Gets the base repair cost of the ItemStack, or 0 if no repair is defined. // IItemStack.baseRepairCost as int
myIItemStack . baseRepairCost
Return Type:
int
// IItemStack.burnTime as int
Return Type:
int
Sets the burn time of this ingredient, for use in the furnace and other machines // IItemStack.burnTime = (time as int);
myIItemStack . burnTime = myInt;
Parameters:
time: int
Type: int
- the new burn time
Sets the burn time of this ingredient, for use in the furnace and other machines // IItemStack.burnTime(time as int);
myIItemStack . burnTime( 500 );
Parameters:
time: int
Type: int
- the new burn time
// IItemStack.clearTooltip(leaveName as bool = false);
myIItemStack . clearTooltip(myBool);
Parameters:
leaveName: bool
(optional) Type: bool
Default Value: false
Does the ingredient contain the given ingredient? // IItemStack.contains(ingredient as IIngredient) as bool;
myIItemStack . contains(( < item : minecraft:iron_ingot > | < item : minecraft:gold_ingot > ));
Return Type:
bool
Creates a copy // IItemStack.copy() as IItemStack;
Return Type:
IItemStack
// IItemStack.CRAFTTWEAKER_DATA_KEY as string
IItemStack . CRAFTTWEAKER_DATA_KEY
Return Type:
string
// IItemStack.damage as int
Return Type:
int
Returns if the ItemStack is damageable I.E Swords and tools are damageable, sticks are not. // IItemStack.damageableItem as bool
myIItemStack . damageableItem
Return Type:
bool
Returns if the ItemStack is damaged I.E a Swords that is no at full durability is damaged. // IItemStack.damaged as bool
Return Type:
bool
// IItemStack.definition() as Item;
myIItemStack . definition();
Return Type:
ItemDefinition
Returns the unlocalized Name of the Item in the ItemStack // IItemStack.descriptionId as string
myIItemStack . descriptionId
Return Type:
string
Gets the display name of the ItemStack // IItemStack.displayName as Component
Return Type:
Component
// IItemStack.enchantments as Integer[Enchantment]
myIItemStack . enchantments
Return Type:
Integer [Enchantment ]
Sets the enchantments on this IItemStack. // IItemStack.enchantments = (enchantments as Integer[Enchantment]);
myIItemStack . enchantments = myMap;
// IItemStack.enchantments() as Integer[Enchantment];
myIItemStack . enchantments();
Return Type:
Integer [Enchantment ]
Sets the enchantments on this IItemStack. Returns : This itemStack if it is mutable, a new one with the enchantments otherwise
// IItemStack.enchantments(enchantments as Integer[Enchantment]) as IItemStack;
myIItemStack . enchantments(myMap);
Return Type:
IItemStack
Checks if this IItemStack burns when thrown into fire / lava or damaged by fire. // IItemStack.fireResistant as bool
myIItemStack . fireResistant
Return Type:
bool
Sets if this IItemStack is immune to fire / lava. If true, the item will not burn when thrown into fire or lava. // IItemStack.fireResistant = (fireResistant as bool);
myIItemStack . fireResistant = myBool;
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire.
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.
// IItemStack.fireResistant() as bool;
myIItemStack . fireResistant();
Return Type:
bool
Sets if this IItemStack is immune to fire / lava. If true, the item will not burn when thrown into fire or lava. // IItemStack.fireResistant(fireResistant as bool);
myIItemStack . fireResistant(myBool);
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire.
// IItemStack.food = (food as FoodProperties);
myIItemStack . food = myFoodProperties;
// IItemStack.food(food as FoodProperties);
myIItemStack . food(myFoodProperties);
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.
// IItemStack.getAttributes(slotType as EquipmentSlot) as List<AttributeModifier>[Attribute];
myIItemStack . getAttributes( < constant : minecraft:equipmentslot:chest > );
Return Type:
List <AttributeModifier > [Attribute ]
Gets the level of the given enchantment on the item. Returns 0 if the item doesn't have the given enchantment. // IItemStack.getEnchantmentLevel(enchantment as Enchantment) as int;
myIItemStack . getEnchantmentLevel(myEnchantment);
Return Type:
int
// IItemStack.getImmutableInternal() as ItemStack;
myIItemStack . getImmutableInternal();
Return Type:
ItemStack
Gets the internal ItemStack
for this IItemStack. Returns : internal ItemStack
// IItemStack.getInternal() as ItemStack;
myIItemStack . getInternal();
Return Type:
ItemStack
Gets the internal ItemStack
for this IItemStack. // IItemStack as ItemStack
myIItemStack as ItemStack
Return Type:
ItemStack
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.
// IItemStack.getOrCreateTag() as IData;
myIItemStack . getOrCreateTag();
Return Type:
IData
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. // IItemStack.getRemainingItem(stack as IItemStack) as IItemStack;
myIItemStack . getRemainingItem( < item : minecraft:iron_ingot > );
Return Type:
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.
// IItemStack.grow(amount as int = 1) as IItemStack;
Parameters:
amount: int
(optional) Type: int
- The amount to grow by.
Default Value: 1
Return Type:
IItemStack
Returns true if the ItemStack has a display name. // IItemStack.hasCustomHoverName as bool
myIItemStack . hasCustomHoverName
Return Type:
bool
Returns true if this ItemStack has a foil effect. Foil is the glint / effect that is added to enchanted ItemStacks (and other items). // IItemStack.hasFoil as bool
Return Type:
bool
Returns true if this ItemStack has a Tag // IItemStack.hasTag as bool
Return Type:
bool
Gets the hover name of the ItemStack. This will give the raw name without the formatting that 'displayName' applies.
// IItemStack.hoverName as Component
Return Type:
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.
// IItemStack.hoverName() as Component;
myIItemStack . hoverName();
Return Type:
Component
// IItemStack.isEdible as bool
Return Type:
bool
// IItemStack.isEdible() as bool;
Return Type:
bool
Can this ItemStack be enchanted? // IItemStack.isEnchantable as bool
myIItemStack . isEnchantable
Return Type:
bool
Is this ItemStack enchanted? // IItemStack.isEnchanted as bool
Return Type:
bool
// IItemStack.isImmutable as bool
Return Type:
bool
// IItemStack.isImmutable() as bool;
myIItemStack . isImmutable();
Return Type:
bool
// IItemStack.isMutable as bool
Return Type:
bool
// IItemStack.isMutable() as bool;
myIItemStack . isMutable();
Return Type:
bool
// IItemStack.items as IItemStack[]
Return Type:
IItemStack []
Does the given stack match the ingredient? // IItemStack.matches(stack as IItemStack) as bool;
myIItemStack . matches( < item : minecraft:iron_ingot > );
Return Type:
bool
Returns the max damage of the ItemStack This is the max durability of the ItemStack. // IItemStack.maxDamage as int
Return Type:
int
Sets the max damage of the ItemStack. Setting the damage to 0
will make the item unbreakable. // IItemStack.maxDamage = (newMaxDamage as int);
myIItemStack . maxDamage = myInt;
Parameters:
newMaxDamage: int
Type: int
- The new max damage of the ItemStack
Returns the max stack size of the Item in the ItemStack // IItemStack.maxStackSize as int
myIItemStack . maxStackSize
Return Type:
int
Sets the max stacksize of the Item. // IItemStack.maxStackSize = (newMaxStackSize as int);
myIItemStack . maxStackSize = myInt;
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item.
Returns the max stack size of the Item in the ItemStack Returns : Max stack size of the Item.
// IItemStack.maxStackSize() as int;
myIItemStack . maxStackSize();
Return Type:
int
Sets the max stacksize of the Item. // IItemStack.maxStackSize(newMaxStackSize as int);
myIItemStack . maxStackSize( 16 );
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item.
// IItemStack.modifyShiftTooltip(shiftedFunction as ITooltipFunction, unshiftedFunction as ITooltipFunction = null);
myIItemStack . modifyShiftTooltip(myITooltipFunction, myITooltipFunction);
// IItemStack.modifyTooltip(function as ITooltipFunction);
myIItemStack . modifyTooltip(myITooltipFunction);
Use this in contexts where machines accept more than one item to state that fact. // IItemStack.mul(amount as int) as IIngredientWithAmount;
Return Type:
IIngredientWithAmount
Use this if you already have the condition from another ingredient // IItemStack.only(condition as IIngredientCondition<IIngredient>) as IIngredientConditioned<IIngredient>;
myIItemStack . only(myIIngredientCondition);
Return Type:
IngredientConditioned <IIngredient >
// IItemStack.onlyDamagedAtLeast(minDamage as int) as IIngredientConditioned<IIngredient>;
myIItemStack . onlyDamagedAtLeast(myInt);
Return Type:
IngredientConditioned <IIngredient >
// IItemStack.onlyDamagedAtMost(maxDamage as int) as IIngredientConditioned<IIngredient>;
myIItemStack . onlyDamagedAtMost(myInt);
Return Type:
IngredientConditioned <IIngredient >
// IItemStack.onlyIf(uid as string, function as function(t as IItemStack) as bool = null) as IIngredientConditioned<IIngredient>;
myIItemStack . 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 >
Gets owning mod for the Item in this IItemStack // IItemStack.owner as string
Return Type:
string
// IItemStack.percent(percentage as double) as Percentaged<IItemStack>;
myIItemStack . percent(myDouble);
Parameters:
percentage: double
Type: double
Return Type:
Percentaged <IItemStack >
Returns the rarity of the Item in the ItemStack // IItemStack.rarity as Rarity
Return Type:
Rarity
Sets the rarity of the Item. // IItemStack.rarity = (newRarity as Rarity);
myIItemStack . rarity = myRarity;
Parameters:
newRarity: Rarity
Type: Rarity
- The new rarity of the Item. Returns the rarity of the Item in the ItemStack Returns : Rarity of the Item.
// IItemStack.rarity() as Rarity;
Return Type:
Rarity
Sets the rarity of the Item. // IItemStack.rarity(newRarity as Rarity);
myIItemStack . rarity( Rarity . UNCOMMON);
Parameters:
newRarity: Rarity
Type: Rarity
- The new rarity of the Item. Gets the registry name for the Item in this IItemStack // IItemStack.registryName as ResourceLocation
myIItemStack . registryName
Return Type:
ResourceLocation
Removes the given enchantment from this IItemStack. Returns : This itemStack if it is mutable, a new one with the enchantment removed otherwise
// IItemStack.removeEnchantment(enchantment as Enchantment) as IItemStack;
myIItemStack . removeEnchantment( < enchantment : minecraft:riptide > );
Return Type:
IItemStack
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. // IItemStack.removeGlobalAttribute(attribute as Attribute, slotTypes as EquipmentSlot[]);
myIItemStack . removeGlobalAttribute( < attribute : minecraft:generic.attack_damage > , [ < constant : minecraft:equipmentslot:chest > ]);
Removes all AttributeModifiers who's ID is the same as the given uuid from this IIngredient. // IItemStack.removeGlobalAttributeModifier(uuid as string, slotTypes as EquipmentSlot[]);
myIItemStack . removeGlobalAttributeModifier( "8c1b5535-9f79-448b-87ae-52d81480aaa3" , [ < constant : minecraft:equipmentslot:chest > ]);
Parameters:
uuid: string
Type: string
- The unique id of the AttributeModifier to remove.
Removes all AttributeModifiers who's ID is the same as the given uuid from this IIngredient. // IItemStack.removeGlobalAttributeModifier(uuid as UUID, slotTypes as EquipmentSlot[]);
myIItemStack . removeGlobalAttributeModifier( IItemStack . BASE_ATTACK_DAMAGE_UUID, [ < constant : minecraft:equipmentslot:chest > ]);
Parameters:
uuid: UUID
Type: UUID
- The unique id of the AttributeModifier to remove.
// IItemStack.removeTooltip(regex as string);
myIItemStack . removeTooltip(myString);
Parameters:
regex: string
Type: string
Clears any custom name set for this ItemStack // IItemStack.resetHoverName();
myIItemStack . resetHoverName();
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.
// IItemStack.shrink(amount as int = 1) as IItemStack;
Parameters:
amount: int
(optional) Type: int
- The amount to shrink by.
Default Value: 1
Return Type:
IItemStack
Returns if the ItemStack can have an amount greater than 1 I.E Swords and tools are not stackable, sticks are. // IItemStack.stackable as bool
Return Type:
bool
Returns the NBT tag attached to this ItemStack. // IItemStack.tag as IData
Return Type:
IData
Use this if you already have the transformer from another ingredient // IItemStack.transform(transformer as IIngredientTransformer<IIngredient>) as IIngredientTransformed<IIngredient>;
myIItemStack . transform(myIIngredientTransformer);
Return Type:
IIngredientTransformed <IIngredient >
// IItemStack.transformCustom(uid as string, function as function(r as IItemStack) as IItemStack = null) as IIngredientTransformed<IIngredient>;
myIItemStack . transformCustom(myString, myFunction);
Return Type:
IIngredientTransformed <IIngredient >
// IItemStack.transformDamage(amount as int = 1) as IIngredientTransformed<IIngredient>;
myIItemStack . transformDamage(myInt);
Parameters:
amount: int
(optional) Type: int
Default Value: 1
Return Type:
IIngredientTransformed <IIngredient >
// IItemStack.transformReplace(replaceWith as IItemStack) as IIngredientTransformed<IIngredient>;
myIItemStack . transformReplace(myIItemStack);
Return Type:
IIngredientTransformed <IIngredient >
Gets the use duration of the ItemStack // IItemStack.useDuration as int
Return Type:
int
Returns true if this stack is considered a crossbow item // IItemStack.useOnRelease as bool
myIItemStack . useOnRelease
Return Type:
bool
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). // 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:
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
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). // 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:
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
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). // 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:
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
Sets the damage of the ItemStack // IItemStack.withDamage(damage as int) as IItemStack;
myIItemStack . withDamage( 10 );
Parameters:
damage: int
Type: int
- the new damage value
Return Type:
IItemStack
Sets the display name of the ItemStack // IItemStack.withDisplayName(name as Component) as IItemStack;
myIItemStack . withDisplayName( "totally not dirt" );
Return Type:
IItemStack
Enchants this IItemStack with the given Enchantment. Returns : This itemStack if it is mutable, a new one with the enchantment added otherwise
// IItemStack.withEnchantment(enchantment as Enchantment, level as int = 1) as IItemStack;
myIItemStack . withEnchantment( < enchantment : minecraft:riptide > , 2 );
Parameters:
level: int
(optional) Type: int
- The level of the enchantment
Default Value: 1
Return Type:
IItemStack
Sets the lore of the ItemStack // IItemStack.withLore(lore as Component[]) as IItemStack;
myIItemStack . withLore( new crafttweaker . api.text . TextComponent( "I am the lore I speak for the trees" ););
Return Type:
IItemStack
Removes the tag from this ItemStack. Returns : This itemStack if it is mutable, a new one with the changed property otherwise
// IItemStack.withoutTag() as IItemStack;
myIItemStack . withoutTag();
Return Type:
IItemStack
Sets the tag for the ItemStack. Returns : This itemStack if it is mutable, a new one with the changed property otherwise
// IItemStack.withTag(tag as MapData) as IItemStack;
myIItemStack . withTag({Display: {lore: [ "Hello" ]}});
Return Type:
IItemStack