๐ณ Recipe
Preparationโ
Here's what you need to understand before setting up new recipes. These tips will make configuration easier and reveal extra helpful functionality.
Tagโ
CraftEngine allows you to use tags, and you can also create custom tags. To use a tag, simply follow this format: #namespace:tag
.
Most crafting plugins share a common pain pointโthey do not support assigning tags to items, nor do they allow the use of tags in recipes. For example, if you want newly created plank types to be mixed and used with vanilla planks in crafting recipes, itโs simply impossible to achieve
In the following example, I have added two vanilla tags to palm_planks
, allowing them to participate in all recipes within data packs that contain these two tags.
items:
default:palm_planks:
material: paper
custom-model-data: 1004
settings:
fuel-time: 300
tags:
- "minecraft:planks"
- "minecraft:wooden_tool_materials"
data:
item-name: "<!i>Palm Planks"
#minecraft:planks
#minecraft:wooden_tool_materials
Group / Categoryโ
recipes:
default:palm_planks:
type: shapeless
category: building
group: planks
ingredients:
A: "#default:palm_logs"
result:
id: default:palm_planks
count: 4
The group
determines which group this recipe belongs to after it is unlocked on the client side. The group
can be any name you choose freely. However, please avoid using illegal characters.
group
The category
determines which tab this recipe is located in within the recipe book. The category
type is limited.
category
- For cooking-type recipes, the options are
food
,blocks
, andmisc
. - For crafting-type recipes, the options are
building
,redstone
,equipment
, andmisc
.
Compatibility with Other Pluginsโ
First, add the supported plugins to this list in config.yml
:
recipe:
ingredient-sources:
- MythicMobs
Supported item sources can be found on ๐ฆ๏ธ External Item Sources. You can also register your own item source through API.
Next, you must map each external item source to its CraftEngine equivalent. See the example configuration below for reference:
items:
mythicmobs:kingscrown:
material: golden_helmet
data:
external:
plugin: MythicMobs
id: KingsCrown
settings:
tags:
- add_tag:if_you_want
After that, simply create recipes for this item just like you would with any regular item.
recipes:
default:bench:
type: shaped
pattern:
- A A
- A A
ingredients:
A: mythicmobs:kingscrown
result:
id: default:bench
count: 1
For any items used as ingredients, you have to make sure their namespace in CraftEngine is the plugin name in lowercase, and the ID should also be in lowercase. Let me give you a few examples so you can see how this works:
- Item named 'MySword' in MythicMobs ->
mythicmobs:mysword
- Item named 'star_fish' in CustomFishing ->
customfishing:star_fish
- Item named 'MAGIC_GEM' with 'MATERIAL' type in MMOItems ->
mmoitems:material_magic_gem
- Item with namespaced id in a RANDOM plugin ->
random_plugin:namespace_id
Result Post Processorโ
The Result Post Processor is a concept introduced to address recipe diversification needs. For example, if you want to craft a pickaxe but wish the output to have enchantments, it would be impractical to create a separate recipe for the enchanted item.
result:
id: default:topaz_pickaxe
count: 1
post-processors:
- type: apply_data
data:
enchantments:
minecraft:efficiency: 5
So far, there's only the apply_data type of post-processor. But you can register new ones using the API.
Visual Resultโ
Concept Stage Not ImplementedYou'll notice the plugin retains a feature called visual-result. This allows displaying a unique item during the crafting process, effectively preventing players from anticipating randomized recipe outputs in advance.
result:
id: default:topaz_pickaxe
count: 1
post-processors:
- type: apply_data
data:
enchantments:
minecraft:efficiency: 5
visual-result:
id: default:random_icon
Recipe Typesโ
Important Notice:
To reload recipes, you must use either /ce reload recipe
or /ce reload all
. If you're running a Folia server, you can only use /ce reload recipe
.
After reloading the datapacks, please reload the recipes, otherwise the registered recipes will become invalid.
Warning for Folia Servers:
This operation is highly unsafe! Folia's recipe manager is not thread-safe, and reloading recipes during runtime may cause server crashes.
Shaped Crafting Recipeโ
recipes:
default:topaz_shovel:
type: shaped
pattern:
- "A"
- "B"
- "B"
ingredients:
A: "default:topaz"
B: "minecraft:stick"
result:
id: default:topaz_shovel
count: 1
recipes:
default:chinese_lantern:
type: shaped
pattern:
- "ABA"
- "BCB"
- "ABA"
ingredients:
A: "#minecraft:planks"
B: "minecraft:stick"
C: "minecraft:torch"
result:
id: default:chinese_lantern
count: 1
Shapeless Crafting Recipeโ
recipes:
default:palm_planks:
type: shapeless
category: building
group: planks
ingredients:
- "#default:palm_logs"
# nested list is also supported
- - test:ingredient1
- test:ingredient2
result:
id: default:palm_planks
count: 4
Cooking Recipeโ
Cooking Recipe includes smelting
, blasting
, smoking
, and campfire_cooking
. Regardless of the type, the configuration format remains the same.
recipes:
default:topaz_from_smelting_topaz_ore:
type: smelting
experience: 1.0
category: misc
group: topaz
time: 200
ingredient: "default:topaz_ore"
result:
id: default:topaz
count: 1
default:topaz_from_smelting_deepslate_topaz_ore:
type: smelting
experience: 1.0
category: misc
group: topaz
time: 200
ingredient: "default:deepslate_topaz_ore"
result:
id: default:topaz
count: 1
Stone Cutting Recipeโ
recipes:
default:stonecutting_example:
type: stonecutting
group: topaz
ingredient: "minecraft:stone"
result:
id: default:topaz
count: 1
Stone Cutting Recipe is a somewhat unique recipe type. I do not recommend using custom items as ingredients, as this is highly likely to cause significant client-side visual issues.
Smithing Transform Recipeโ
default:topaz_bow:
type: smithing_transform
template-type: default:topaz # slot 1 (Optional)
base: minecraft:bow # slot 2 (Required)
addition: default:topaz # slot 3 (Optional)
# merge two items' components like what vanilla does
merge-components: true # default: true
result:
id: default:topaz_bow
count: 1
# see the guide below
post-processors: []
If you need more precise control over which components are preserved, you should specify a post-processor as shown below.
Important: Do not confuse this with result post processor - these are completely different systems.
post-processors:
# Keep the specified components (1.20.5+)
- type: keep_components
components:
- minecraft:enchantments
# Keep the specified nbt tags (1.20-1.20.4)
- type: keep_tags
tags:
- display.Name
- CustomModelData
Smithing Trim Recipeโ
default:bolt_tool_trims:
type: smithing_trim
template-type: "minecraft:bolt_armor_trim_smithing_template"
base: "#minecraft:trimmable_tool"
addition: "#minecraft:trim_materials"
pattern: minecraft:bolt # required on 1.21.5+
Brewing Recipeโ
1.20.2+tea_art:tea:
type: brewing
ingredient: tea_art:tea_leaf
container: tea_art:cup
result:
id: tea_art:cup_of_tea
count: 1