Tutorial:Loot Table Example

This tutorial will go through a custom Loot Table file, in order to describe how these files work, and how this file would be used by the game.

The corresponding loot table as presented on this site is:

The image (shown on the right) is a visualisation of the file we're going to explain. It's based roughly upon the  in the Vanilla Behavior pack (version 1.7.0).

This file has two loot groups (marked by green arrows on the left), where the first loot group has 3 items (marked by red arrows on the right), and the second loot group has only item, namely an Golden Apple. The first loot group has an Emerald, some Wheat and a randomly Enchanted Book.

Interpretation of file
Given that this file is connected to a chest, this chest will always have a Golden Apple, as that loot group is rolled once, and has only 1 item. This is indicated in the table by the $1⁄21$ and the 100% chance of having this. From the first group we'll get between 2 and 8 items from the list. This means that we could get repeats of any of the items, since there are only three items in the list.

The way the game chooses items is based upon the 's, and in this example if you sum up all of those in the first group you'll get a total of 21. One way to visualise this process is to take a random number between 1 and 21, and if it's 1 we'll choose the Emerald, if it's from 2 through 11 we'll choose the Wheat, and if 12 or higher we'll get the Enchanted Book.

After selecting the item, it checks to see if any functions needs to be applied. In our case that would require a new random number from 2 through 3 to set the count of Wheat to be included in the chest, or to do a random enchantment on the book if either of these items are chosen.

So in the end we'll have a chest with between 3 and 9 item, where of one always is a Golden Apple, and the others are any combination of Emeralds, Enchanted Books and small stacks of Wheat.