search

linkRecipes

To create recipes with Kore, you can utilize the framework's built-in functions to define various types of recipes for your Minecraft data packs. Here's a comprehensive guide on how to create different recipes using Kore:

linkSet Up Your Data Pack Function

Begin by creating a function within your DataPack where you'll define your recipes:

fun DataPack.createRecipes() {
    // Your recipe definitions will go here
}
Kotlin

linkInitialize the Recipes Block

Use the recipes block to start defining your recipes:

recipes {
    // Define individual recipes here
}
Kotlin

linkCreating a Blasting Recipe

To create a blasting recipe, use the blasting function:

blasting("unique_recipe_name") {
    ingredient {
        // Define the ingredient item or tag
        item = Items.IRON_ORE
        // or
        tag = Tags.Item.ORES
    }
    result = itemStack(Items.IRON_INGOT) {
        // Optionally modify the result item (e.g., set damage)
        damage(0)
    }
    experience = 0.7  // Set the experience rewarded
    cookingTime = 100 // Set the cooking time in ticks
}
Kotlin

Note that campfire, smelting, and smoking recipes can be defined similarly using the respective functions.

linkCrafting Shaped Recipes

For crafting recipes with a specific shape:

craftingShaped("unique_recipe_name") {
    pattern(
        " A ", // It's a common pattern to format recipe patterns like this, to make them more readable
        " B ",
        " C "
    )
    keys {
        "A" to Items.DIAMOND
        "B" to Items.STICK
        "C" to Items.GOLD_INGOT
    }
    result(Items.DIAMOND_SWORD)
}
Kotlin

linkCrafting Shapeless Recipes

For recipes where the arrangement doesn't matter:

craftingShapeless("unique_recipe_name") {
    ingredient(Items.WHEAT)
    ingredient(Items.WHEAT)
    ingredient(Items.WHEAT)
    ingredient(Items.SUGAR)
    ingredient(Items.EGG)
    ingredient(Items.EGG)

    result(Items.CAKE)
}
Kotlin

linkSpecial Crafting Recipes

In addition to standard crafting recipes, crafting special recipes leverage built-in game logic to handle complex crafting operations that regular data-driven recipes cannot manage. These special recipes are essential for functionalities that require handling NBT (Named Binary Tag) data, multiple inputs, or specific item interactions. They are particularly useful when the "vanilla" data pack is disabled, allowing you to re-enable and customize desired built-in crafting behaviors.

linkAvailable Special Recipe Types

Here is a list of available special recipe types and their functionalities:

  • armordye: Dyeing armor with multiple dyes.
  • bannerduplicate: Copying NBT data from one banner to another.
  • bookcloning: Cloning written books, including their NBT data.
  • firework_rocket: Crafting firework rockets with flexible inputs and NBT data from firework stars.
  • firework_star: Crafting firework stars and adding fade colors.
  • firework_star_fade: Adding fade colors to firework stars.
  • mapcloning: Copying maps along with their NBT data.
  • mapextending: Zooming maps by updating their NBT data.
  • repairitem: Repairing items by updating their damage data.
  • shielddecoration: Applying shield patterns using banner NBT data.
  • shulkerboxcoloring: Dyeing shulker boxes while preserving their NBT data.
  • tippedarrow: Crafting tipped arrows with NBT data from lingering potions.
  • suspiciousstew: Creating suspicious stew with specific status effects based on flower types.

linkDefining a Special Recipe

To define a special crafting recipe, use the craftingSpecial function with the specific type and relevant parameters. Below are examples of how to define some of the special recipes:

craftingSpecial("custom_armor_dye", CraftingSpecialArmorDye) {}
Kotlin

linkSmithing Transform Recipes

To create a smithing transformation recipe:

smithingTransform("unique_recipe_name") {
    template(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE)
    base(Items.DIAMOND_SWORD)
    addition(Items.NETHERITE_INGOT)
    result(Items.NETHERITE_SWORD)
}
Kotlin

linkSmithing Trim Recipes

For smithing trim recipes:

