Skip to main content

Recipes

Module used to manipulate crafting recipes for vanilla and custom workbenches.

Index

Functions

addFurnace

  • addFurnace(sourceId: number, sourceData: number, resultId: number, resultData: number, prefix?: string): void
  • addFurnace(sourceId: number, resultId: number, resultData: number, prefix?: string): void
  • Adds new furnace recipe.


    Parameters

    • sourceId: number

      source item ID

    • sourceData: number

      source item data

    • resultId: number

      resulting item ID

    • resultData: number

      resulting item data

    • optionalprefix: string

      prefix, used to create recipes for non-vanilla furnaces

    Returns void

addFurnaceFuel

  • addFurnaceFuel(id: number, data: number, time: number): void
  • Adds fuel that can be used in the furnace.


    Parameters

    • id: number

      fuel item ID

    • data: number

      fuel item data

    • time: number

      burning time in ticks

    Returns void

addShaped

  • Adds new shaped crafting recipe.

    Learn how to use
    Recipes.addShaped({ id: 264, count: 1, data: 0 }, [
    "ax",
    "xa",
    "ax"
    ], ['x', 265, 0, 'a', 266, 0]);
    More about capabilities

    Pickaxe recipe should look like this:

    "+++"
    " | "
    " | "

    Do not use empty lines or line endings, if the recipe can be placed within less then three rows or cols; e.g., to craft plates, you can use a shape like this:

    "--"

    Parameters

    • result: ItemInstance

      recipe result item

    • mask: string[]

      recipe shape, up to three string corresponding to the three crafting field rows; each character means one item in the field

    • data: (string | number)[]

      an array explaining the meaning of each character within mask. The array should contain three values for each symbol: the symbol itself, item ID and item data.

    • optionalfunc: CraftingFunction

      function to be called when the craft is processed

    • optionalprefix: string

      recipe prefix. Use a non-empty values to register recipes for custom workbenches

    Returns WorkbenchShapedRecipe

addShaped2

  • Same as Recipes.addShaped, but you can specify result as three separate values corresponding to ID, count and data.


    Parameters

    • id: number
    • count: number
    • aux: number
    • mask: string[]
    • data: (string | number)[]
    • optionalfunc: CraftingFunction
    • optionalprefix: string

    Returns WorkbenchShapedRecipe

addShapedGeneric

addShapedVanilla

addShapeless

  • Adds new shapeless crafting recipe.

    Learn how to use
    Recipes.addShapeless({ id: 264, count: 1, data: 0 }, [
    { id: 265, data: 0 }, { id: 265, data: 0 }, { id: 265, data: 0 },
    { id: 266, data: 0 }, { id: 266, data: 0 }, { id: 266, data: 0 }
    ]);

    Parameters

    • result: ItemInstance

      recipe result item

    • data: { data: number; id: number }[]

      crafting ingredients, an array of objects representing item ID and data

    • optionalfunc: CraftingFunction

      function to be called when the craft is processed

    • optionalprefix: string

      recipe prefix; use a non-empty values to register recipes for custom workbenches

    Returns WorkbenchShapelessRecipe

addShapelessGeneric

addShapelessVanilla

deleteRecipe

  • Deletes recipe by it's result.


    Parameters

    Returns void

getAllFurnaceRecipes

getAllWorkbenchRecipes

getFuelBurnDuration

  • getFuelBurnDuration(id: number, data: number): number
  • Parameters

    • id: number
    • data: number

    Returns number

    Fuel burn duration by fuel item ID and data.

getFurnaceRecipeResult

  • getFurnaceRecipeResult(id: number, data: number, prefix?: string): ItemInstance
  • Parameters

    • id: number
    • data: number
    • optionalprefix: string

      recipe prefix used for non-vanilla furnaces

    Returns ItemInstance

    Furnace recipe resulting item.

getFurnaceRecipesByResult

  • Gets furnace recipes by result and custom prefix.


    Parameters

    • resultId: number

      result item ID

    • resultData: number

      result item data

    • prefix: string

      recipe prefix used for non-vanilla furnaces

    Returns java.util.Collection<FurnaceRecipe>

    Collection object with all furnace recipes found by given params.

getRecipeByField

getRecipeResult

  • Gets recipe result item by the field and recipe prefix.


    Parameters

    • field: WorkbenchField

      WorkbenchField object containing crafting field information

    • optionalprefix: string

      recipe prefix, defaults to empty string (vanilla workbench)

    Returns Nullable<ItemInstance>

getWorkbenchRecipesByIngredient

getWorkbenchRecipesByResult

provideRecipe

  • Performs crafting by the field contents and recipe prefix.


    Parameters

    • field: WorkbenchField

      WorkbenchField object containing crafting field information

    • optionalprefix: string

      recipe prefix, defaults to empty string (vanilla workbench)

    Returns Nullable<ItemInstance>

provideRecipeForPlayer

  • Performs crafting by the field contents and recipe prefix for a player.


    Parameters

    • field: WorkbenchField

      WorkbenchField object containing crafting field information

    • prefix: string

      recipe prefix, defaults to empty string (vanilla workbench)

    • playerUid: number

      player which performs crafting

    Returns Nullable<ItemInstance>

removeFurnaceFuel

  • removeFurnaceFuel(id: number, data: number): void
  • Removes furnace fuel by fuel item ID and data.


    Parameters

    • id: number
    • data: number

    Returns void

removeFurnaceRecipe

  • removeFurnaceRecipe(sourceId: number, sourceData: number): void
  • Removes furnace recipes by source item.


    Parameters

    • sourceId: number

      source item ID

    • sourceData: number

      source item data

    Returns void

removeWorkbenchRecipe

  • removeWorkbenchRecipe(id: number, count: number, data: number): void
  • Removes recipe by result ID, count and data.


    Parameters

    • id: number
    • count: number
    • data: number

    Returns void