Minecraft Blogs / Tutorial

A Basic Guide to 1.14+ Datapacks and Loot Tables

  • 19,860 views, 0 today
  • 8
  • 2
  • 16
BubblesAndSuch
Level 41 : Master Kitten
26

About


This is a simple guide on how to get started with loot tables in 1.14+ versions. There have been several changes to loot tables between 1.12, 1.13, and 1.14. After fiddling around for hours, I finally got a basic loot table working where I could spawn a few custom drops.


My primary goal is to setup the command /loot spawn ~ ~ ~ loot Custom_Ores:test to spawn a custom set of items. This isn't an advanced tutorial. It doesn't go into the advanced specifics of how the loot tables are set up or the various ways to use them. It is just to help people get a datapack and loot table started in 1.14


Here's how I did it:




Preparing the Pack


To start off, you need to create a datapack in your world file. Locate your saved world and create the following folders highlighted in bold:

saves/WorldName/datapacks/<TestPack>/data/<Custom_Ores>/loot_tables

Replace the names in <> with what ever you prefer


TestPack is the name of the data pack. Later you can use /datapack list to see if the pack is loaded

Custom_Ores is a NameSpace. They contain all the loot tables inside it. You can create multiple NameSpace folders to organize your tables.




Creating the Meta Data


In the TestPack folder create a file named pack.mcmeta and put the following text inside it: https://pastebin.com/MgaFB6Uh
A Basic Guide to 1.14+ Datapacks and Loot Tables
The description can be anything you want.




Creating a Loot Table



Now, in the loot_tables folder, create a file called test.json with the following text: https://pastebin.com/jeXyyxCp
A Basic Guide to 1.14+ Datapacks and Loot Tables
This creates a basic loot table that spawns an iron ore. More loot tables can be made the same way just with different names.


To insure your JSON file is formatted correctly, use an online JSON syntax checker like https://jsonformatter.curiousconcept.com/ or https://jsonchecker.com/




How to Use



To check if a datapack is loaded use:
/datapack list

To reload datapacks without closing and restarting the world use:
/reload

The command to spawn the loot table as a drop is:
/loot spawn x y z loot NameSpace:LootTable

Or in our case:
/loot spawn ~ ~ ~ loot Custom_Ores:test




Some More Things



More items and options can be added to loot tables, like weights and amounts.

Online tools, like below, can help you a little to create loot tables. NOTE: these tools are outdated and do not include the newer requirements for loot tables.
https://amaury.carrade.eu/minecraft/loot_tables
http://minecraft.tools/en/loots.php


Here is a page showing all the possible fields in a loot table file. The guide is outdated at 1.12, but still can be useful if you know how to apply it to a 1.14+ datapack: https://github.com/skylinerw/guides/blob/master/java/loot%20tables.md


Here is another guide on datapacks:


https://datapackcenter.com/projects/loot-tables.72/


Using Minecraft as the namespace will replace the vanilla loot tables with your own. I have not tested this as of yet myself, but from what I understand, to successfully replace the vanilla loot tables you must perfectly mirror the folder structure and loot table names from in the minecraft.jar file. (it can be found in you versions folder at version.jar/data/minecraft/loot_tables)





This isn't a very through tutorial, as I'm still learning it myself, but I hope it gets people started in the right direction with the new datapack features in 1.14.

If you have any questions I'll try my best to answer them.
Tags

2 Update Logs

Update #2 : by BubblesAndSuch 12/27/2019 12:31:27 amDec 27th, 2019

Updated some info and fixed a dozen grammar mistakes.
Added Picture
LOAD MORE LOGS

Create an account or sign in to comment.

Raismin
03/01/2020 2:16 pm
Level 1 : New Miner
i have a little problem whit my loot table

this is my loot table for the husk:https://pastebin.com/JSLXgT8b

the "minecraft:entities/extra/husk" loot table is the follow:https://pastebin.com/fvFA7Hni


when i use the loot command whit the extra/husk give me the sand but when i kill a husk it get me the vanilla stuf whitout the sand

