Skip to content

Recipes Module

STBrian edited this page Nov 9, 2026 · 6 revisions

As the name says, here you'll find functions related to the crafting system of the game. Have you ever wanted to add a crafting recipe to the game? This is the module you need to use. For now you can only register crafting recipes, but, hopefully, in the future, other types of recipes will be added

Events

Game.Recipes.OnRegisterRecipes Triggered when the game is adding recipes

Types

RecipesTable Represents an access to game recipes list

Functions

Game.Recipes.registerShapedRecipe Allows to register a shaped crafting recipe

Game.Recipes.OnRegisterRecipes

This event will be triggered when the game is registering recipes. It also passes one argument to the listener

Game.Recipes.OnRegisterRecipes:Connect(function (arg1)
end)

RecipesTable arg1: Allows access to the game recipes list

Game.Recipes.registerShapedRecipe

Allows adding a shaped crafting recipe to the game. The shape dimensions determine whether the recipe requires a 3x3 Crafting Table or if it can be crafted in the player's 2x2 inventory grid.

Game.Recipes.registerShapedRecipe(resultItem, categoryId, position, line1, line2, line3, components)

Note: For backwards compatibility with older scripts, passing nil or a RecipesTable as the first argument is also supported: Game.Recipes.registerShapedRecipe(nil, resultItem, ...). The internal recipe registry is now managed automatically by LunaCore.

Parameters

  • MCItemInstance resultItem: The crafted output item, including its stack count and metadata/durability.
  • integer categoryId: The crafting book tab / category where the recipe is placed:
    • 1: Building Blocks
    • 2: Decoration Blocks
    • 3: Redstone & Transport
    • 4: Miscellaneous
    • 5: Food & Tools
    • 6: Combat
  • integer position: The sorting position index of the recipe within its category (can be positive or negative).
  • string line1: First row of the recipe pattern (up to 3 characters). Use spaces (" ") for empty slots.
  • string line2: Second row of the recipe pattern (up to 3 characters, or "" if unused).
  • string line3: Third row of the recipe pattern (up to 3 characters, or "" if unused).
  • table components: A list of pairs {{char_id, item_instance}, ...} mapping pattern characters to their corresponding MCItemInstance.

Crafting Grid Sizes

  • 2x2 Crafting Grid (Player Inventory): When line3 is empty ("") and both line1 and line2 have at most 2 characters. Players can craft these without a crafting table.
  • 3x3 Crafting Grid (Crafting Table): When line3 is specified or any row contains 3 characters. Requires the player to use a Crafting Table.

Example

Game.Recipes.OnRegisterRecipes:Connect(function()
    local wool = Game.Items.findItemByName("wool")
    local dye = Game.Items.findItemByName("dye")
    if wool and dye then
        local wool_white = Game.Items.getItemInstance(wool, 1, 0)
        local wool_orange = Game.Items.getItemInstance(wool, 1, 1)
        local bone_meal = Game.Items.getItemInstance(dye, 1, 15)
        
        -- Registers a 2x2 recipe: bone meal + orange wool -> white wool
        Game.Recipes.registerShapedRecipe(
            wool_white,
            6,
            2048,
            "X#",
            "",
            "",
            {
                {"X", bone_meal},
                {"#", wool_orange}
            }
        )
    end
end)

Clone this wiki locally