By Mateusz Jasiński · Updated
Add custom crafting recipes to a Paper server
Filedata/myserver/recipe/diamond_block_pickaxe.jsonFiledata/myserver/recipe/torches_from_coal.jsonCommand/recipe takeCommand/recipe giveThere are three ways to give a Paper server its own crafting recipes. A data pack adds or replaces recipes with a few JSON files and no plugin at all. A plugin can register recipes in code through the Bukkit API. And a crafting plugin handles what the other two cannot do on their own: recipes a player has to earn first, and crafted items that do something when used. To stop players crafting a vanilla item, the limited_crafting game rule together with /recipe take is the built-in way.
Pick the method
| You want | Use |
|---|---|
| A few extra recipes, everyone can craft them | A data pack |
| Change or replace a vanilla recipe | A data pack, overriding the file in the minecraft namespace |
| Lock recipes until a player unlocks them | limited_crafting and /recipe, or a plugin |
| Recipes tied to quests, ranks or progress | A plugin |
| Items with abilities, cooldowns or charges | A plugin |
A data pack recipe
Paper runs the vanilla data pack system, so a recipe data pack works the same as in singleplayer. The pack goes in the world's datapacks folder:
world/datapacks/myrecipes/
pack.mcmeta
data/myserver/recipe/
diamond_block_pickaxe.json
torches_from_coal.jsonThe folder is recipe, singular, since 1.21. On older versions it was recipes.
Config keypack.mcmetapack.mcmeta says which game versions the pack is for. Since 1.21.9 it uses min_format and max_format:
{
"pack": {
"description": "Server recipes",
"min_format": 94,
"max_format": 121
}
}| Version | Data pack format |
|---|---|
| 1.21.9, 1.21.10 | 88 |
| 1.21.11 | 94.1 |
| 26.1 to 26.1.2 | 101.1 |
| 26.2 | 107.1 |
| 26.3 | 121 |
Set min_format to your server's version and leave room in max_format for the next update. A pack that also has to load on 1.21.8 or older needs pack_format and supported_formats as well; the pack.mcmeta page has the full rules.
A shaped recipe:
{
"type": "minecraft:crafting_shaped",
"category": "equipment",
"pattern": ["DDD", " S ", " S "],
"key": {
"D": "minecraft:diamond_block",
"S": "minecraft:stick"
},
"result": { "id": "minecraft:diamond_pickaxe", "count": 1 }
}A shapeless one, where a tag and a list of alternatives count as one ingredient each:
{
"type": "minecraft:crafting_shapeless",
"ingredients": ["#minecraft:planks", "minecraft:flint", ["minecraft:coal", "minecraft:charcoal"]],
"result": { "id": "minecraft:torch", "count": 8 }
}The rules that trip people up:
- Ingredients are plain strings since 1.21.2.
"minecraft:stick"for an item and"#minecraft:planks"for a tag. The old{"item": "..."}and{"tag": "..."}objects no longer load. A list of items is allowed, but a tag inside such a list is not. - No air.
minecraft:airis never an ingredient; use a space in the pattern for an empty slot. - Three rows at most, all the same length.
- The result is an object with
idand an optionalcountandcomponents.
Config keypack.mcmetaRun /reload and the recipes are there. /datapack list shows whether the pack is enabled. If it is not, check pack.mcmeta and the server log first; a format range that leaves out your version is the usual reason.
Replace a vanilla recipe
Filedata/minecraft/recipe/torch.jsonA file with the same path as the vanilla one wins. To change the vanilla torch recipe, put your version at data/minecraft/recipe/torch.json in your pack. When two packs have the same file, the one loaded last wins, so check the order with /datapack list.
Lock recipes without a plugin
Vanilla has a game rule that only lets players craft recipes they have unlocked. In 1.21.11 the game rules were renamed to snake_case, and doLimitedCrafting became:
/gamerule limited_crafting trueCommand/recipe giveCommand/recipe takeWith it on, /recipe give <player> <recipe> makes a recipe craftable for that player and /recipe take <player> <recipe> locks it again. * in place of the recipe means every recipe. Both need permission level 2.
The catch is that vanilla also hands out recipes through advancements, the hidden ones under data/minecraft/advancement/recipes/ that fire when a player picks up the right item. A recipe you took can come back the next time that happens. For a recipe that has to stay locked, override its advancement in your data pack too, or use a plugin that decides unlocks itself.
Recipes from plugin code
A plugin registers recipes in onEnable:
NamespacedKey key = new NamespacedKey(this, "diamond_block_pickaxe");
ShapedRecipe recipe = new ShapedRecipe(key, ItemStack.of(Material.DIAMOND_PICKAXE));
recipe.shape("DDD", " S ", " S ");
recipe.setIngredient('D', Material.DIAMOND_BLOCK);
recipe.setIngredient('S', Material.STICK);
getServer().addRecipe(recipe);On current Paper addRecipe sends the new recipe to everyone online by itself; the addRecipe(recipe, true) overload is deprecated and its flag ignored. A recipe still has to be discovered before it shows in a player's recipe book, with player.discoverRecipe(key). setIngredient also takes a RecipeChoice for "any of these items" or an exact item.
Quest-locked crafts with Ignite Crafts
When the recipe itself is the reward, the work moves from writing recipes to tracking progress per player, keeping it across restarts and showing players what they are working towards. Ignite Crafts is our plugin for that, on Paper and Folia 1.21 and newer. Each craft is tied to a quest; players finish the quest and the recipe opens for them.
Filecrafts.ymlA craft in crafts.yml, from the Survival pack the plugin ships:
crafts:
sv_harvest_scythe:
display-name: "<#7CFF9B>Harvest Scythe"
material: NETHERITE_HOE
action: HARVEST_AREA
cooldown-seconds: 10
quest: sv_q_harvest
recipe:
shape:
- "AAA"
- " B "
- " B "
ingredients:
A: IRON_INGOT
B: STICK
settings:
radius: 4Filequests.ymlAnd the quest that unlocks it, in quests.yml:
quests:
sv_q_harvest:
display-name: "<#7CFF9B>Field Hand"
description: "Break 100 blocks across the farm."
type: BLOCK_BREAK
target: 100
reward-crafts: [ sv_harvest_scythe ]The recipe is registered with the server like any other, and blocked per player until the quest is done. The crafted item runs its action on right-click, here harvesting the grown crops within 4 blocks, with the cooldown from the craft.
What else is in it, without writing YAML:
- Command/crafts setup
/crafts setupinstalls a ready-made pack, Survival, UHC / PvP, Skyblock or RPG, merged into your files without overwriting your own ids. - Command/crafts editor
/crafts editorbuilds crafts in a menu with a live 3x3 grid and a material browser, and quests with their type, target, reward crafts and prerequisites. A recipe that does not validate is rolled back instead of breaking the live config. - Quest types for kills, mining, placing, fishing, brewing, play time, distance walked and more, with
filtersto limit a quest to certain blocks or mobs, andrequiresto chain quests into a tree. - Command/crafts codex
/crafts codexshows every craft, which ones a player owns and how rare each is on the server. - Command/crafts preview
/crafts preview <craft>fires a craft's action at once, with no cooldown or cost, for testing. - Storage in YAML, SQLite or MySQL; MySQL keeps progress across a BungeeCord or Velocity network.
The full feature list, the version support and the price are on the product page. For gear that does more than one action, with set bonuses, gems and levels, see Ignite EquipmentPro. If potion effects from a worn or held item are all you need, EquipmentEffects does that for free, next to our other free plugins. The paid ones are all on the catalog.
Troubleshooting
| Symptom | Check |
|---|---|
The pack does not show in /datapack list | It is not in the world's datapacks folder, or pack.mcmeta is not at its root |
| The pack is listed but not enabled | min_format and max_format do not cover your version; the log says why |
| The pack loads, the recipe does nothing | Old ingredient format, a typo in an item id, or a file outside data/<namespace>/recipe/. The server log names the file that failed |
| A vanilla recipe still works after the override | Your file's path does not match the vanilla one exactly, or another pack loads after yours |
| Players can craft a recipe you took | limited_crafting is off, or an advancement gave the recipe back |
| A plugin recipe is missing from the recipe book | It was never discovered for that player |