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
Output
The final output of this recipe.
[DocumentAsJson("Required", "", false)]
public JsonItemStack Output
Field Value
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
QuantityLayers
The number of layers in this recipe, in the Y-axis.
public abstract int QuantityLayers { get; }
Property Value
RecipeCategoryCode
A category code for this recipe type. Used for error logging.
public abstract string RecipeCategoryCode { get; }
Property Value
RecipeIngredients
public override IEnumerable<IRecipeIngredient> RecipeIngredients { get; }
Property Value
RecipeOutput
public override IRecipeOutput RecipeOutput { get; }
Property Value
RotateRecipe
If true, the recipe is rotated 90 degrees in the Y axis.
protected virtual bool RotateRecipe { get; set; }
Property Value
Methods
CloneTo(object)
protected override void CloneTo(object recipe)
Parameters
recipeobject
FromBytes(BinaryReader, IWorldAccessor)
Deserializes the alloy
public override void FromBytes(BinaryReader reader, IWorldAccessor resolver)
Parameters
readerBinaryReaderresolverIWorldAccessor
GenVoxels()
Generates the voxels for the recipe.
public void GenVoxels()
OnParsed(IWorldAccessor)
public override void OnParsed(IWorldAccessor world)
Parameters
worldIWorldAccessor
Resolve(IWorldAccessor, string)
Resolves the recipe.
public override bool Resolve(IWorldAccessor world, string sourceForErrorLogging)
Parameters
worldIWorldAccessorsourceForErrorLoggingstring
Returns
ToBytes(BinaryWriter)
Serialized the recipe
public override void ToBytes(BinaryWriter writer)
Parameters
writerBinaryWriter
WildCardMatch(AssetLocation, AssetLocation)
Matches the wildcards for the clay recipe.
public static bool WildCardMatch(AssetLocation wildCard, AssetLocation blockCode)
Parameters
wildCardAssetLocationblockCodeAssetLocation