Help with datapack/loot table commands in 1.13
I recently began working on a new map, and figured that I wanted to use custom loot tables, so I headed over to minecraft tools, to make a loot table. No problems in that. But, now I cannot for the life of me figure out how I get the loot table to work ingame. I followed the wiki's guide to datapacks and set up a datapack with correct pack.mcmeta and all (I can see that the pack is working by using /datapack list).
But I can't get it in chests. I used this command here:
setblock ~ ~ ~ minecraft:chest{LootTable:"minecraft:chests/abandoned_mineshaft"}
to get a chest with mineshaft loot, which worked just fine. Then I changed it to fit my directory like this
setblock ~ ~ ~ minecraft:chest{LootTable:"(namespace:chests/(loottable name)"}
The chest I get is empty, any ideas why?
Edit: As requested, the datapack folder structure
world > datapacks > mazedatapack (pack.mcmeta in here) > data > namespace > loot_tables > loot_table.json
And the specific contents of the loot table (Made it simple for testing)
{"pools":[{"rolls":1,"entries":[{"type":"item","name":"minecraft:stone","weight":1,"functions":[{"function":"set_data","data":0}]}]}]}
And the command I use to get a chest which should have the loot
/setblock ~ ~ ~ minecraft:chest{LootTable:"namespace:loot_table"}
I have recreated your datapack on my own testing world and I loaded your loottable and indeed I found that there was no loot generated.
I checked your syntax against the guide on this webpage and it checks out.
I finally checked the log file and found a Json parsing error on the function "set_data". This seemed strange to me at first, since this exact function was specified in the guide, but then I realised that data is no longer in the game. You can't specify different stone types with different data values, because each stone type has it's own name now.
I removed the entire function and now I can spawn a chest with a stone block in it, using the command which you provided. This is the new loot table:
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "item",
"name": "minecraft:stone",
"weight": 1
}
]
}
]
}
I tried to see if tags would work to define different items in one entry, but that didn't work, so if you want to have a random stone type for example, then you will have to define each one individually.