I can't do it with loot tables, but I can still help you. Get a repeating command block and input:
/scoreboard objectives add test stat.killEntity.WitherSkeleton
Next, in the same direction as that command block is facing, place a chain command block and input this:
execute @p[score_test_min=1] ~ ~ ~ summon minecraft:wither_skull ~ ~ ~
which is good if your inventory is filling up fast, or
give @p[score_test_min=1] minecraft:skull 1 1
which is great if you're on a server and don't want people pinching your skulls. Next place another chain command block with:
/scoreboard players set @p[score_test_min=1] test 0
Note: Replace 'test' with the name of a scoreboard of your choosing, set the repeating command block to always active and unconditional, set the others to always active and conditional. This is multiplayer-friendly.
Bonus: If you use this for something more common (like cows and leather, for example), you might want to limit the availability by imposing a second requirement. To do this, put another repeating command block in place. Whichever repeating command block is closest to the chain command blocks can be a chain command block, but it must be set to conditional.
An example of a different kind of restriction is:
{SelectedItem:{id:minecraft:iron_axe,tag:{display:{Name:"Sacrificial Axe"}}}}
Best of luck!
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.
Best Answer
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:
.minecraft/saves/yourworld/datapacks
data
.minecraft
, then you can overwrite the default loot tables in minecraft if you want.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:
Source: https://minecraft.gamepedia.com/Tutorials/Creating_a_data_pack#Creating_an_MCMETA_file