even if put the sand entry and not the loot table whit the sand is the same...

is possible there is some conflict whit other datapack or there is something wrong?
1
BubblesAndSuch
03/01/2020 5:41 pm
Level 41 : Master Kitten
I'm not sure exactly what the problem is, but here's a few things I think may help:



Try moving the extra loot tables out of the vanilla folders to something like "saves/WorldName/datapacks/customtables" . I don't know if the game treats it differently that way, but I feel like that may be part of the problem.




If you still can't get it to work properly, here's what I would try:
  1. Get a brand new empty world to experiment on.
  2. Replace the vanilla loot table of the Husk and make it drop 1 stone. Just a single stone and nothing else.
  3. Kill a Husk to confirm it works.
  4. Create a folder with a simple loot table that drops 1 log and nothing else. (Like in my guide)
  5. Use the command to drop that 1 log: /loot spawn x y z loot CustomTables:LogDrop
  6. If both are working on there own, then procide
  7. Replace the stone in the Husk loot table with the name of the loot table that has the log. (Like you did with the sand) "name": "CustomTables:LogDrop"
  8. Try killing a Husk again.
Hopefully this will allow you to find out step by step, what you had wrong.
1
LeonidasTLM
09/27/2019 11:50 am
Level 1 : New Miner
Use this:

{
"function": "furnace_smelt",
"conditions": [
{
"condition": "minecraft:entity_properties",
"predicate" : {
"flags" : {
"is_on_fire": true
}
},
"entity" : "this"
}
]
},

Just replace the whole function. Works only for 1.14.X
1
jkyt07
08/31/2019 7:42 pm
Level 1 : New Miner
So im using the loot table example for a normal cow from the datapack tutorial on the minecraft wiki ( https://minecraft.gamepedia.com/Tutorials/Creating_a_data_pack ) and the cow only ever drops cooked beef whether or not its on fire. I assume the page is outdated but I can't find any other place that would describe how to fix this, or even find out what the issue is, since most tutorials dont go beyond the basics with no conditions. Even the loot table wiki page just lists the conditions but does not give any explanation on how to use them.
2
BubblesAndSuch
12/03/2019 6:33 pm
Level 41 : Master Kitten
I took a break from PMC, so sorry for the late reply.

If you are still wanting to fix the data pack, Here's LeonidasTLM's suggestion with proper formatting:

https://pastebin.com/DWiwRrdg
1
JustSphynx
08/31/2019 2:34 pm
Level 28 : Expert Architect
i did everything like instructed but the loot table isn't working ive tried to use the /loot command but its not working
2
BubblesAndSuch
12/03/2019 6:24 pm
Level 41 : Master Kitten
I took a break from PMC, so sorry for the late reply.



I just tested my instructions in 1.14.4 and it worked fully. If you're still wanting to make it work. Double check the steps you took and make sure no text is missing from the JSON or mcmeta files.
1
PoisonNettle
08/06/2019 7:17 pm
Level 1 : New Miner
history
Hello! So I can't get the "type": "tag" working which i would like to use for a loot table in one of my datapacks (non are on here or published).

Here's what I'm doing:

https://pastebin.com/Ya2GE3b2

And the loot table isn't even showing up in the options, if you can offer any help I would appreciate it.

(edit): also so far the other json objects I have created and working loot tables have also used tabs so it's not that.
2
BubblesAndSuch
12/03/2019 6:21 pm
Level 41 : Master Kitten
history
I took a break from PMC, so sorry for the late reply.

If you're still trying to fix it, the problem is in your JSON syntax. line 11 that says :

"weight": 1

should have a comma after it. Like so:

"weight": 1,
1
zerstaeuber
05/14/2019 2:49 pm
Level 5 : Apprentice Explorer
so, the /loot spawn works, but is there a way to spawn/give me chests that contain items from the loot table. it worked in previous version but I can't figure out/find instructions on how to do it in 1.14
2

Welcome