Table of Contents

Class LayeredVoxelRecipe<T>

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.

public abstract class LayeredVoxelRecipe<T> : RecipeBase<T>, IRecipeBase<T>

Type Parameters

T
Inheritance
LayeredVoxelRecipe<T>
Implements
Inherited Members
Extension Methods

Constructors

LayeredVoxelRecipe()

public LayeredVoxelRecipe()

Fields

Pattern

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

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

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

RotateRecipe

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

protected virtual bool RotateRecipe { get; set; }

Property Value

bool

Methods

FromBytes(BinaryReader, IWorldAccessor)

Deserializes the alloy

public void FromBytes(BinaryReader reader, IWorldAccessor resolver)

Parameters

reader BinaryReader
resolver IWorldAccessor

GenVoxels()

Generates the voxels for the recipe.

public void GenVoxels()

GetNameToCodeMapping(IWorldAccessor)

Resolves Wildcards in the ingredients

public override Dictionary<string, string[]> GetNameToCodeMapping(IWorldAccessor world)

Parameters

world IWorldAccessor

Returns

Dictionary<string, string[]>

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 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