Skip to content

Loot Tables

totemo edited this page Mar 26, 2021 · 46 revisions

Start: Home ⬩ Previous: Mobs ⬩ Next: Zones
See also: Loot Table Command Reference


BeastMaster uses loot tables to randomly select an item or a mob. There are no pre-defined loot tables; you create them yourself using /beast-loot add. As with all BeastMaster commands, /beast-loot help will describe all of the available options of the /beast-loot command.


The properties of a mob can be configured to specify loot tables that randomly select things that will be:

  • dropped when a mob dies,
    e.g. /beast-mob set creeper drops creeper-drops,
  • worn by a mob as armour or held as weapon,
    e.g. /beast-mob set zombie main-hand zombie-weapons-table,
  • ridden by the mob as a passenger,
    e.g. /beast-mob set zombie passenger random-rider, or
  • dropped when a block is mined,
    e.g. /beast-zone add-block world_nether quartz_ore quartz-ore-drops.

Consult the Mob Property Reference for mob properties that can be assigned loot table IDs.

Zones can also be configured to use loot tables to randomly select a replacement for individual types of naturally spawned mobs. For example, to replace endermen that spawn naturally in the world_the_end zone with a mob that is selected randomly from the end-mobs table, use:

/beast-zone replace-mob world_the_end enderman end-mobs

Demonstration Mob

In order to demonstrate loot table concepts, we'll define a test mob (a type of wither skeleton) called a knight:

/beast-mob add knight witherskeleton

And we'll define some test items:

  • Holding a red leather chest plate, define the red-chest item with:
    /beast-item define red-chest.
  • Holding a blue leather chest plate, define the blue-chest item with:
    /beast-item define blue-chest.
  • Holding a gold nugget, define knight-gold with:
    /best-item define knight-gold
  • Holding an iron nugget, define knight-silver with:
    /best-item define knight-silver

Example: Creating a Loot Table to Select Worn Armour

For our demonstration mob, we want to use a loot table to randomly select the chest plate worn by our knight, so we run the following commands:

/beast-loot add knight-chest
/beast-loot add-drop knight-chest item red-chest 30
/beast-loot add-drop knight-chest item blue-chest 30

Those commands create a the knight-chest loot table with a 30% chance of selecting the red-chest item and a 30% chance of selecting the blue-chest item.

We can then configure the knight to wear whatever that table selects with:

/beast-mob set knight chest-plate knight-chest

Finally, we can spawn an inert statue of our new mob with:

/beast-mob statue knight here

Note that you don't have to set up a loot table for each type of armour worn by your custom mobs. You can configure mobs to always wear a specific item, e.g. /beast-mob set knight chest-plate red-chest. This is just a conveniently simple example of using loot tables to select one thing from several options.

Listing Loot Tables and their Contents

We can list all of the loot tables defined so far with:

/beast-loot list

And we can get a description of our new loot table with:

/beast-loot info knight-chest

Single- vs Multiple-Selection Loot Tables

If you spawn a few more knight statues, you may begin to suspect that something is not quite right. The total probability of the knight wearing a chest plate is 30% + 30% = 60%. The outcome is not specified the other 40% of the time. And yet all of the knights end up wearing either a red chestplate or a blue one. There are no knights that don't wear a chest plate.

The reason for this is that loot tables have two distinct modes of operation: single-selection and multiple-selection. Loot tables will, by default, select multiple items, but when used for certain specific purposes (such as selecting worn or held items), only a single item will be selected, as if the table had been configured for single-selection mode.

We can change the knight-chest loot table to select no armour easily enough:

/beast-loot add-drop knight-chest nothing 40

That is exactly the same as saying:

/beast-loot add-drop knight-chest item air 40

which adds the pre-defined item air as a possible outcome of the selection process.

Single-Selection is Weighted Selection

When a loot table is used to select a single item, either because it is configured for single-selection, or because it's used in a context where it implicitly has to be single-selection, the table returns a weighted selection of its entries. With weighted selection the probability of selecting any loot table drop is the weight of that entry divided by the sum of the weights of all entries.

So for example, if we set the weight for the nothing drop to 100:

/beast-loot add-drop knight-chest nothing 100

