Table of Contents

Class LayeredVoxelRecipe

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Creates a recipe using a 3D voxel-based system. Used for recipes types such as clayforming, smithing, or stone-knapping. Open in GitHub

[DocumentAsJson]
public abstract class LayeredVoxelRecipe : RecipeBase, IRecipeBase, IByteSerializable, IConcreteCloneable<RecipeBase>, ICloneable
Inheritance
LayeredVoxelRecipe
Implements
Inherited Members
Extension Methods

Constructors

LayeredVoxelRecipe()

protected LayeredVoxelRecipe()

Fields

Ingredients

An array of ingredients for this recipe. If only using a single ingredient, see Ingredient.
Required if not using Ingredient.

[DocumentAsJson("Required", "", false)]
public CraftingRecipeIngredient[] Ingredients

Field Value

CraftingRecipeIngredient[]

Output

The final output of this recipe.

[DocumentAsJson("Required", "", false)]
public JsonItemStack Output

Field Value

JsonItemStack

Pattern

A 2D array of strings that are layered together to form the recipe. Use "#" for solid, and "_" or " " for a gap.

[DocumentAsJson("Required", "", false)]
public string[][] Pattern

Field Value

string[][]

Voxels

An array of voxels, created from Pattern during loading. This array is cloned when a player starts creating the recipe.

public bool[,,] Voxels

Field Value

bool[,,]

Properties

Ingredient

A single ingredient for this recipe. If you need to use more than one ingredient, see Ingredients.
Required if not using Ingredients.

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

Property Value

CraftingRecipeIngredient

QuantityLayers

The number of layers in this recipe, in the Y-axis.

public abstract int QuantityLayers { get; }

Property Value

int

RecipeCategoryCode

A category code for this recipe type. Used for error logging.

public abstract string RecipeCategoryCode { get; }

Property Value

string

RecipeIngredients

public override IEnumerable<IRecipeIngredient> RecipeIngredients { get; }

Property Value

IEnumerable<IRecipeIngredient>

RecipeOutput

public override IRecipeOutput RecipeOutput { get; }

Property Value

IRecipeOutput

RotateRecipe

If true, the recipe is rotated 90 degrees in the Y axis.

protected virtual bool RotateRecipe { get; set; }

Property Value

bool

Methods

CloneTo(object)

protected override void CloneTo(object recipe)

Parameters

recipe object

FromBytes(BinaryReader, IWorldAccessor)

Deserializes the alloy

public override void FromBytes(BinaryReader reader, IWorldAccessor resolver)

Parameters

reader BinaryReader
resolver IWorldAccessor

GenVoxels()

Generates the voxels for the recipe.

public void GenVoxels()

OnParsed(IWorldAccessor)

public override void OnParsed(IWorldAccessor world)

Parameters

world IWorldAccessor

Resolve(IWorldAccessor, string)

Resolves the recipe.

public override bool Resolve(IWorldAccessor world, string sourceForErrorLogging)

Parameters

world IWorldAccessor
sourceForErrorLogging string

Returns

bool

ToBytes(BinaryWriter)

Serialized the recipe

public override void ToBytes(BinaryWriter writer)

Parameters

writer BinaryWriter

WildCardMatch(AssetLocation, AssetLocation)

Matches the wildcards for the clay recipe.

public static bool WildCardMatch(AssetLocation wildCard, AssetLocation blockCode)

Parameters

wildCard AssetLocation
blockCode AssetLocation

Returns

bool