bedrock-kit
    Preparing search index...

    Class Recipe

    Represents a single recipe file from the behavior pack's recipes/ directory.

    Access via addon.recipes, addon.recipes.forItem(id), or item.recipes.

    const recipe = addon.recipes.forItem("minecraft:copper_spear")[0];
    console.log(recipe?.type); // "shaped"
    console.log(recipe?.result?.id); // "minecraft:copper_spear"
    console.log(recipe?.ingredients); // [Item, Item, ...]

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • id: string
      • filePath: string
      • data: Record<string, unknown>
      • rawText: string
      • addon: AddOn

      Returns Recipe

    Properties

    data: Record<string, unknown>

    The raw parsed JSON data of the asset file.

    docstrings: CommentBlock[]

    All JSDoc-style comment blocks parsed from this asset's source file, in document order. Empty array when no /** … */ blocks are present.

    filePath: string

    Absolute path to the asset's file on disk. Empty string in browser mode.

    id: string

    The recipe identifier from description.identifier, e.g. "minecraft:copper_spear". Falls back to the filename without extension if the field is absent.

    The recipe type.

    Accessors

    • get ingredients(): (Item | Tag)[]

      All resolved ingredients as a flat array of Item or Tag instances. For shaped recipes the grid is flattened; empty slots are excluded.

      Returns (Item | Tag)[]

    • get item(): Item

      The item this recipe produces, or undefined if the result is not in this addon (e.g. a vanilla item) or the recipe has no result. Shortcut for recipe.result?.item.

      Returns Item

    Methods

    • Shaped: resolves the pattern into a 2D grid of Item | Tag | null. Returns undefined if this is not a shaped recipe.

      Returns Ingredient[][]

    • Returns true if this recipe uses the given item identifier as an ingredient.

      Parameters

      • id: string

      Returns boolean