You need to create a so called datapack
. A datapack is a folder structure that contains recipes, advancements, loot tables and more.
These are the steps for your loot table:
- Go to
.minecraft/saves/yourworld/datapacks
- Create a folder with a name of your choice. I recommend a name without spaces or special characters. This is your datapack name
- Inside that folder, create a pack.mcmeta file, similar to a resource pack and a folder called
data
.
- Inside the data folder, create a folder with a name of your choice. This will be your namespace. If you name this folder
minecraft
, then you can overwrite the default loot tables in minecraft if you want.
- Inside the namespace folder, create a folder called
loot_tables
.
- Inside the loot_tables folder, you can place your loot tables. You are allowed to add additional folders here to organise your loot tables.
Now you can use your loot table in minecraft. To access it, you specify the path as follows: namespace:path/to/loottable
, where namespace is the namespace that you defined. The path starts from inside the loot_tables folder.
This is what the content of pack.mcmeta looks like:
{
"pack":
{
"pack_format": 1,
"description": "Tutorial Data Pack"
}
}
Source: https://minecraft.wiki/w/Tutorials/Creating_a_data_pack#Creating_an_MCMETA_file