Table of Contents

Class CraftingRecipeIngredient

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

A crafting recipe ingredient

public class CraftingRecipeIngredient : IRecipeIngredient
Inheritance
CraftingRecipeIngredient
Implements
Derived
Inherited Members
Extension Methods

Fields

AllowedVariants

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

public string[] AllowedVariants

Field Value

string[]

Attributes

What attributes this itemstack must have

[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject Attributes

Field Value

JsonObject

IsTool

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.

public bool IsTool

Field Value

bool

IsWildCard

Whether this recipe contains a wildcard, populated by the engine

public bool IsWildCard

Field Value

bool

Quantity

How much input items are required

public int Quantity

Field Value

int

RecipeAttributes

Optional attribute data that you can attach any data to

[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject RecipeAttributes

Field Value

JsonObject

ResolvedItemstack

The itemstack made from Code, Quantity and Attributes, populated by the engine

public ItemStack ResolvedItemstack

Field Value

ItemStack

ReturnedStack

If set, the crafting recipe will give back the consumed stack to be player upon crafting

public JsonItemStack ReturnedStack

Field Value

JsonItemStack

SkipVariants

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

public string[] SkipVariants

Field Value

string[]

ToolDurabilityCost

If IsTool is set, this is the durability cost

public int ToolDurabilityCost

Field Value

int

Type

Item or Block

public EnumItemClass Type

Field Value

EnumItemClass

Properties

Code

Code of the item or block

public AssetLocation Code { get; set; }

Property Value

AssetLocation

Name

Name of the class, used for filling placeholders in the output stack

public string Name { get; set; }

Property Value

string

Methods

Clone()

public CraftingRecipeIngredient Clone()

Returns

CraftingRecipeIngredient

CloneTo<T>()

public T CloneTo<T>() where T : CraftingRecipeIngredient, new()

Returns

T

Type Parameters

T

FillPlaceHolder(string, string)

Fills in the placeholder ingredients for the crafting recipe.

public void FillPlaceHolder(string key, string value)

Parameters

key string
value string

FromBytes(BinaryReader, IWorldAccessor)

public virtual void FromBytes(BinaryReader reader, IWorldAccessor resolver)

Parameters

reader BinaryReader
resolver IWorldAccessor

Resolve(IWorldAccessor, string)

Turns Type, Code and Attributes into an IItemStack

public bool Resolve(IWorldAccessor resolver, string sourceForErrorLogging)

Parameters

resolver IWorldAccessor
sourceForErrorLogging string

Returns

bool

SatisfiesAsIngredient(ItemStack, bool)

Checks whether or not the input satisfies as an ingredient for the recipe.

public bool SatisfiesAsIngredient(ItemStack inputStack, bool checkStacksize = true)

Parameters

inputStack ItemStack
checkStacksize bool

Returns

bool

ToBytes(BinaryWriter)

public virtual void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.