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
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
How much input items are required
public int Quantity
Field Value
RecipeAttributes
Optional attribute data that you can attach any data to
[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
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
public int ToolDurabilityCost
Field Value
Type
Item or Block
public EnumItemClass Type
Field Value
Properties
Code
Code of the item or block
public AssetLocation Code { get; set; }
Property Value
Name
Name of the class, used for filling placeholders in the output stack
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.