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

ReverseTagsCheck (Optional) (Default: None)

When used with [] tags: matched item should contain at least on tag from the list When used with [[]] tags: matched item should contain at least one tag from each group

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

Field Value

bool?

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: All)

If array of tags specified (["tag-1", "tag-2", "not-tag-3"]):

  • matched item has to have all these tags, and not have tags with 'not-' prefix;
  • if 'ReverseTagsCheck: true' specified, matched item has to have at least one of these tags, or not contain any tag with 'not-' prefix.

    If array of tag groups specified ([["tag-1", "tag-2"], ["not-tag-3", "tag-4]]):
  • matched item has to have all tags (and not have 'not-' tags) from at least of tag groups;
  • if 'ReverseTagsCheck: true' specified, matched item has to have at least one of these tags, or not contain any tag with 'not-' prefix from each tag group.

    This tags check can be treated as logic expression where each tag means of matched item having this tag:
  • [["tag-1", "tag-2"], ["not-tag-3", "tag-4]] == (tag-1 AND tag-2) OR (NOT tag-3 AND tag-4)
  • if 'ReverseTagsCheck: true' specified: [["tag-1", "tag-2"], ["not-tag-3", "tag-4]] == (tag-1 OR tag-2) AND (NOT tag-3 OR tag-4)
[DocumentAsJson("Optional", "All", false)]
public GeneralTagGroups? Tags { get; set; }

Field Value

GeneralTagGroups

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