IngredientConditioned<T : IIngredient>
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.ingredient.type.IngredientConditioned;Implemented Interfaces
IngredientConditioned implements the following interfaces. That means all methods defined in these interfaces are also available in IngredientConditioned
Casters
| Result Type | Is Implicit | 
|---|---|
| Result TypeIData | Is Implicittrue | 
| Result TypeIIngredientWithAmount | Is Implicittrue | 
| Result TypeMapData | Is Implicittrue | 
Methods
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
// IngredientConditioned.addGlobalAttributeModifier(attribute as Attribute, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[])
myIngredientConditioned.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);| Parameter | Type | Description | 
|---|---|---|
| Parameterattribute | TypeAttribute | DescriptionThe Attribute of the modifier. | 
| Parametername | Typestring | DescriptionThe name of the modifier. | 
| Parametervalue | Typedouble | DescriptionThe value of the modifier. | 
| Parameteroperation | TypeAttributeOperation | DescriptionThe operation of the modifier. | 
| ParameterslotTypes | TypeEquipmentSlot[] | DescriptionWhat slots the modifier is valid for. | 
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
// IngredientConditioned.addGlobalAttributeModifier(attribute as Attribute, uuid as invalid, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[])
myIngredientConditioned.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, IItemStack.BASE_ATTACK_DAMAGE_UUID, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);| Parameter | Type | Description | 
|---|---|---|
| Parameterattribute | TypeAttribute | DescriptionThe Attribute of the modifier. | 
| Parameteruuid | Typeinvalid | DescriptionThe unique identifier of the modifier to replace. | 
| Parametername | Typestring | DescriptionThe name of the modifier. | 
| Parametervalue | Typedouble | DescriptionThe value of the modifier. | 
| Parameteroperation | TypeAttributeOperation | DescriptionThe operation of the modifier. | 
| ParameterslotTypes | TypeEquipmentSlot[] | DescriptionWhat slots the modifier is valid for. | 
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
// IngredientConditioned.addGlobalAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[])
myIngredientConditioned.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);| Parameter | Type | Description | 
|---|---|---|
| Parameterattribute | TypeAttribute | DescriptionThe Attribute of the modifier. | 
| Parameteruuid | Typestring | DescriptionThe unique identifier of the modifier to replace. | 
| Parametername | Typestring | DescriptionThe name of the modifier. | 
| Parametervalue | Typedouble | DescriptionThe value of the modifier. | 
| Parameteroperation | TypeAttributeOperation | DescriptionThe operation of the modifier. | 
| ParameterslotTypes | TypeEquipmentSlot[] | DescriptionWhat slots the modifier is valid for. | 
IngredientConditioned.addTooltip(content as Component)| Parameter | Type | 
|---|---|
| Parametercontent | TypeComponent | 
Return Type: IngredientConditioned<IIngredient>
// IngredientConditioned.anyDamage() as IngredientConditioned<IIngredient>
myIngredientConditioned.anyDamage();Used implicitly when a machine can accept more than one item but you only provide one.
Return Type: IIngredientWithAmount
// IngredientConditioned.asIIngredientWithAmount() as IIngredientWithAmount
myIngredientConditioned.asIIngredientWithAmount();IngredientConditioned.clearTooltip(leaveName as boolean)| Parameter | Type | Optional | Default Value | 
|---|---|---|---|
| ParameterleaveName | Typeboolean | Optionaltrue | Default Valuefalse | 
Does the ingredient contain the given ingredient?
Return Type: boolean
// IngredientConditioned.contains(ingredient as IIngredient) as boolean
myIngredientConditioned.contains((<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>));| Parameter | Type | Description | 
|---|---|---|
| Parameteringredient | TypeIIngredient | DescriptionThe ingredient to check | 
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
// IngredientConditioned.getRemainingItem(stack as IItemStack) as IItemStack
myIngredientConditioned.getRemainingItem(<item:minecraft:iron_ingot>);| Parameter | Type | Description | 
|---|---|---|
| Parameterstack | TypeIItemStack | DescriptionThe stack to provide for this ingredient. | 
Checks if this ingredient is empty.
Returns: true if empty, false otherwise
Return Type: boolean
// IngredientConditioned.isEmpty() as boolean
myIngredientConditioned.isEmpty();Does the given stack match the ingredient?
Return Type: boolean
// IngredientConditioned.matches(stack as IItemStack) as boolean
myIngredientConditioned.matches(<item:minecraft:iron_ingot>);| Parameter | Type | Description | 
|---|---|---|
| Parameterstack | TypeIItemStack | DescriptionThe stack to check | 
Return Type: boolean
IngredientConditioned.matches(stack as IItemStack, ignoreDamage as boolean) as boolean| Parameter | Type | 
|---|---|
| Parameterstack | TypeIItemStack | 
| ParameterignoreDamage | Typeboolean | 
IngredientConditioned.modifyShiftTooltip(shiftedFunction as ITooltipFunction, unshiftedFunction as ITooltipFunction)| Parameter | Type | Optional | 
|---|---|---|
| ParametershiftedFunction | TypeITooltipFunction | Optionalfalse | 
| ParameterunshiftedFunction | TypeITooltipFunction | Optionaltrue | 
IngredientConditioned.modifyTooltip(function as ITooltipFunction)| Parameter | Type | 
|---|---|
| Parameterfunction | TypeITooltipFunction | 
Use this in contexts where machines accept more than one item to state that fact.
Return Type: IIngredientWithAmount
IngredientConditioned.mul(amount as int) as IIngredientWithAmount| Parameter | Type | 
|---|---|
| Parameteramount | Typeint | 
Use this if you already have the condition from another ingredient
Return Type: IngredientConditioned<IIngredient>
IngredientConditioned.only(condition as IIngredientCondition<IIngredient>) as IngredientConditioned<IIngredient>| Parameter | Type | 
|---|---|
| Parametercondition | TypeIIngredientCondition<IIngredient> | 
Return Type: IngredientConditioned<IIngredient>
// IngredientConditioned.onlyDamaged() as IngredientConditioned<IIngredient>
myIngredientConditioned.onlyDamaged();Return Type: IngredientConditioned<IIngredient>
IngredientConditioned.onlyDamagedAtLeast(minDamage as int) as IngredientConditioned<IIngredient>| Parameter | Type | 
|---|---|
| ParameterminDamage | Typeint | 
Return Type: IngredientConditioned<IIngredient>
IngredientConditioned.onlyDamagedAtMost(maxDamage as int) as IngredientConditioned<IIngredient>| Parameter | Type | 
|---|---|
| ParametermaxDamage | Typeint | 
Return Type: IngredientConditioned<IIngredient>
IngredientConditioned.onlyIf(uid as string, function as Predicate<IItemStack>) as IngredientConditioned<IIngredient>| Parameter | Type | Optional | 
|---|---|---|
| Parameteruid | Typestring | Optionalfalse | 
| Parameterfunction | TypePredicate<IItemStack> | Optionaltrue | 
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.
// IngredientConditioned.removeGlobalAttribute(attribute as Attribute, slotTypes as EquipmentSlot[])
myIngredientConditioned.removeGlobalAttribute(<attribute:minecraft:generic.attack_damage>, [<constant:minecraft:equipmentslot:chest>]);| Parameter | Type | Description | 
|---|---|---|
| Parameterattribute | TypeAttribute | DescriptionThe attribute to remove. | 
| ParameterslotTypes | TypeEquipmentSlot[] | DescriptionThe slot types to remove it from. | 
Removes all AttributeModifiers who’s ID is the same as the given uuid from this IIngredient.
// IngredientConditioned.removeGlobalAttributeModifier(uuid as invalid, slotTypes as EquipmentSlot[])
myIngredientConditioned.removeGlobalAttributeModifier(IItemStack.BASE_ATTACK_DAMAGE_UUID, [<constant:minecraft:equipmentslot:chest>]);| Parameter | Type | Description | 
|---|---|---|
| Parameteruuid | Typeinvalid | DescriptionThe unique id of the AttributeModifier to remove. | 
| ParameterslotTypes | TypeEquipmentSlot[] | DescriptionThe slot types to remove it from. | 
Removes all AttributeModifiers who’s ID is the same as the given uuid from this IIngredient.
// IngredientConditioned.removeGlobalAttributeModifier(uuid as string, slotTypes as EquipmentSlot[])
myIngredientConditioned.removeGlobalAttributeModifier("8c1b5535-9f79-448b-87ae-52d81480aaa3", [<constant:minecraft:equipmentslot:chest>]);| Parameter | Type | Description | 
|---|---|---|
| Parameteruuid | Typestring | DescriptionThe unique id of the AttributeModifier to remove. | 
| ParameterslotTypes | TypeEquipmentSlot[] | DescriptionThe slot types to remove it from. | 
IngredientConditioned.removeTooltip(regex as string)| Parameter | Type | 
|---|---|
| Parameterregex | Typestring | 
Return Type: IIngredientTransformed<IIngredient>
// IngredientConditioned.reuse() as IIngredientTransformed<IIngredient>
myIngredientConditioned.reuse();Sets the burn time of this ingredient, for use in the furnace and other machines
// IngredientConditioned.setBurnTime(time as int)
myIngredientConditioned.setBurnTime(500);| Parameter | Type | Description | 
|---|---|---|
| Parametertime | Typeint | Descriptionthe new burn time | 
Use this if you already have the transformer from another ingredient
Return Type: IIngredientTransformed<IIngredient>
IngredientConditioned.transform(transformer as IIngredientTransformer<IIngredient>) as IIngredientTransformed<IIngredient>| Parameter | Type | 
|---|---|
| Parametertransformer | TypeIIngredientTransformer<IIngredient> | 
Return Type: IIngredientTransformed<IIngredient>
IngredientConditioned.transformCustom(uid as string, function as Function<IItemStack,IItemStack>) as IIngredientTransformed<IIngredient>| Parameter | Type | Optional | 
|---|---|---|
| Parameteruid | Typestring | Optionalfalse | 
| Parameterfunction | TypeFunction<IItemStack,IItemStack> | Optionaltrue | 
Return Type: IIngredientTransformed<IIngredient>
IngredientConditioned.transformDamage(amount as int) as IIngredientTransformed<IIngredient>| Parameter | Type | Optional | Default Value | 
|---|---|---|---|
| Parameteramount | Typeint | Optionaltrue | Default Value1 | 
Return Type: IIngredientTransformed<IIngredient>
IngredientConditioned.transformReplace(replaceWith as IItemStack) as IIngredientTransformed<IIngredient>| Parameter | Type | 
|---|---|
| ParameterreplaceWith | TypeIItemStack | 
Operators
Does the ingredient contain the given ingredient?
ingredient as IIngredient in myIngredientConditioned(<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>) in myIngredientConditionedUse this in contexts where machines accept more than one item to state that fact.
myIngredientConditioned * amount as intmyIngredientConditioned | other as IIngredientProperties
| Name | Type | Has Getter | Has Setter | Description | 
|---|---|---|---|---|
| NamebaseIngredient | TypeT | Has Gettertrue | Has Setterfalse | Description | 
| NameburnTime | Typevoid | Has Getterfalse | Has Settertrue | DescriptionSets the burn time of this ingredient, for use in the furnace and other machines | 
| Namecondition | TypeIIngredientCondition<T> | Has Gettertrue | Has Setterfalse | Description | 
| Nameempty | Typeboolean | Has Gettertrue | Has Setterfalse | DescriptionChecks if this ingredient is empty. | 
| Nameitems | TypeIItemStack[] | Has Gettertrue | Has Setterfalse | Description |