Recipes
Phase: Server (via recipes event)
Recipes are added and removed inside the "recipes" event callback. The event context e exposes methods for every supported recipe type.
onEvent("recipes", function(e)
-- add and remove recipes here
end)
Shaped Crafting
e.addShaped(id, output, pattern, keys)
Adds a shaped crafting recipe.
| Parameter | Type | Description |
|---|---|---|
id | string | Recipe identifier, e.g. "mymod:diamond_from_stone" |
output | string | Item ID + optional count, e.g. "minecraft:diamond 2" |
pattern | table | Sequential table of row strings (max 3×3) |
keys | table | Map of single characters to item IDs |
onEvent("recipes", function(e)
-- 2×2 diamond from stone
e.addShaped("mymod:diamond_from_stone", "minecraft:diamond 2",
{"SS", "SS"},
{ S = "minecraft:stone" }
)
-- Diagonal pattern
e.addShaped("mymod:special_sword", "minecraft:netherite_sword",
{"D ", " D ", " S"},
{ D = "minecraft:diamond", S = "minecraft:stick" }
)
end)
Shapeless Crafting
e.addShapeless(id, output, ingredients)
Adds a shapeless crafting recipe.
| Parameter | Type | Description |
|---|---|---|
id | string | Recipe identifier |
output | string | Item ID + optional count |
ingredients | table | Sequential table of item IDs |
onEvent("recipes", function(e)
e.addShapeless("mymod:gravel_from_flint", "minecraft:gravel 1",
{ "minecraft:flint", "minecraft:flint" }
)
end)
Cooking Recipes
All cooking methods share the same signature:
e.addSmelting(id, output, input [, experience [, cookTime]])
e.addBlasting(id, output, input [, experience [, cookTime]])
e.addSmoking(id, output, input [, experience [, cookTime]])
e.addCampfire(id, output, input [, experience [, cookTime]])
| Parameter | Default | Description |
|---|---|---|
id | — | Recipe identifier |
output | — | Output item ID (with optional count) |
input | — | Input item ID |
experience | 0.1 | XP awarded per craft |
cookTime | 200 (smelting), 100 (blasting/smoking), 600 (campfire) | Cook duration in ticks |
onEvent("recipes", function(e)
-- Smelt dirt into coarse dirt
e.addSmelting("mymod:smelt_coarse_dirt", "minecraft:coarse_dirt", "minecraft:dirt", 0.1, 200)
-- Blast iron faster
e.addBlasting("mymod:fast_iron", "minecraft:iron_ingot", "minecraft:raw_iron", 0.7, 100)
end)
Stonecutting
e.addStonecutting(id, output, input [, count])
Adds a stonecutter recipe.
onEvent("recipes", function(e)
e.addStonecutting("mymod:cut_diamond", "minecraft:diamond 4", "minecraft:diamond_block")
end)
Removing Recipes
e.remove({ id = "..." }) or e.remove({ output = "..." })
Removes recipes matching the given filter. Specify either id (exact recipe ID) or output (item produced).
onEvent("recipes", function(e)
-- Remove all diamond crafting recipes
e.remove({ output = "minecraft:diamond" })
-- Remove a specific recipe by ID
e.remove({ id = "minecraft:diamond_sword" })
end)