then the total weight would be 30 + 30 + 100 = 160, and the chance of selecting a red leather chest plate, for example, would be 30 / 160 * 100% = 18.75%. The chance of the knight wearing nothing as a chest plate would be 100 / 160 * 100% = 62.5%. Note however, that /beast-loot info knight will still show the drop probabilities as 30%, 30% and 100%. This is because it's not possible for a multiple-selection table to know in advance when it will be used for a single-selection purpose.

Explicitly Configuring Single-Selection

You can configure a loot table to always select a single item in all cases:

/beast-loot single knight-chest yes

Currently, this doesn't change the output of /beast-loot info to reflect the effective drop probabilities due to weighted selection, but it probably will in the future. Explicitly configuring single-selection mode is most useful for selecting a dropped item when a mob dies, or when a block is mined.

Implicit Single-Selection Contexts

The specific cases where a multiple-selection loot table behaves as a single-selection table are:

  • when selecting armour for a mob to wear or items to hold,
  • when selecting a mob to spawn as a passenger of another mob, and
  • when selecting the mob that will replace a natural-spawned mob in a zone,

Example: Configuring Items Dropped on Mob Death - Multiple-Selection

We'll create another loot table to represent the items dropped by the knight when it dies:

/beast-loot add knight-drops
/beast-loot add-drop knight-drops item knight-gold 20
/beast-loot add-drop knight-drops item knight-silver 40 5 10
/beast-mob set knight drops knight-drops

The last command configures the knight mob to drop items from the knight-drops loot table when it dies.

If you run /beast-loot info knight-drops, you will see that the loot table is described as multiple (meaning multiple-selection) and has two entries: a 20% chance of dropping one knight-gold and a 40% chance of dropping 5-10 knight-silver.

Note that since no minimum or maximum number of knight-gold items to drop was specified, that loot table entry defaulted to dropping exactly one item (no more, no less).

If you then go ahead and spawn some more knight statues (/beast-mob statue knight here) and kill them, you'll see they sometimes drop iron nuggets, sometimes 1 gold nugget, sometimes both and sometimes neither.

Example: Boosting Vanilla Death Drops

As noted in Customising the Predefined Mob Types, you can easily change the drops of vanilla mobs. For example, to ensure that shulkers always drop one extra shulker shell, you could use the following commands:

  1. /beast-mob set shulker drops shulker-drops
  2. /beast-loot add shulker-drops
  3. /beast-loot add-drop shulker-drops default 100
  4. /beast-loot add-drop shulker-drops item shulker_shell 100

The effect of these commands is as follows:

  1. All shulker mobs will drop loot according to a loot table called shulker-drops. It doesn't matter that the table has not yet been defined. The system will handle the error gracefully.
  2. Create the shulker-drops loot table as empty.
  3. Add the default drop with a 100% probability. This ensures that all vanilla-default drops will be dropped, as a starting point.
  4. Add shulker_shell as an item drop with 100% probability. The number of items is omitted and so defaults to 1. If shulker_shell has not been explicitly defined as a custom item, then BeastMaster will drop an item of the SHULKER_SHELL material, as if an item had already been defined to be that. If an item named shulker_shell is defined, then that will be dropped.

The net effect of the commands is to drop 1 more shulker shell than would be dropped by vanilla Minecraft when a shulker mob dies.

How Multiple-Selection Works

When a multiple-selection loot table is called upon to produce drops, BeastMaster steps through all of the entries in the table and for each entry does the following:

  • Chose a random number from 0 to 100%.
  • If the random number is less than the probability of the entry, then that entry is dropped. A new item stack of the entry's item type is created and the number of items in the stack is set as another random value between the minimum and maximum number of items specified.
  • If the random number is greater than or equal to the probability of the entry, then BeastMaster moves on to the next one.

The Mathematics of Multiple-Selection

Imagine that you are using a multiple-selection loot table in a context where multiple items can be selected (e.g. mob death drops). Say the table has 10 entries which each drop a single item with a probability of 2%. The average chance of getting at least one item to drop is 10 * 2% = 20%.

Minecraft has certain conventions for how often valuable items drop. Wither skulls drop at a rate of 2.5% (1 in 40), or 4% (1 in 25) when using Looting 3. If you have custom drops from a loot table that are notionally valuable, you probably don't want to set the total probability of one of them dropping much higher than about 5%; so if you have 10 of them, then you might reasonably choose to give each drop a probability of only 0.5%.

