Skip to content

helix / RecipeDef

Class: RecipeDef

Defined in: core/values/recipe.ts:45

A registerable recipe - the JSON written to data/<ns>/<recipe folder>/<name>.json (via Datapack.recipe). Built from typed ItemValue/IdValue ingredients, rendered version-aware (the 1.20.5 ingredient/result format change is handled for you).

dp.recipe("ruby_block", RecipeDef.shaped( ["###", "###", "###"], { "#": Item.of("mypack:ruby") }, Item.of("mypack:ruby_block")));

Methods

toJson()

toJson(version): Record<string, unknown>

Defined in: core/values/recipe.ts:49

The recipe JSON, with embedded ingredients rendered for version.

Parameters

version

VersionProfile

Returns

Record<string, unknown>


cooking()

static cooking(ingredient, result, opts?): RecipeDef

Defined in: core/values/recipe.ts:83

A cooking recipe: minecraft:smelting (default), blasting, smoking, or campfire_cooking. experience/cookingtime default to 0.1 / 200.

Parameters

ingredient

Ingredient

result

Ingredient

opts?
cookingtime?

number

experience?

number

type?

"smelting" | "blasting" | "smoking" | "campfire_cooking"

Returns

RecipeDef


of()

static of(type, fields): RecipeDef

Defined in: core/values/recipe.ts:127

Escape hatch: a recipe by type id with already-built fields.

Parameters

type

string

fields

Record<string, unknown>

Returns

RecipeDef


shaped()

static shaped(pattern, key, result, count?): RecipeDef

Defined in: core/values/recipe.ts:54

minecraft:crafting_shaped - a grid pattern keyed by single-char ingredients.

Parameters

pattern

string[]

key

Record<string, Ingredient>

result

Ingredient

count?

number = 1

Returns

RecipeDef


shapeless()

static shapeless(ingredients, result, count?): RecipeDef

Defined in: core/values/recipe.ts:71

minecraft:crafting_shapeless - an unordered list of ingredients.

Parameters

ingredients

Ingredient[]

result

Ingredient

count?

number = 1

Returns

RecipeDef


smithingTransform()

static smithingTransform(template, base, addition, result): RecipeDef

Defined in: core/values/recipe.ts:111

minecraft:smithing_transform - template + base + addition → result (1.20+ smithing).

Parameters

template

Ingredient

base

Ingredient

addition

Ingredient

result

Ingredient

Returns

RecipeDef


stonecutting()

static stonecutting(ingredient, result, count?): RecipeDef

Defined in: core/values/recipe.ts:102

minecraft:stonecutting - one ingredient to count of a result.

Parameters

ingredient

Ingredient

result

Ingredient

count?

number = 1

Returns

RecipeDef

Released under the MIT License · Credits