2

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"}
3
  • Could you add your datapack folder structure and your loot table and the exact command that you used(including the exact path instead of your filler text)?
    – D-Inventor
    Commented Jul 31, 2018 at 22:11
  • Of course, added it now
    – Bryuf
    Commented Jul 31, 2018 at 22:26
  • After a bit more meddling around today, I have found that it's my loot table that doesn't work. The datapack works fine.
    – Bryuf
    Commented Aug 1, 2018 at 9:33

1 Answer 1

1

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.

1
  • Ah, thank you, I also just discovered that "set data" was removed in 1.13, was about to add it here, now that isn't necessary :)
    – Bryuf
    Commented Aug 1, 2018 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .