Skip to content

Loot Tables

Daniel Saukel edited this page Oct 18, 2020 · 2 revisions

A loot table is a set of item stacks that may be used in different cases, e.g. to populate an inventory, armor contents of a mob or to generate item drops. Each loot table entry consists of the item stack itself and its chance to populate.

In YAML

Caliburn stores custom loot tables under plugin/Caliburn/custom/loottables. The file name (without the .yml extension) is the ID of the table.

'14': # Name of the loot table entry (see below)
  item:
    ==: org.bukkit.inventory.ItemStack #
    v: 2580                            # The item stack
    type: DIAMOND_LEGGINGS             #
  chance: 100.0
'38':
  item:
    ==: org.bukkit.inventory.ItemStack
    v: 2580
    type: ENCHANTED_BOOK
    meta:
      ==: ItemMeta
      meta-type: ENCHANTED
      stored-enchants:
        OXYGEN: 3
  chance: 100.0

Reserved entry names

The name of an entry may be any string. If a numeric value is used, the item will be populated at the given inventory index number. The following names will make the stack spawn in special slots:

  • mainHand
  • offHand (1.9+ only)
  • helmet
  • chestplate
  • leggings
  • boots

In the API, all slots have constants named similarly in the LootTable class. LootTable#setEntityEquipment(EntityEquipment) populates an instance of EntityEquipment and LootTable#readEntityEquipment(EntityEquipment) reads LootTable entries from EntityEquipment.