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 to be a valid ingredient
[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject Attributes
Field Value
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
IsWildCard
Whether this recipe contains a wildcard, populated by the engine
public bool IsWildCard
Field Value
Quantity
The quantity of the itemstack required for the recipe.
public int Quantity
Field Value
RecipeAttributes
Optional attribute data that you can attach any data to. Used for some specific instances in code mods.
[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject RecipeAttributes
Field Value
ResolvedItemstack
The itemstack made from Code, Quantity and Attributes, populated by the engine
public ItemStack ResolvedItemstack
Field Value
ReturnedStack
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.
public JsonItemStack ReturnedStack
Field Value
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 when the recipe is created.
public int ToolDurabilityCost
Field Value
Type
Is the itemstack an item or a block?
public EnumItemClass Type
Field Value
Properties
Code
The code of the item or block
public AssetLocation Code { get; set; }
Property Value
Name
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.
public string Name { get; set; }
Property Value
Methods
Clone()
public CraftingRecipeIngredient Clone()
Returns
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
FromBytes(BinaryReader, IWorldAccessor)
public virtual void FromBytes(BinaryReader reader, IWorldAccessor resolver)
Parameters
reader
BinaryReaderresolver
IWorldAccessor
Resolve(IWorldAccessor, string)
Turns Type, Code and Attributes into an IItemStack
public bool Resolve(IWorldAccessor resolver, string sourceForErrorLogging)
Parameters
resolver
IWorldAccessorsourceForErrorLogging
string
Returns
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
Returns
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.