Table of Contents

Class CraftingRecipeIngredient

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

A crafting recipe ingredient Open in GitHub

[DocumentAsJson]
public class CraftingRecipeIngredient
Inheritance
CraftingRecipeIngredient
Derived

Fields

Name (Required)

Attaches a name to a wildcard in an ingredient. This is used to substitute the value into the output. Only required if using a wildcard.

[DocumentAsJson("Required", "", false)]
public string? Name { get; set; }

Field Value

string

Quantity (Recommended) (Default: 1)

The quantity of the itemstack required for the recipe. Alias of StackSize.

[DocumentAsJson("Recommended", "1", false)]
public int Quantity { get; set; }

Field Value

int

Type (Recommended) (Default: Block)

Is the itemstack an item or a block?

[DocumentAsJson("Recommended", "Block", false)]
public EnumItemClass Type { get; set; }

Field Value

EnumItemClass

AllowedVariants (Optional) (Default: Allow All)

When using a wildcard in the item/block code, setting this field will limit the allowed variants

[DocumentAsJson("Optional", "Allow All", false)]
public string[]? AllowedVariants { get; set; }

Field Value

string[]

Attributes (Optional) (Default: None)

What attributes this itemstack must have to be a valid ingredient

[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
[DocumentAsJson("Optional", "None", false)]
public JsonObject? Attributes { get; set; }

Field Value

JsonObject

Break (Optional) (Default: True)

Determines if and item will be destroyed when reaching zero durability.

[DocumentAsJson("Optional", "True", false)]
public bool Break { get; set; }

Field Value

bool

Code (Optional) (Default: All)

The code of the item or block.

[DocumentAsJson("Optional", "All", false)]
public AssetLocation? Code { get; set; }

Field Value

AssetLocation

Consume (Optional) (Default: True)

Defines if recipe ingredient should be consumed on crafting.
Is equal to 'not IsTool'. Use this property instead of 'IsTool'.

[DocumentAsJson("Optional", "True", false)]
public bool Consume { get; set; }

Field Value

bool

DurabilityChange (Optional) (Default: -1)

Defines how item durability will be changed. Durability will be capped at maximum item durability, and wont reduce below 0, unless specific item class changes this behavior.

[DocumentAsJson("Optional", "-1", false)]
public int DurabilityChange { get; set; }

Field Value

int

Id (Optional) (Default: None)

Is used to reference recipe ingredient in the recipe, for example to specify where to copy attributes from.
If not specified will be set to the index of this ingredient in the array (starting from 1), or key of this ingredient in the object.

[DocumentAsJson("Optional", "None", false)]
public string Id { get; set; }

Field Value

string

IsTool (Optional) (Default: False)

Whether this crafting recipe ingredient should be regarded as a tool required to build this item. If true, the recipe will not consume the item but reduce its durability.

[DocumentAsJson("Optional", "False", false)]
public bool IsTool { get; set; }

Field Value

bool

RecipeAttributes (Optional) (Default: None)

Optional attribute data that you can attach any data to. Used for some specific instances in code mods.

[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
[DocumentAsJson("Optional", "None", false)]
public JsonObject? RecipeAttributes { get; set; }

Field Value

JsonObject

ReturnedStack (Optional) (Default: None)

If set, the crafting recipe will give back the consumed stack to be player upon crafting. Can also be used to produce multiple outputs for a recipe.

[DocumentAsJson("Optional", "None", false)]
public JsonItemStack? ReturnedStack { get; set; }

Field Value

JsonItemStack

SkipVariants (Optional) (Default: Skip None)

When using a wildcard in the item/block code, setting this field will skip these variants

[DocumentAsJson("Optional", "Skip None", false)]
public string[]? SkipVariants { get; set; }

Field Value

string[]

StackSize (Optional) (Default: 1)

Amount of items in this stacks

[ProtoMember(3)]
[DocumentAsJson("Optional", "1", false)]
public int StackSize { get; set; }

Field Value

int

Tags (Optional) (Default: None)

[DocumentAsJson("Optional", "None", false)]
public ComplexTagCondition<TagSet> Tags { get; set; }

Field Value

ComplexTagCondition<TagSet>

ToolDurabilityCost (Optional) (Default: 1)

If Consume is set to False, this is the durability cost when the recipe is created.

[DocumentAsJson("Optional", "1", false)]
public int ToolDurabilityCost { get; set; }

Field Value

int