Table of Contents

Class GridRecipe

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Represents a crafting recipe to be made on the crafting grid.

public class GridRecipe
Inheritance
GridRecipe

Examples

{
	"ingredientPattern": "GS,S_",
	"ingredients": {
		"G": {
			"type": "item",
			"code": "drygrass"
		},
		"S": {
			"type": "item",
			"code": "stick"
		}
	},
	"width": 2,
	"height": 2,
	"output": {
		"type": "item",
		"code": "firestarter"
	}
}

Fields

IngredientPattern (Required)

The pattern of the ingredient. Order for a 3x3 recipe:
1 2 3
4 5 6
7 8 9
Order for a 2x2 recipe:
1 2
3 4
Commas seperate each horizontal row, and an underscore ( _ ) marks a space as empty.
Note: from game version 1.20.4, this becomes null on server-side after completion of recipe resolving during server start-up phase

public string IngredientPattern

Field Value

string

Ingredients (Required)

The recipes ingredients in any order, including the code used in the ingredient pattern.
Note: from game version 1.20.4, this becomes null on server-side after completion of recipe resolving during server start-up phase

public Dictionary<string, CraftingRecipeIngredient> Ingredients

Field Value

Dictionary<string, CraftingRecipeIngredient>

Output (Required)

The resulting stack when the recipe is created.

public CraftingRecipeIngredient Output

Field Value

CraftingRecipeIngredient

Height (Recommended) (Default: 3)

Required grid height for crafting this recipe

public int Height

Field Value

int

Width (Recommended) (Default: 3)

Required grid width for crafting this recipe

public int Width

Field Value

int

Attributes (Optional) (Default: None)

Optional attribute data that you can attach any data to. Useful for code mods, but also required when using liquid ingredients.
See dough.json grid recipe file for example.

[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject Attributes

Field Value

JsonObject

AverageDurability (Optional) (Default: True)

If true, the output item will have its durability averaged over the input items

public bool AverageDurability

Field Value

bool

CopyAttributesFrom (Optional) (Default: None)

If set, it will copy over the itemstack attributes from given ingredient code

public string CopyAttributesFrom

Field Value

string

Enabled (Optional) (Default: True)

If set to false, the recipe will never be loaded. If loaded, you can use this field to disable recipes during runtime.

public bool Enabled

Field Value

bool

Name (Optional) (Default: Asset Location)

Name of the recipe. Used for logging, and some specific uses. Recipes for repairing objects must contain 'repair' in the name.

public AssetLocation Name

Field Value

AssetLocation

RecipeGroup (Optional) (Default: 0)

Info used by the handbook. By default, all recipes for an object will appear in a single preview. This allows you to split grid recipe previews into multiple.

public int RecipeGroup

Field Value

int

RequiresTrait (Optional) (Default: None)

If set, only players with given trait can use this recipe. See config/traits.json for a list of traits.

public string RequiresTrait

Field Value

string

Shapeless (Optional) (Default: False)

Whether the order of input items should be respected

public bool Shapeless

Field Value

bool

ShowInCreatedBy (Optional) (Default: True)

Used by the handbook. If false, will not appear in the "Created by" section

public bool ShowInCreatedBy

Field Value

bool