API reference / @jsprismarine/recipes
@jsprismarine/recipes
The Java Edition recipe evaluator. It reads Java 26.3 recipe files, matches them against what a player has placed at a station, and compiles them to Bedrock identifiers for the wire. It holds no registry of its own: tags, crafting remainders, item durability and dye colors all arrive through injected lookups.
import { compileRecipes, loadRecipes } from '@jsprismarine/recipes';
import { javaItemToBedrock } from '@jsprismarine/mapping';
const { book, diagnostics, failed } = loadRecipes(definitions.recipesJava, {
tags: (registry, tag) => registryTags[registry]?.get(tag),
remainderOf: (id) => items.get(id)?.components['minecraft:crafting_remainder'],
maxDamageOf: (id) => items.get(id)?.components['minecraft:max_damage'],
dyeColorRgb: (color) => DYE_COLORS[color]
});
book.match({ station: 'crafting', grid });
// { recipe, result, consumed, remainder }
compileRecipes(book.recipes, javaItemToBedrock);
// { recipes, losses, gaps, dropped }Coverage
All 22 serializers Java 26.3 registers, verified against net.minecraft.world.item.crafting.RecipeSerializers in the 26.3 server jar and against the 2042 vanilla recipe files, which use every one of them.
| Serializer | Vanilla files | Station | Logic |
|---|---|---|---|
crafting_shaped | 827 | crafting | pattern, mirrored and offset |
crafting_shapeless | 375 | crafting | ingredient-to-slot assignment |
stonecutting | 351 | stonecutting | one item in, one out |
brewing | 279 | brewing | input plus reagent, with a potion predicate on the input |
smelting | 73 | smelting | one item, experience and cook time |
crafting_transmute | 33 | crafting | code: input keeps its components, material is counted |
blasting | 25 | blasting | one item |
smithing_trim | 18 | smithing | code: writes minecraft:trim onto the base |
crafting_special_bannerduplicate | 16 | crafting | code: copies patterns, returns the source banner |
smithing_transform | 12 | smithing | base components carry into the result |
smoking | 9 | smoking | one item |
campfire_cooking | 9 | campfire_cooking | one item |
crafting_dye | 6 | crafting | code: averages dye colors the way DyedItemColor.applyDyes does |
crafting_decorated_pot | 1 | crafting | code: four sherds at the edge-center slots |
crafting_imbue | 1 | crafting | code: eight materials around one source, which carries its potion |
crafting_special_bookcloning | 1 | crafting | code: one copy per blank book, generation plus one |
crafting_special_firework_rocket | 1 | crafting | code: flight duration from the fuel count |
crafting_special_firework_star | 1 | crafting | code: shape, colors, trail and twinkle |
crafting_special_firework_star_fade | 1 | crafting | code: adds fade colors to an existing explosion |
crafting_special_mapextending | 1 | crafting | code: marks the centered map for rescaling |
crafting_special_repairitem | 1 | crafting | code: combined durability plus five percent |
crafting_special_shielddecoration | 1 | crafting | code: banner color and patterns onto a shield |
What 26.3 moved out of crafting_special_*
Older notes list armor dyeing, map cloning, shulker box coloring, tipped arrows and suspicious stew among the code-only recipes. In 26.3 they are not. Armor dyeing is crafting_dye, tipped arrows are crafting_imbue, map cloning and shulker box and bundle dyeing are crafting_transmute, and all 17 suspicious stew recipes are plain crafting_shapeless with the effect in the result's minecraft:suspicious_stew_effects component. The eight serializers whose name still starts with crafting_special_ are the eight in the table above, which is the same eight java-registries-and-components.md section 8 lists. Four more types are code behind a parameterized file (crafting_transmute, crafting_dye, crafting_imbue, crafting_decorated_pot), so twelve of the 22 need a real implementation rather than a field read.
Ingredient forms
All four composition forms Java 26.3 accepts: an item identifier, a #tag, a list of either, and an inline object naming an item plus component predicates. Vanilla uses the inline form only for the 279 brewing recipes, where it carries a potion_contents predicate; that predicate is implemented against the potion registry, and any other inline component is compared structurally against the candidate stack's component of the same name.
What is not here
Recipe book unlocking, the recipe advancement criteria, and the Bedrock priority field, which has no Java source. Brewing matches one bottle slot at a time; the three-slot brewing stand loop belongs to the block entity.
The injected seams
Parsing and matching read four lookups, all optional, all on RecipeContext. Each one says what stops working when it is missing, because a caller can start with none of them.
| Lookup | Used by | Without it |
|---|---|---|
tags(registry, tag) | every #tag ingredient, at parse time | the ingredient accepts nothing and parsing warns |
remainderOf(itemId) | the craft's leftovers | a milk bucket or a honey bottle vanishes into the craft |
maxDamageOf(itemId) | crafting_special_repairitem | the repair recipe never matches, because damageability is what it tests |
dyeColorRgb(color) | crafting_dye, the two firework star recipes | dyed armor keeps its old color and a star records none |
Tags resolve at parse time, which is where Java resolves them: reloading tags means reparsing the recipes.
The Bedrock side is a fifth seam. compileRecipes(recipes, mapper) takes the item mapper as an argument rather than importing one, so this package has no runtime dependency on @jsprismarine/mapping. That package's javaItemToBedrock satisfies the JavaItemMapper type structurally, and the tests here run against it as a dev dependency.
Compiling reports rather than drops. A reviewed loss keeps the recipe and is listed in losses with the mapper's reason. An identifier with no Bedrock item at all is listed in gaps; it costs the recipe only when it is the result or when it empties an ingredient, and those recipes are named in dropped. Each compiled recipe also carries the Bedrock block tags its station needs (crafting_table, furnace, blast_furnace, smoker, campfire and soul_campfire, stonecutter, smithing_table, brewing_stand), taken from the tags the vanilla Bedrock pack's own recipe files carry.
Matching
A crafting grid is cropped to the bounding box of its filled slots before any recipe sees it, which is what Java's CraftingInput.ofPositioned does and what lets a 2x2 recipe match in any corner of a 3x3 table. The shaped pattern is trimmed the same way when the recipe is parsed, matching ShapedRecipePattern.shrink; seven vanilla recipes, spyglass and mace among them, are written with padding columns and would otherwise be wider than any grid they can see. The pattern is then tried at every remaining offset and in both the written and the left-right mirrored arrangement. Shaped recipes are always mirrorable and never vertically flippable.
A match reports consumed and remainder per input slot in the input's own slot order. Both carry the full grid, not the cropped one. consumed is one per filled slot. remainder is what the slot gains afterwards: the item's crafting remainder, or the source stack that banner duplication and book cloning hand back.
Ordering and network ids
orderRecipes sorts by namespace first, then by path, comparing UTF-16 code units rather than collating. localeCompare puts the same two identifiers in different orders on different machines, and the plan takes recipe network ids from registry order, so the order has to be a pure function of the loaded identifiers. Load order, file system order and insertion order are all excluded for the same reason.
assignNetIds numbers the sorted list from 1, because Bedrock reserves 0 for "no recipe". Adding a recipe renumbers everything that sorts after it, so a client has to be sent a fresh recipe list after a reload rather than a patch.
Tests
pnpm --filter @jsprismarine/recipes test runs the unit tests: one parse and match case per serializer, shaped mirroring and offset placement, remainder items, tag ingredients, the four ingredient composition forms, and the twelve code-logic recipes with real inputs.
A corpus test runs the package over Java 26.3's own 2042 recipe files. It needs the server jar that pnpm --filter @jsprismarine/bedrock-data run fetch:sources caches, so it is gated:
pnpm --filter @jsprismarine/bedrock-data run fetch:sources
JSP_VANILLA_RECIPES=1 pnpm --filter @jsprismarine/recipes testIt asserts zero parse errors over all 2042 files and that all 22 serializers appear, rebuilds an input for each recipe from its own ingredients, and reports how many matched and what compiling the set through @jsprismarine/mapping costs. Measured against Java 26.3:
| Measure | Count |
|---|---|
| recipe files read | 2042 |
| parse errors | 0 |
| serializers seen | 22 of 22 |
| inputs rebuilt | 2041 (only repair_item names no ingredient to build from) |
| rebuilt inputs the recipe accepts | 2041 |
| rebuilt inputs the book returns that same recipe for first | 1769 |
| compiled to Bedrock | 2042 |
| reviewed losses | 2 (furnace_minecart and spectral_arrow, both results, both recipes kept) |
| identifiers with no Bedrock item | 0 |
| recipes dropped | 0 |
The 272 inputs the book answers with a different recipe are almost all stonecutting, where vanilla deliberately offers several results for one input and the player picks at the station.
Interfaces
BannerDuplicateRecipe
Defined in: types.ts:214
minecraft:crafting_special_bannerduplicate: a patterned banner and a blank one of the same color.
Extends
RecipeBase
Properties
banner
readonlybanner:Ingredient
Defined in: types.ts:216
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:217
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_special_bannerduplicate"
Defined in: types.ts:215
Overrides
RecipeBase.type
BedrockItemRef
Defined in: compile.ts:8
One Bedrock item reference: the identifier plus the legacy damage value where one selects a sub-item.
Extended by
Properties
data?
readonlyoptionaldata?:number
Defined in: compile.ts:10
identifier
readonlyidentifier:string
Defined in: compile.ts:9
BookCloningRecipe
Defined in: types.ts:221
minecraft:crafting_special_bookcloning: one written book plus blank books, one copy each.
Extends
RecipeBase
Properties
allowedGenerations
readonlyallowedGenerations:IntRange
Defined in: types.ts:226
Which generation values of the source book may be copied. Defaults to 0 to 1; Java caps the field at 0 to 2.
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
material
readonlymaterial:Ingredient
Defined in: types.ts:224
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:227
source
readonlysource:Ingredient
Defined in: types.ts:223
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_special_bookcloning"
Defined in: types.ts:222
Overrides
RecipeBase.type
BrewingRecipe
Defined in: types.ts:206
minecraft:brewing: one reagent above three identical inputs in a brewing stand.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
input
readonlyinput:Ingredient
Defined in: types.ts:208
output
readonlyoutput:ItemStackTemplate
Defined in: types.ts:210
reagent
readonlyreagent:Ingredient
Defined in: types.ts:209
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:brewing"
Defined in: types.ts:207
Overrides
RecipeBase.type
CompiledIngredient
Defined in: compile.ts:50
One compiled ingredient: every Bedrock item it accepts, plus the Java tags it was written as.
Properties
items
readonlyitems: readonlyBedrockItemRef[]
Defined in: compile.ts:51
tags
readonlytags: readonlystring[]
Defined in: compile.ts:53
The Java item tags the ingredient came from, kept so a caller can emit a Bedrock tag descriptor instead.
CompiledRecipe
Defined in: compile.ts:62
One recipe translated to Bedrock identifiers, ready for a CraftingDataPacket entry.
Properties
blockTags
readonlyblockTags: readonlystring[]
Defined in: compile.ts:69
The Bedrock block tags the client needs to show the recipe at a station.
id
readonlyid:string
Defined in: compile.ts:63
ingredients
readonlyingredients: readonly (CompiledIngredient|null)[]
Defined in: compile.ts:77
Ingredients in the same order recipeIngredients reports them: row-major pattern cells for a shaped recipe, declaration order otherwise. null is an empty shaped cell or an omitted optional slot.
netId
readonlynetId:number
Defined in: compile.ts:67
The network id, from registry order.
result?
readonlyoptionalresult?:CompiledResult
Defined in: compile.ts:84
The result, or undefined for the recipes that build theirs from an input stack: repair_item, smithing_trim, map_cloning and map_extending. A Bedrock client cannot be shown those as a plain result and the server has to answer for them.
shape?
readonlyoptionalshape?:object
Defined in: compile.ts:71
The pattern size, for minecraft:crafting_shaped only.
height
readonlyheight:number
width
readonlywidth:number
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: compile.ts:65
type
readonlytype:"minecraft:blasting"|"minecraft:brewing"|"minecraft:campfire_cooking"|"minecraft:crafting_decorated_pot"|"minecraft:crafting_dye"|"minecraft:crafting_imbue"|"minecraft:crafting_shaped"|"minecraft:crafting_shapeless"|"minecraft:crafting_special_bannerduplicate"|"minecraft:crafting_special_bookcloning"|"minecraft:crafting_special_firework_rocket"|"minecraft:crafting_special_firework_star"|"minecraft:crafting_special_firework_star_fade"|"minecraft:crafting_special_mapextending"|"minecraft:crafting_special_repairitem"|"minecraft:crafting_special_shielddecoration"|"minecraft:crafting_transmute"|"minecraft:smelting"|"minecraft:smithing_transform"|"minecraft:smithing_trim"|"minecraft:smoking"|"minecraft:stonecutting"
Defined in: compile.ts:64
CompiledResult
Defined in: compile.ts:57
One compiled result stack.
Extends
Properties
count
readonlycount:number
Defined in: compile.ts:58
data?
readonlyoptionaldata?:number
Defined in: compile.ts:10
Inherited from
identifier
readonlyidentifier:string
Defined in: compile.ts:9
Inherited from
ComponentPredicate
Defined in: ingredient.ts:19
A predicate on one Java data component of a candidate stack. Java's ingredient grammar carries these in the inline object form, which vanilla 26.3 uses only for the 279 brewing recipes.
Properties
component
readonlycomponent:string
Defined in: ingredient.ts:21
The namespaced component identifier the predicate reads.
potions?
readonlyoptionalpotions?: readonlystring[]
Defined in: ingredient.ts:28
For minecraft:potion_contents, the potions field resolved through the potion registry. Absent for every other component.
value
readonlyvalue:unknown
Defined in: ingredient.ts:23
The predicate body exactly as the recipe wrote it.
CookingRecipe
Defined in: types.ts:168
The four cooking serializers, which differ only in their station and their vanilla cooking times.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
cookingTime
readonlycookingTime:number
Defined in: types.ts:175
How many ticks the cook takes.
experience
readonlyexperience:number
Defined in: types.ts:173
Experience the station drops when the result is collected.
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
ingredient
readonlyingredient:Ingredient
Defined in: types.ts:170
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:171
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:blasting"|"minecraft:campfire_cooking"|"minecraft:smelting"|"minecraft:smoking"
Defined in: types.ts:169
Overrides
RecipeBase.type
CraftingGrid
Defined in: grid.ts:4
The contents of a crafting grid of a declared size, in row-major order.
Extended by
Properties
height
readonlyheight:number
Defined in: grid.ts:6
slots
readonlyslots: readonly (RecipeItemStack|null)[]
Defined in: grid.ts:8
width * height slots in row-major order, null where the slot is empty.
width
readonlywidth:number
Defined in: grid.ts:5
CroppedGrid
Defined in: grid.ts:16
A crafting grid shrunk to the bounding box of its filled slots, which is what Java's CraftingInput.ofPositioned builds before any recipe sees the grid. Cropping is what lets a 2x2 recipe match anywhere in a 3x3 table.
Extends
Properties
filled
readonlyfilled:number
Defined in: grid.ts:20
How many cropped slots hold an item.
height
readonlyheight:number
Defined in: grid.ts:6
Inherited from
slots
readonlyslots: readonly (RecipeItemStack|null)[]
Defined in: grid.ts:8
width * height slots in row-major order, null where the slot is empty.
Inherited from
sourceSlots
readonlysourceSlots: readonlynumber[]
Defined in: grid.ts:18
For each cropped slot, the index it came from in the original grid.
width
readonlywidth:number
Defined in: grid.ts:5
Inherited from
DecoratedPotRecipe
Defined in: types.ts:158
minecraft:crafting_decorated_pot: four sherds or bricks at the four edge-center slots of a 3x3 grid.
Extends
RecipeBase
Properties
back
readonlyback:Ingredient
Defined in: types.ts:160
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
front
readonlyfront:Ingredient
Defined in: types.ts:163
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
left
readonlyleft:Ingredient
Defined in: types.ts:161
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:164
right
readonlyright:Ingredient
Defined in: types.ts:162
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_decorated_pot"
Defined in: types.ts:159
Overrides
RecipeBase.type
DyeRecipe
Defined in: types.ts:142
minecraft:crafting_dye: one dyeable target plus one to eight dyes.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
dye
readonlydye:Ingredient
Defined in: types.ts:145
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:146
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
target
readonlytarget:Ingredient
Defined in: types.ts:144
type
readonlytype:"minecraft:crafting_dye"
Defined in: types.ts:143
Overrides
RecipeBase.type
FireworkRocketRecipe
Defined in: types.ts:231
minecraft:crafting_special_firework_rocket: one shell, one to three fuel, and up to seven stars.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
fuel
readonlyfuel:Ingredient
Defined in: types.ts:234
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:236
shell
readonlyshell:Ingredient
Defined in: types.ts:233
star
readonlystar:Ingredient
Defined in: types.ts:235
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_special_firework_rocket"
Defined in: types.ts:232
Overrides
RecipeBase.type
FireworkStarFadeRecipe
Defined in: types.ts:252
minecraft:crafting_special_firework_star_fade: one firework star plus one to eight dyes.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
dye
readonlydye:Ingredient
Defined in: types.ts:255
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:256
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
target
readonlytarget:Ingredient
Defined in: types.ts:254
type
readonlytype:"minecraft:crafting_special_firework_star_fade"
Defined in: types.ts:253
Overrides
RecipeBase.type
FireworkStarRecipe
Defined in: types.ts:240
minecraft:crafting_special_firework_star: one fuel, one to eight dyes, and optional shape and effect modifiers.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
dye
readonlydye:Ingredient
Defined in: types.ts:243
fuel
readonlyfuel:Ingredient
Defined in: types.ts:242
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:248
shapes
readonlyshapes:Readonly<Record<string,Ingredient>>
Defined in: types.ts:245
The item that selects each explosion shape, keyed by the shape name the result records.
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
trail
readonlytrail:Ingredient
Defined in: types.ts:246
twinkle
readonlytwinkle:Ingredient
Defined in: types.ts:247
type
readonlytype:"minecraft:crafting_special_firework_star"
Defined in: types.ts:241
Overrides
RecipeBase.type
ImbueRecipe
Defined in: types.ts:150
minecraft:crafting_imbue: eight materials around one source, which is how tipped arrows are made.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
material
readonlymaterial:Ingredient
Defined in: types.ts:153
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:154
source
readonlysource:Ingredient
Defined in: types.ts:152
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_imbue"
Defined in: types.ts:151
Overrides
RecipeBase.type
Ingredient
Defined in: ingredient.ts:35
One resolved recipe ingredient: the item identifiers it accepts plus any component predicate a candidate stack has to satisfy.
Properties
components
readonlycomponents: readonlyComponentPredicate[]
Defined in: ingredient.ts:41
Component predicates every candidate stack has to satisfy.
items
readonlyitems: readonlystring[]
Defined in: ingredient.ts:37
Every accepted Java item identifier, in declaration order with duplicates removed.
tags
readonlytags: readonlystring[]
Defined in: ingredient.ts:39
The item tags the ingredient was written as, in declaration order, without the leading #.
IngredientDiagnostic
Defined in: ingredient.ts:45
Why an ingredient failed to parse, or what it lost while parsing.
Properties
message
readonlymessage:string
Defined in: ingredient.ts:49
path
readonlypath:string
Defined in: ingredient.ts:48
Dotted path to the offending field inside the recipe JSON, such as key.#.
severity
readonlyseverity:"error"|"warning"
Defined in: ingredient.ts:46
IngredientParseResult
Defined in: ingredient.ts:53
What parseIngredient produced.
Properties
diagnostics
readonlydiagnostics: readonlyIngredientDiagnostic[]
Defined in: ingredient.ts:56
ingredient?
readonlyoptionalingredient?:Ingredient
Defined in: ingredient.ts:55
The ingredient, absent when the form was not one the grammar accepts.
IntRange
Defined in: itemStack.ts:30
An inclusive integer range, Java's MinMaxBounds.Ints with both bounds present.
Properties
max
readonlymax:number
Defined in: itemStack.ts:32
min
readonlymin:number
Defined in: itemStack.ts:31
ItemStackTemplate
Defined in: itemStack.ts:20
An item stack as a recipe declares it. id is absent on the two vanilla recipes whose result is derived from an input stack rather than named, map_cloning and map_extending.
Properties
components?
readonlyoptionalcomponents?:Readonly<Record<string,unknown>>
Defined in: itemStack.ts:26
Java data components the recipe sets on the result.
count
readonlycount:number
Defined in: itemStack.ts:24
How many items the result holds. Defaults to 1 when the recipe omits count.
id?
readonlyoptionalid?:string
Defined in: itemStack.ts:22
The namespaced Java item identifier, absent when the result comes from an input stack.
MapExtendingRecipe
Defined in: types.ts:260
minecraft:crafting_special_mapextending: a filled map centered in a 3x3 grid of paper.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
map
readonlymap:Ingredient
Defined in: types.ts:262
material
readonlymaterial:Ingredient
Defined in: types.ts:263
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:264
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_special_mapextending"
Defined in: types.ts:261
Overrides
RecipeBase.type
RecipeBook
Defined in: book.ts:17
Every loaded recipe, ordered, numbered, and indexed by station. This is the object the server holds: it answers "what does this grid make" and "what network id does this recipe have" without the caller knowing how either is worked out.
Properties
netIds
readonlynetIds:ReadonlyMap<string,number>
Defined in: book.ts:21
The network id of every recipe, keyed by identifier.
recipes
readonlyrecipes: readonlyRecipe[]
Defined in: book.ts:19
Every recipe in registry order, which is also network id order.
Methods
byStation()
byStation(
station): readonlyRecipe[]
Defined in: book.ts:25
Every recipe matched at one station, in registry order.
Parameters
station
"crafting" | "smelting" | "blasting" | "smoking" | "campfire_cooking" | "stonecutting" | "smithing" | "brewing"
Returns
readonly Recipe[]
get()
get(
id):Recipe|undefined
Defined in: book.ts:23
One recipe by identifier.
Parameters
id
string
Returns
Recipe | undefined
match()
match(
input):RecipeMatch|undefined
Defined in: book.ts:27
The first recipe that accepts the input, in registry order.
Parameters
input
Returns
RecipeMatch | undefined
matchAll()
matchAll(
input): readonlyRecipeMatch[]
Defined in: book.ts:29
Every recipe that accepts the input, in registry order.
Parameters
input
Returns
readonly RecipeMatch[]
RecipeCompileGap
Defined in: compile.ts:97
One identifier a recipe uses that has no Bedrock item at all.
Properties
dropped
readonlydropped:boolean
Defined in: compile.ts:102
Whether the gap cost the whole recipe, which happens when the result or a whole ingredient is unmappable.
javaId
readonlyjavaId:string
Defined in: compile.ts:99
recipeId
readonlyrecipeId:string
Defined in: compile.ts:98
where
readonlywhere:"ingredient"|"result"
Defined in: compile.ts:100
RecipeCompileLoss
Defined in: compile.ts:88
One place the Java-to-Bedrock mapping lost information while compiling a recipe.
Properties
javaId
readonlyjavaId:string
Defined in: compile.ts:90
reason
readonlyreason:string
Defined in: compile.ts:93
recipeId
readonlyrecipeId:string
Defined in: compile.ts:89
where
readonlywhere:"ingredient"|"result"
Defined in: compile.ts:92
Whether the identifier was on the input or the output side.
RecipeCompileReport
Defined in: compile.ts:106
Everything compileRecipes produced, including the recipes it could not translate cleanly.
Properties
dropped
readonlydropped: readonlyobject[]
Defined in: compile.ts:114
Recipes left out entirely, with the identifier that cost them.
gaps
readonlygaps: readonlyRecipeCompileGap[]
Defined in: compile.ts:112
Every identifier with no Bedrock item, and whether the recipe survived without it.
losses
readonlylosses: readonlyRecipeCompileLoss[]
Defined in: compile.ts:110
Every reviewed loss. The recipes are still in recipes; the losses are listed so a dashboard can count them.
recipes
readonlyrecipes: readonlyCompiledRecipe[]
Defined in: compile.ts:108
Every recipe that compiled, in network id order.
RecipeContext
Defined in: context.ts:9
The lookups this package needs from the rest of the server. Every one is injected so the evaluator depends on no registry implementation, and every one is optional so a caller can start with none and add them as the registries come up. Each entry below says what stops working without it.
Properties
dyeColorRgb?
readonlyoptionaldyeColorRgb?: (dyeColor) =>number|undefined
Defined in: context.ts:32
The packed 24-bit RGB value of a dye color name such as red, from Java's DyeColor table. Without it dyed armor keeps its old color and a firework star records no colors.
Parameters
dyeColor
string
Returns
number | undefined
maxDamageOf?
readonlyoptionalmaxDamageOf?: (itemId) =>number|undefined
Defined in: context.ts:26
An item's minecraft:max_damage, or undefined for an item that takes no damage. Without it the repair recipe never matches, because damageability is what it tests for.
Parameters
itemId
string
Returns
number | undefined
remainderOf?
readonlyoptionalremainderOf?: (itemId) =>string|undefined
Defined in: context.ts:20
The item an ingredient leaves behind when a craft consumes it, from Java's minecraft:crafting_remainder item component. Without it a bucket or a honey bottle vanishes into the craft.
Parameters
itemId
string
Returns
string | undefined
tags?
readonlyoptionaltags?:TagLookup
Defined in: context.ts:14
Resolves a Java tag to its members. Needed at parse time: without it every #tag ingredient accepts nothing and parsing reports a warning.
RecipeDiagnostic
Defined in: parse.ts:10
One problem found while reading a recipe file.
Properties
message
readonlymessage:string
Defined in: parse.ts:16
path
readonlypath:string
Defined in: parse.ts:15
Dotted path to the offending field inside the recipe JSON.
recipeId
readonlyrecipeId:string
Defined in: parse.ts:13
The recipe's identifier.
severity
readonlyseverity:"error"|"warning"
Defined in: parse.ts:11
RecipeItemStack
Defined in: itemStack.ts:6
One item stack as the recipe evaluator sees it: a Java identifier, a count, and the Java data components that the recipe grammar reads or writes. Components the evaluator never touches travel through untouched.
Properties
components?
readonlyoptionalcomponents?:Readonly<Record<string,unknown>>
Defined in: itemStack.ts:12
Java data components keyed by their namespaced identifier.
count
readonlycount:number
Defined in: itemStack.ts:10
How many items the stack holds. A stack in a crafting slot always holds at least one.
id
readonlyid:string
Defined in: itemStack.ts:8
The namespaced Java item identifier.
RecipeLoadResult
Defined in: book.ts:162
A recipe book plus everything that went wrong while reading the files behind it.
Properties
book
readonlybook:RecipeBook
Defined in: book.ts:163
diagnostics
readonlydiagnostics: readonlyRecipeDiagnostic[]
Defined in: book.ts:164
failed
readonlyfailed: readonlystring[]
Defined in: book.ts:166
Identifiers whose file failed to parse, so the book does not hold them.
RecipeMatch
Defined in: match.ts:50
A recipe that accepts an input, with everything the caller needs to apply the craft.
Properties
consumed
readonlyconsumed: readonlynumber[]
Defined in: match.ts:58
How many items the craft takes from each input slot, in the input's own slot order: the full crafting grid in row-major order, or the station's slots in the order RecipeInput declares them.
cookingTime?
readonlyoptionalcookingTime?:number
Defined in: match.ts:69
How many ticks the cook takes, for the four cooking serializers.
experience?
readonlyoptionalexperience?:number
Defined in: match.ts:67
Experience the station drops, for the four cooking serializers.
recipe
readonlyrecipe:Recipe
Defined in: match.ts:51
remainder
readonlyremainder: readonly (RecipeItemStack|null)[]
Defined in: match.ts:65
What the craft puts back into each slot after the consumption above, aligned with consumed. This is the bucket a milk bucket leaves, the glass bottle honey leaves, or the source item a duplicating recipe returns. null where the craft leaves nothing.
result
readonlyresult:RecipeItemStack
Defined in: match.ts:52
RecipeParseResult
Defined in: parse.ts:23
What parseRecipe produced. recipe is absent exactly when the diagnostics hold an error; warnings leave a usable recipe behind.
Properties
diagnostics
readonlydiagnostics: readonlyRecipeDiagnostic[]
Defined in: parse.ts:25
recipe?
readonlyoptionalrecipe?:Recipe
Defined in: parse.ts:24
RepairItemRecipe
Defined in: types.ts:268
minecraft:crafting_special_repairitem: two damaged copies of one item combine into a repaired one.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_special_repairitem"
Defined in: types.ts:269
Overrides
RecipeBase.type
ShapedPattern
Defined in: types.ts:102
A shaped pattern laid out row by row, with null for an empty cell.
Properties
cells
readonlycells: readonly (Ingredient|null)[]
Defined in: types.ts:106
width * height cells in row-major order.
height
readonlyheight:number
Defined in: types.ts:104
width
readonlywidth:number
Defined in: types.ts:103
ShapedRecipe
Defined in: types.ts:110
minecraft:crafting_shaped: a pattern plus its key, matched with mirroring and offset placement.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
pattern
readonlypattern:ShapedPattern
Defined in: types.ts:112
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:113
showNotification
readonlyshowNotification:boolean
Defined in: types.ts:115
Whether the client pops a recipe book notification on unlock. One vanilla recipe sets this false.
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_shaped"
Defined in: types.ts:111
Overrides
RecipeBase.type
ShapelessRecipe
Defined in: types.ts:119
minecraft:crafting_shapeless: up to nine ingredients in any arrangement.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
ingredients
readonlyingredients: readonlyIngredient[]
Defined in: types.ts:121
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:122
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_shapeless"
Defined in: types.ts:120
Overrides
RecipeBase.type
ShieldDecorationRecipe
Defined in: types.ts:273
minecraft:crafting_special_shielddecoration: a shield takes the banner's base color and patterns.
Extends
RecipeBase
Properties
banner
readonlybanner:Ingredient
Defined in: types.ts:275
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:277
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
target
readonlytarget:Ingredient
Defined in: types.ts:276
type
readonlytype:"minecraft:crafting_special_shielddecoration"
Defined in: types.ts:274
Overrides
RecipeBase.type
SmithingTransformRecipe
Defined in: types.ts:186
minecraft:smithing_transform: template plus base plus addition yields a named result.
Extends
RecipeBase
Properties
addition?
readonlyoptionaladdition?:Ingredient
Defined in: types.ts:191
base
readonlybase:Ingredient
Defined in: types.ts:190
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:192
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
template?
readonlyoptionaltemplate?:Ingredient
Defined in: types.ts:189
Absent when the recipe accepts any template slot content, including an empty one.
type
readonlytype:"minecraft:smithing_transform"
Defined in: types.ts:187
Overrides
RecipeBase.type
SmithingTrimRecipe
Defined in: types.ts:196
minecraft:smithing_trim: the base keeps its identity and gains an armor trim.
Extends
RecipeBase
Properties
addition?
readonlyoptionaladdition?:Ingredient
Defined in: types.ts:200
base
readonlybase:Ingredient
Defined in: types.ts:199
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
pattern
readonlypattern:string
Defined in: types.ts:202
The minecraft:trim_pattern identifier the craft writes onto the base.
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
template?
readonlyoptionaltemplate?:Ingredient
Defined in: types.ts:198
type
readonlytype:"minecraft:smithing_trim"
Defined in: types.ts:197
Overrides
RecipeBase.type
StonecuttingRecipe
Defined in: types.ts:179
minecraft:stonecutting: one input, one result, selected by the player at the stonecutter.
Extends
RecipeBase
Properties
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
ingredient
readonlyingredient:Ingredient
Defined in: types.ts:181
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:182
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:stonecutting"
Defined in: types.ts:180
Overrides
RecipeBase.type
TransmuteRecipe
Defined in: types.ts:130
minecraft:crafting_transmute: one input keeps its components while its identifier changes, consuming a counted material. Vanilla uses it for shulker box and bundle dyeing and for map cloning.
Extends
RecipeBase
Properties
addMaterialCountToResult
readonlyaddMaterialCountToResult:boolean
Defined in: types.ts:137
Whether the result count is the material count plus one, which is how map cloning scales.
category?
readonlyoptionalcategory?:string
Defined in: types.ts:98
The recipe book category, when the recipe declares one.
Inherited from
RecipeBase.category
group?
readonlyoptionalgroup?:string
Defined in: types.ts:96
The recipe book group, when the recipe declares one.
Inherited from
RecipeBase.group
id
readonlyid:string
Defined in: types.ts:92
The recipe's identifier, which is its datapack file path without the extension.
Inherited from
RecipeBase.id
input
readonlyinput:Ingredient
Defined in: types.ts:132
material
readonlymaterial:Ingredient
Defined in: types.ts:133
materialCount
readonlymaterialCount:IntRange
Defined in: types.ts:135
How many material items the craft takes. Defaults to exactly 1; Java caps the field at 1 to 8.
result
readonlyresult:ItemStackTemplate
Defined in: types.ts:138
station
readonlystation:"crafting"|"smelting"|"blasting"|"smoking"|"campfire_cooking"|"stonecutting"|"smithing"|"brewing"
Defined in: types.ts:94
Inherited from
RecipeBase.station
type
readonlytype:"minecraft:crafting_transmute"
Defined in: types.ts:131
Overrides
RecipeBase.type
Type Aliases
JavaItemMapper
JavaItemMapper = (
javaId) =>JavaItemMapping
Defined in: compile.ts:29
The item half of the Java-to-Bedrock seam, injected so this package depends on no mapping table.
Parameters
javaId
string
Returns
JavaItemMapping
JavaItemMapping = {
bedrock:BedrockItemRef;kind:"mapped"; } | {bedrock:BedrockItemRef;kind:"loss";loss: {reason:string; }; } | {bedrock:BedrockItemRef;kind:"passthrough"; } | {javaId:string;kind:"unknown"; }
Defined in: compile.ts:18
What a Java item lookup produced. @jsprismarine/mapping's javaItemToBedrock returns exactly this shape, which is how the two packages meet without this one depending on that one at runtime.
Union Members
Type Literal
{ bedrock: BedrockItemRef; kind: "mapped"; }
The Bedrock item registry knows the item.
Type Literal
{ bedrock: BedrockItemRef; kind: "loss"; loss: { reason: string; }; }
A reviewed loss: the Java identity does not survive, and bedrock is the listed fallback.
Type Literal
{ bedrock: BedrockItemRef; kind: "passthrough"; }
Custom content, passed through untouched.
Type Literal
{ javaId: string; kind: "unknown"; }
No Bedrock item at all.
Recipe
Recipe =
ShapedRecipe|ShapelessRecipe|TransmuteRecipe|DyeRecipe|ImbueRecipe|DecoratedPotRecipe|CookingRecipe|StonecuttingRecipe|SmithingTransformRecipe|SmithingTrimRecipe|BrewingRecipe|BannerDuplicateRecipe|BookCloningRecipe|FireworkRocketRecipe|FireworkStarRecipe|FireworkStarFadeRecipe|MapExtendingRecipe|RepairItemRecipe|ShieldDecorationRecipe
Defined in: types.ts:281
One parsed recipe of any of the 22 serializers.
RecipeInput
RecipeInput = {
grid:CraftingGrid;station:"crafting"; } | {item:RecipeItemStack|null;station:SingleItemStation; } | {addition:RecipeItemStack|null;base:RecipeItemStack|null;station:"smithing";template:RecipeItemStack|null; } | {input:RecipeItemStack|null;reagent:RecipeItemStack|null;station:"brewing"; }
Defined in: match.ts:34
What a player has placed at a station, ready to be matched against that station's recipes.
Union Members
Type Literal
{ grid: CraftingGrid; station: "crafting"; }
A crafting grid of the table's or the inventory's declared size.
Type Literal
{ item: RecipeItemStack | null; station: SingleItemStation; }
A furnace, blast furnace, smoker, campfire or stonecutter input slot.
Type Literal
{ addition: RecipeItemStack | null; base: RecipeItemStack | null; station: "smithing"; template: RecipeItemStack | null; }
The smithing table's three slots, in the order the player sees them.
Type Literal
{ input: RecipeItemStack | null; reagent: RecipeItemStack | null; station: "brewing"; }
One brewing stand bottle slot and the reagent above it.
RecipeOfType
RecipeOfType<
T> =Extract<Recipe, {type:T; }>
Defined in: types.ts:303
The recipe variant a serializer name parses into.
Type Parameters
T
T extends RecipeType
RecipeStation
RecipeStation = typeof
RECIPE_STATIONS[number]
Defined in: types.ts:61
One of RECIPE_STATIONS.
RecipeType
RecipeType = typeof
RECIPE_TYPES[number]
Defined in: types.ts:35
One of RECIPE_TYPES.
TagLookup
TagLookup = (
registry,tag) => readonlystring[] |undefined
Defined in: ingredient.ts:12
Resolves a Java tag to the identifiers it holds, without the leading #. The evaluator asks for the item registry everywhere an ingredient appears and for potion inside a potion component predicate. Return undefined for a tag the server does not know; the caller turns that into a diagnostic rather than an exception.
Parameters
registry
string
tag
string
Returns
readonly string[] | undefined
Variables
BEDROCK_STATION_TAGS
constBEDROCK_STATION_TAGS:object
Defined in: compile.ts:38
The Bedrock block tags that put a recipe in front of a station, from the tags the vanilla Bedrock pack's 1892 recipe files carry (docs/research/bedrock-blocks-items-recipes-biomes-features.md section 4). A campfire recipe carries both campfire tags, which is how Bedrock gives one Java campfire_cooking recipe to both campfire blocks.
Type Declaration
blasting
readonlyblasting: readonly ["blast_furnace"]
brewing
readonlybrewing: readonly ["brewing_stand"]
campfire_cooking
readonlycampfire_cooking: readonly ["campfire","soul_campfire"]
crafting
readonlycrafting: readonly ["crafting_table"]
smelting
readonlysmelting: readonly ["furnace"]
smithing
readonlysmithing: readonly ["smithing_table"]
smoking
readonlysmoking: readonly ["smoker"]
stonecutting
readonlystonecutting: readonly ["stonecutter"]
EMPTY_CONTEXT
constEMPTY_CONTEXT:RecipeContext={}
Defined in: context.ts:36
A context with no lookups, used when a caller passes none.
FIRST_RECIPE_NET_ID
constFIRST_RECIPE_NET_ID:1=1
Defined in: order.ts:4
The first network id assigned. Bedrock reserves 0 for "no recipe".
RECIPE_STATIONS
constRECIPE_STATIONS: readonly ["crafting","smelting","blasting","smoking","campfire_cooking","stonecutting","smithing","brewing"]
Defined in: types.ts:49
Java's eight RecipeType values, which is the station a recipe is matched at. Several serializers share one station: the four cooking serializers each have their own, while both smithing serializers share smithing.
RECIPE_TYPES
constRECIPE_TYPES: readonly ["minecraft:blasting","minecraft:brewing","minecraft:campfire_cooking","minecraft:crafting_decorated_pot","minecraft:crafting_dye","minecraft:crafting_imbue","minecraft:crafting_shaped","minecraft:crafting_shapeless","minecraft:crafting_special_bannerduplicate","minecraft:crafting_special_bookcloning","minecraft:crafting_special_firework_rocket","minecraft:crafting_special_firework_star","minecraft:crafting_special_firework_star_fade","minecraft:crafting_special_mapextending","minecraft:crafting_special_repairitem","minecraft:crafting_special_shielddecoration","minecraft:crafting_transmute","minecraft:smelting","minecraft:smithing_transform","minecraft:smithing_trim","minecraft:smoking","minecraft:stonecutting"]
Defined in: types.ts:9
Every recipe serializer Java 26.3 registers, read from net.minecraft.world.item.crafting.RecipeSerializers in the 26.3 server jar. Vanilla's 2042 recipe files use all 22.
SPECIAL_RECIPE_TYPES
constSPECIAL_RECIPE_TYPES: ("minecraft:blasting"|"minecraft:brewing"|"minecraft:campfire_cooking"|"minecraft:crafting_decorated_pot"|"minecraft:crafting_dye"|"minecraft:crafting_imbue"|"minecraft:crafting_shaped"|"minecraft:crafting_shapeless"|"minecraft:crafting_special_bannerduplicate"|"minecraft:crafting_special_bookcloning"|"minecraft:crafting_special_firework_rocket"|"minecraft:crafting_special_firework_star"|"minecraft:crafting_special_firework_star_fade"|"minecraft:crafting_special_mapextending"|"minecraft:crafting_special_repairitem"|"minecraft:crafting_special_shielddecoration"|"minecraft:crafting_transmute"|"minecraft:smelting"|"minecraft:smithing_transform"|"minecraft:smithing_trim"|"minecraft:smoking"|"minecraft:stonecutting")[]
Defined in: types.ts:42
The eight serializers whose logic lives in Java code rather than in the recipe file. Their JSON names the ingredients; what the craft produces is implemented here, in special.ts.
STATION_BY_TYPE
constSTATION_BY_TYPE:object
Defined in: types.ts:64
The station each serializer is matched at.
Type Declaration
minecraft:blasting
readonlyminecraft:blasting:"blasting"='blasting'
minecraft:brewing
readonlyminecraft:brewing:"brewing"='brewing'
minecraft:campfire_cooking
readonlyminecraft:campfire_cooking:"campfire_cooking"='campfire_cooking'
minecraft:crafting_decorated_pot
readonlyminecraft:crafting_decorated_pot:"crafting"='crafting'
minecraft:crafting_dye
readonlyminecraft:crafting_dye:"crafting"='crafting'
minecraft:crafting_imbue
readonlyminecraft:crafting_imbue:"crafting"='crafting'
minecraft:crafting_shaped
readonlyminecraft:crafting_shaped:"crafting"='crafting'
minecraft:crafting_shapeless
readonlyminecraft:crafting_shapeless:"crafting"='crafting'
minecraft:crafting_special_bannerduplicate
readonlyminecraft:crafting_special_bannerduplicate:"crafting"='crafting'
minecraft:crafting_special_bookcloning
readonlyminecraft:crafting_special_bookcloning:"crafting"='crafting'
minecraft:crafting_special_firework_rocket
readonlyminecraft:crafting_special_firework_rocket:"crafting"='crafting'
minecraft:crafting_special_firework_star
readonlyminecraft:crafting_special_firework_star:"crafting"='crafting'
minecraft:crafting_special_firework_star_fade
readonlyminecraft:crafting_special_firework_star_fade:"crafting"='crafting'
minecraft:crafting_special_mapextending
readonlyminecraft:crafting_special_mapextending:"crafting"='crafting'
minecraft:crafting_special_repairitem
readonlyminecraft:crafting_special_repairitem:"crafting"='crafting'
minecraft:crafting_special_shielddecoration
readonlyminecraft:crafting_special_shielddecoration:"crafting"='crafting'
minecraft:crafting_transmute
readonlyminecraft:crafting_transmute:"crafting"='crafting'
minecraft:smelting
readonlyminecraft:smelting:"smelting"='smelting'
minecraft:smithing_transform
readonlyminecraft:smithing_transform:"smithing"='smithing'
minecraft:smithing_trim
readonlyminecraft:smithing_trim:"smithing"='smithing'
minecraft:smoking
readonlyminecraft:smoking:"smoking"='smoking'
minecraft:stonecutting
readonlyminecraft:stonecutting:"stonecutting"='stonecutting'
Functions
assignNetIds()
assignNetIds(
recipes):ReadonlyMap<string,number>
Defined in: order.ts:43
Assigns a network id to every recipe, numbering the ordered list from FIRST_RECIPE_NET_ID. Adding a recipe renumbers every recipe that sorts after it, so a client that has cached ids has to be sent a fresh recipe list after a reload.
Parameters
recipes
readonly Recipe[]
Returns
ReadonlyMap<string, number>
compareRecipeIds()
compareRecipeIds(
left,right):number
Defined in: order.ts:21
Orders two recipe identifiers by namespace first, then by path, comparing code units rather than collating. localeCompare would put the same two recipes in different orders on different machines, and network ids that depend on the order have to be reproducible.
Parameters
left
string
right
string
Returns
number
compileRecipeBook()
compileRecipeBook(
book,mapper):RecipeCompileReport
Defined in: compile.ts:216
Compiles every recipe in a book, keeping the book's network ids.
Parameters
book
mapper
Returns
compileRecipes()
compileRecipes(
recipes,mapper):RecipeCompileReport
Defined in: compile.ts:151
Translates recipes to Bedrock identifiers through an injected mapper and numbers them from registry order.
Nothing is dropped silently. A reviewed loss keeps the recipe and is listed in losses. An identifier with no Bedrock item is listed in gaps; it costs the whole recipe only when it is the result or when it empties an ingredient, and those recipes are named in dropped.
Parameters
recipes
Iterable<Recipe>
Parsed recipes, or a RecipeBook's recipes list.
mapper
The Java-to-Bedrock item lookup, such as javaItemToBedrock from @jsprismarine/mapping.
Returns
createRecipeBook()
createRecipeBook(
recipes,context?):RecipeBook
Defined in: book.ts:39
Builds a recipe book from parsed recipes. Two recipes with the same identifier collapse to the last one given, which is how a later datapack overrides an earlier one.
Parameters
recipes
Iterable<Recipe>
context?
RecipeContext = EMPTY_CONTEXT
Injected registry lookups, passed on to every match.
Returns
cropGrid()
cropGrid(
grid):CroppedGrid
Defined in: grid.ts:37
Shrinks a grid to the bounding box of its filled slots. Every recipe matcher works on the cropped grid, so a recipe never has to describe where in the table the player placed its items.
Parameters
grid
Returns
filledSlots()
filledSlots(
grid): readonlyobject[]
Defined in: grid.ts:70
Every filled slot of a cropped grid, paired with its index inside that grid.
Parameters
grid
Returns
readonly object[]
gridAt()
gridAt(
grid,x,y):RecipeItemStack|null
Defined in: grid.ts:27
Reads the slot at a column and row, or null when the coordinates fall outside the grid.
Parameters
grid
x
number
y
number
Returns
RecipeItemStack | null
ingredientAccepts()
ingredientAccepts(
ingredient,stack):boolean
Defined in: ingredient.ts:196
Whether a stack satisfies the ingredient: its identifier is one the ingredient accepts and every component predicate holds. Count is not considered, because each ingredient consumes one item from its slot.
Parameters
ingredient
stack
RecipeItemStack | null
Returns
boolean
isEmptyIngredient()
isEmptyIngredient(
ingredient):boolean
Defined in: ingredient.ts:208
An ingredient that accepts nothing, which is what an unresolved tag leaves behind.
Parameters
ingredient
Returns
boolean
loadRecipes()
loadRecipes(
files,context?):RecipeLoadResult
Defined in: book.ts:176
Parses a set of recipe files and builds a book from the ones that read. A file with an error is left out and named in failed; the rest load, so one broken datapack file does not take the server down.
Parameters
files
Iterable<readonly [string, unknown]>
Recipe identifier to parsed recipe JSON, such as the recipesJava map @jsprismarine/packs produces.
context?
RecipeContext = EMPTY_CONTEXT
Returns
matchRecipe()
matchRecipe(
recipe,input,context?):RecipeMatch|undefined
Defined in: match.ts:249
Whether one recipe accepts one station input, and what it produces.
A crafting grid is cropped to the bounding box of its filled slots first, the way Java's CraftingInput is, so a recipe matches wherever in the table the player placed its items. Shaped patterns are then tried at every remaining offset and in both the written and the mirrored arrangement.
Parameters
recipe
input
context?
RecipeContext = EMPTY_CONTEXT
Injected registry lookups; RecipeContext says what each one enables.
Returns
RecipeMatch | undefined
The match, or undefined when the recipe does not accept the input.
normalizeIdentifier()
normalizeIdentifier(
id):string
Defined in: itemStack.ts:54
Prefixes a bare identifier with minecraft:. Java accepts both forms everywhere an identifier appears, and vanilla recipe files use the prefixed form throughout.
Parameters
id
string
Returns
string
orderRecipes()
orderRecipes(
recipes): readonlyRecipe[]
Defined in: order.ts:34
Sorts recipes into the order the registry publishes them in. The plan takes recipe network ids from registry order, so this order is the one thing in the package that a client sees indirectly: it has to be a pure function of the loaded identifiers and nothing else, which rules out load order, file system order and insertion order.
Parameters
recipes
Iterable<Recipe>
Returns
readonly Recipe[]
parseIngredient()
parseIngredient(
value,path,tags?):IngredientParseResult
Defined in: ingredient.ts:114
Parses one ingredient in any of the four forms Java 26.3 accepts: an item identifier, a #tag, a list of either, or an inline object naming an item plus component predicates.
Tag members come from tags; an unresolved tag contributes no items and raises a warning rather than throwing, because recipe files are untrusted input.
Parameters
value
unknown
path
string
Dotted path to the field, used in diagnostics.
tags?
Returns
parseRecipe()
parseRecipe(
id,source,tags?):RecipeParseResult
Defined in: parse.ts:237
Parses one Java recipe file into a Recipe. Handles all 22 of Java 26.3's serializers; an unknown type is reported as an error rather than throwing, because recipe files are untrusted input.
Ingredient tags resolve through tags at parse time, which is where Java resolves them too: a tag reload rebuilds the recipe set.
Parameters
id
string
The recipe's identifier, which is its datapack path without the extension.
source
unknown
The parsed recipe JSON.
tags?
Returns
rangeContains()
rangeContains(
range,value):boolean
Defined in: itemStack.ts:36
Whether value falls inside the inclusive range.
Parameters
range
value
number
Returns
boolean
recipeIngredients()
recipeIngredients(
recipe): readonly (Ingredient|null)[]
Defined in: types.ts:311
Every ingredient a recipe declares, in the order the compile step and the recipe book expose them. A shaped recipe yields its pattern cells in row-major order, with null for an empty cell; every other recipe yields its ingredient fields in the order the serializer declares them.
Parameters
recipe
Returns
readonly (Ingredient | null)[]
recipeResult()
recipeResult(
recipe):ItemStackTemplate|undefined
Defined in: types.ts:360
The result the recipe declares, or undefined when it has none to declare. The repair recipe names no result at all, and map cloning and map extending write "result": {} because the result is built from the input map.
Parameters
recipe
Returns
ItemStackTemplate | undefined
shapedPatternMatches()
shapedPatternMatches(
pattern,grid):boolean
Defined in: shaped.ts:47
Whether a shaped pattern matches a grid, trying every offset placement and both the written and the left-right mirrored arrangement, which is what Java's ShapedRecipePattern.matches does.
Pass the cropped grid: Java crops the crafting input to the bounding box of its filled slots before matching, which is what makes a 2x2 recipe work in any corner of a 3x3 table. The offset loop then only has room to move when the pattern is smaller than the cropped grid, which happens when the pattern itself has empty border cells.
Parameters
pattern
grid
Returns
boolean
stackFromTemplate()
stackFromTemplate(
template,id,count?):RecipeItemStack
Defined in: itemStack.ts:39
Builds a stack from a template, keeping the template's count and components.
Parameters
template
id
string
count?
number = template.count