The default Drop

After a while of killing knights you will notice that they don't drop the things that wither skeletons would normally drop - skulls, bones, coal, stone swords. Those drops only occur when the loot table includes an entry for the default drop, for example:

/beast-loot add-drop knight-drops default 100

If you set the percentage chance of the default drop to 100%, then you will get exactly the same amount of that vanilla Minecraft loot as the vanilla Minecraft mob would drop by default. But you can reduce that. For example, to halve the amount of default drops a mob produces:

/beast-loot add-drop knight-drops default 50

Note that this doesn't change the number of items in each dropped item stack. Instead, it reduces how often the default drop is allowed to come into the world (in this case to 50% of the time). However, on average, over time, the effect on the total amount of default loot dropped by the mob is the same: a reduction to 50%.

Similar considerations apply to loot tables that drop custom items when a block is mined. If you set up a loot table to drop custom loot when you mine dirt, for example, then it's extremely likely that you want to include the default drop with a probability of 100%, or else players will be confused that they mined dirt but they didn't get a dirt block.

The default drop can also be used in the case of a loot table that controls the replacement of natural mob spawns in a zone. In that situation, the default drop signifies that the natural mob spawn should be allowed to proceed unchanged.

The nothing Drop

Loot tables can be configured to drop nothing, as already demonstrated with the knight-chest. This kind of drop is only useful in the case where the loot table will be used to produce a single item. In the case of a multi-selection mode table, in a context where it can drop multiple items, all of the drops that are not nothing will have a chance to produce something that is not nothing. Even if the table drops "nothing", since it's multiple-selection, it can also drop "something" as well, and something plus nothing is something.

Item Drops

These are the most commonly used drops. You've already seen an example of these:

/beast-loot add-drop knight-drops item knight-silver 40 5 10

Note that the drop is specified as the word item, followed by the identifier of an item that must be defined at the time the drop occurs.

Mob Drops

To add a mob drop to a loot table, specify the drop as the word mob, followed by the identifier of the mob type. For example, to signify that there is a 10% chance of a cave spider spawn when you kill a knight, write:

/beast-loot add-drop knight-drops mob cavespider 10

Loot tables can express several situations in which a mob can spawn:

  • As already demonstrated, you can configure a mob type's drops property with a loot table that includes a mob spawn, in order to spawn a mob when a mob dies.
  • You can set up the loot table that controls mining drops in a zone with a chance of spawning mobs when you mine a particular type of block. See Zones.
  • You can set up the loot table that controls replacement of natural mob spawns in a zone to spawn different mobs.

Restricted Drops

By default, all item drops are "restricted", meaning that a player must have caused the death of the mob that dropped the item in order for the drop to occur. BeastMaster attributes the death of a mob to a player if the mob dies within 5 seconds (100 ticks) of being damaged by that player. Note that only item drops can be "restricted" in this way.

So, by default, if a mob dies due to natural causes, without the involvement of a player, none of the death drops marked "restricted" will occur. The /beast-loot restricted subcommand can be used to specify that a drop in a loot table is not restricted, thereby allowing it to occur even if no player was involved in the death of the mob.

For example:

/beast-loot restricted knight-drops knight-silver false

Drop Properties

Each of the mob and item drops in a loot table can have additional properties that either modify the dropped item or mob, or cause additional things to happen when the drop is selected. The "restricted" property of drops is one such property that you have already seen. Other examples include playing a sound when a specific drop is selected, or making a dropped item glow.

Each property has a dedicated /beast-loot sub-command to configure the property. The drop that is modified by the property is nominated by the identifier of the mob or item to be dropped. For example, to play a chime sound when a knight drops knight-gold, you would enter:

/beast-loot sound knight-drops knight-gold block_note_block_chime

Recall that knight-drops is the name of the loot table assigned to the drops property of the knight mob. block_note_block_chime is one of the sound names in the Bukkit Sound API, listed here.

All of the drop properties default to an inert state where they have no effect. For example, the default glowing property is false (no glow effect) and the default sound is no sound (i.e. silence). The full list of drop property sub-commands is: always-fits, direct, glowing, logged, invulnerable, objective, sound and xp. These are described in the Loot Table Command Reference.


Start: Home ⬩ Previous: Mobs ⬩ Next: Zones