smithingTrim("unique_recipe_name") {
    template(Items.SMITHING_TEMPLATE)
    base(Items.IRON_CHESTPLATE)

    addition(Items.GOLD_INGOT)
}
Kotlin

linkStonecutting Recipes

To define a stonecutting recipe:

stoneCutting("unique_recipe_name") {
    ingredient(Items.STONE)

    result = Items.STONE_SLAB
    count = 2
}
Kotlin

linkDefining Ingredients

Ingredients can be items or tags, and you can define them as follows:

ingredient {
    item = Items.COBBLESTONE
    // or
    tag = Tags.Item.COBBLESTONE
}
Kotlin

You also have a shorter form for defining an ingredient:

ingredient(Items.COBBLESTONE)
// or
ingredient(tag = Tags.Item.COBBLESTONE)
Kotlin

linkSetting the Result

When specifying the result of a recipe:

result = Items.ENCHANTED_BOOK {
    enchantments {
        enchantment(Enchantments.SHARPNESS, 5)
    }
}
Kotlin

linkUsing Keys in Shaped Recipes

Map characters in your pattern to specific items:

keys {
    "S" to Items.STICK
    "D" to Items.DIAMOND
}
Kotlin

linkAdding Experience and Cooking Time

For recipes that require cooking:

experience = 0.35  // The amount of experience the recipe yields
cookingTime = 200  // The time in ticks it takes to cook
Kotlin

linkLoading and Giving Recipes

To load the recipes and make them available:

load {
    recipeGive(allPlayers(), yourRecipeArgument)
}
Kotlin

linkUtilizing Built-in Recipe Types

Kore provides a variety of built-in recipe types through RecipeTypes:

  • RecipeTypes.BLASTING
  • RecipeTypes.CAMPFIRE_COOKING
  • RecipeTypes.CRAFTING_SHAPED
  • RecipeTypes.CRAFTING_SHAPELESS
  • RecipeTypes.CRAFTING_SPECIAL
  • RecipeTypes.SMELTING
  • RecipeTypes.SMITHING_TRANSFORM
  • RecipeTypes.SMITHING_TRIM
  • RecipeTypes.SMOKING
  • RecipeTypes.STONECUTTING

linkCustom Components

You can customize items using components, but for now Minecraft only allows components on results:

Items.DIAMOND_SWORD {
    damage(10)
    enchantments {
        enchantment(Enchantments.UNBREAKING, 3)
    }
}
Kotlin

linkFull Example

Here's a full example putting it all together:

fun DataPack.createRecipes() {
    recipes {
        craftingShaped("diamond_sword_upgrade") {
            pattern(
                " E ",
                " D ",
                " S "
            )
            keys {
                "E" to Items.EMERALD
                "D" to Items.DIAMOND_SWORD
                "S" to Items.NETHERITE_INGOT
            }
            result = Items.NETHERITE_SWORD {
                enchantments {
                    enchantment(Enchantments.SHARPNESS, 5)
                }
            }
        }
    }
}
Kotlin

linkReference Recipes in Commands

To reference recipes in commands, you can use the recipeBuilder property and store the recipe inside a variable:

val myRecipe = recipeBuilder.craftingShaped("experience_bottle") {
    pattern(
        " G ",
        "GBG",
        " G "
    )
    keys {
        "G" to Items.GOLD_BLOCK
        "B" to Items.GLASS_BOTTLE
    }
    result(Items.EXPERIENCE_BOTTLE)
}

load {
    // Give the recipe to all players
    recipeGive(allPlayers(), myRecipe)
}
Kotlin

linkAdditional Tips

  • Grouping Recipes: You can assign a group to recipes, prefer using it when recipes have the same result.
  • Tags: Use tags to reference multiple items sharing the same tag.
  • Components: Modify result items with components like damage, enchantments, etc.

All recipes are stored inside Datapack.recipes list, if you ever need to access them programmatically.

By following this guide, you can create complex and customized recipes in your Minecraft data pack using the Kore framework. Be sure to explore the Kore documentation and source code further to take full advantage of its capabilities.