Minecraft 1.13 data pack override default loot tables

minecraft-java-edition

Very recently a new minecraft snapshot has come out. The snapshot introduced data packs, basically a folder with custom functions, recipes, loot tables and more.

I wanted to try this out and see if I could change the default loot table of a guardian. This is how the pack looks:

d_invpack
-pack.mcmeta
-data
    -d_invpack
        -loot_tables
            -entities
                -guardian.json

My custom loot table should make guardians drop sponges.

I loaded this in my fresh 1.13 world (17w43b), I spawned a guardian with a spawn egg and killed it with the kill command. I didn't get a sponge, but the default loot.

I found out that if I applied the loot table with the command /entitydata @e[type=guardian] {DeathLootTable="d_invpack:entities/guardian"}, the guardian does drop a sponge, so the pack and table work, but it hasn't overridden the default table.

I was told that I should use the minecraft namespace to override the default loot tables, so I changed my folder structure to this:

d_invpack
-pack.mcmeta
-data
    -minecraft
        -loot_tables
            -entities
                -guardian.json

I tried again, but still no luck. The guardian dropped the default loot. I have used the /reload command to make sure that the pack is loaded correctly, so that is not the problem. I can't alter the loot table of the guardian using commands this time, because "minecraft:entities/guardian" refers to the default table, even if I specified it in my data pack.

Can I override the default loot tables with a data pack? And how?

Best Answer

I tried this again in the latest snapshot (17w48a) and now it works just fine. Data packs were just out at the time that I posted this question and it was a bug. In the latest snapshot, this works just fine, provided that this datapack is loaded after the vanilla datapack.