3

Creating custom items with datapacks

FicaGaming99 2/8/21 7:44 am
17.2k
12/8/2021 2:31 am
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
Posted by
FicaGaming99
Level 1 : New Miner
0

  Have something to say?

JoinSign in

11

Gabriel_Lim
12/08/2021 2:30 am
Level 10 : Journeyman Skinner
1
Gabriel_Lim
12/08/2021 2:31 am
Level 10 : Journeyman Skinner
use this tutorial
1
Jayfin
02/10/2021 8:01 am
Level 23 : Expert Procrastinator
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
1
Jayfin
02/10/2021 7:57 am
Level 23 : Expert Procrastinator
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.
1
FicaGaming99
02/09/2021 7:03 am
Level 1 : New Miner
Well I want to create a custom recipe for this item but custom recipes do not allow CustomModelData
1
Wannabe TommyInnit
02/09/2021 7:57 am
Level 41 : Master Magical Boy
You can use a texture-pack :)
1
FicaGaming99
02/09/2021 12:09 pm
Level 1 : New Miner
But I don't know how to make recipe with changed CustomModelData
2
Stalkative
02/10/2021 7:54 am
Level 29 : Expert Geek
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
2
Hashs
02/08/2021 8:30 am
Any/All • Level 68 : High Grandmaster Botanist Procrastinator
You cannot just add custom items. Any datapacks with "custom items" are using workarounds to make vanilla items appear differently.
2
Stalkative
02/08/2021 9:56 am
Level 29 : Expert Geek
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
4
Hashs
02/08/2021 10:16 am
Any/All • Level 68 : High Grandmaster Botanist Procrastinator
Precisely.
1

Welcome