#Stupid Function not working
1 messages · Page 1 of 1 (latest)
💬 While you wait, take this time to provide more context and details.
🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
pls help because i am frautated
For 1.20+
This guide assumes that you already have the knowlege of some basic commands as well as on how crafting recipes and advancements work.
Text in between `<>`` is aplaceholder for your namespaces and filepaths
To create a crafting recipe for one of your custom items, you need just a little bit more than for a normal recipe.
Becasue of the fact that you can't use nbt in a recipe, we need a small workaround.
Lets add the recipe first:
rocket.json
{
"type": "minecraft:crafting_shaped",
"pattern": [
" I ",
" I ",
"O O"
],
"key": {
"I": {
"item": "minecraft:iron_block"
},
"O": {
"item": "minecraft:obsidian"
}
},
"result": {
"item": "minecraft:knowledge_book"
}
}
As mentione before, we can't use the custom item as output, so we use a knowledge book as a placeholder.
To switch the knowledge book with our custom item, we need an advancement to react when we craft the recipe. For this we use the recipe_crafted trigger.
With some trickery it is also possible to make the ingredients require certain nbt.
craft_rocket.json
{
"criteria": {
"requirement": {
"trigger": "minecraft:recipe_crafted",
"conditions": {
"recipe_id": "<namespace>:rocket"
}
}
},
"rewards": {
"function": "<namespace>:craft_rocket"
}
}
Last but not least we have to make the function that deals with the item switching.
You can either use a give command or, what I recommend more, define the item in a seperate loot table and use the loot command.
craft_rocket.mcfunction
clear @s knowledge_book
loot give @s loot <namespace>:<rocket_item_loot_table>
advancemt revoke @s only <namespace>:craft_rocket
This is all you need to create a crafting recipe for your custom items.
Mimetype application/vnd.rar is not supported!
if you can zip it as a .zip then we can look at your pack more easily
make sure you revoke the advancement after you give the item
^^
