3
Creating custom items with datapacks
Hi guys! I recently wanted to make my own datapack. I wanted to add "Strong Netherite Tools", crafted from netherite blocks, but im stuck at creating the custom items. Can you help me? Here is the code of the JSON file:
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "starter:strong_netherite_sword",
"functions": [
{
"function": "minecraft:set_lore",
"entity": "this",
"lore": [
{
"text": "Strong sword made out of",
"color": "grey"
},
{
"text": "compressed metal from hell",
"color": "grey"
}
]
},
{
"function": "minecraft:set_name",
"entity": "this",
"name": "Strong Netherite Sword"
},
{
"function": "minecraft:set_damage",
"damage": 16
}
]
}
]
}
]
}
Here is the datapack folders:
My Datapack:
data:
minecraft:
tags:
functions: load.json, tick.json
starter:
functions: init.mcfunction, main.mcfunction
tags:
items: strong_netherite_sword.json // File where code of the above is stored
pack.mcmeta
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "starter:strong_netherite_sword",
"functions": [
{
"function": "minecraft:set_lore",
"entity": "this",
"lore": [
{
"text": "Strong sword made out of",
"color": "grey"
},
{
"text": "compressed metal from hell",
"color": "grey"
}
]
},
{
"function": "minecraft:set_name",
"entity": "this",
"name": "Strong Netherite Sword"
},
{
"function": "minecraft:set_damage",
"damage": 16
}
]
}
]
}
]
}
Here is the datapack folders:
My Datapack:
data:
minecraft:
tags:
functions: load.json, tick.json
starter:
functions: init.mcfunction, main.mcfunction
tags:
items: strong_netherite_sword.json // File where code of the above is stored
pack.mcmeta
11
use this tutorial
For crafting, Either use knowledge book crafting, or swap_recipe crafting (whoch i do not reccomend unless this is a map or something, as it has to texture an existing item), or custom crafting table using dropper/dispenser, or floor crafting where you drop items on the ground
Sorry, Custom Model Data, custom tags, display names with italics set to false, are work arounds we use to add custom items using vanilla item, you can't just add a custom item using a loot table.
Well I want to create a custom recipe for this item but custom recipes do not allow CustomModelData
You can use a texture-pack :)
But I don't know how to make recipe with changed CustomModelData
There's a workaround for this where you have the recipe give something like a knowledge book, detecting when a player crafts it (I think you'd need an advancement with a recipe_unlocked criterion for this, but I'm not sure), and then replacing the knowledge book using clear and give
You cannot just add custom items. Any datapacks with "custom items" are using workarounds to make vanilla items appear differently.
In other words, you just use minecraft:netherite_sword, and if you want to use a different texture for it you'll have to use CustomModelData
Precisely.
