Loot Table


Sandstone features fully-typed loot tables. Like for all resources, you need to provide a name, which can include a namespace and folders. You then provide the definition of the loot table.



The minimal syntax for loot table is the following:
import { LootTable } from 'sandstone'

LootTable('loot_table_name', {
  /** The rewards for this loot table */
  pools: [{
    /** The rolls for this pool */
    rolls: 1,

    /** The entries for a single pool */
    entries: [{
      /** An entry has a type, and additional properties. */
      type: '<type>',
As you can see, you must provide a list of pool. A pool is defined by a list of entries and a number of rolls. For each entry, you must provide a type and. Once a type has been specified, the specific properties for this type will be available through autocompletion. The pool also has conditions and functions: read the built-in documentation or the Wikipedia article on Loot Tables for more information.


notion image

Additional properties

All additional properties can be directly found via autocompletion (as shown above), or by looking at the Minecraft wiki article on Loot Tables.


Sandstone Loot Tables have several methods mimicking the /loot command:
// Give the item to the player

// Insert into a block's inventory
myLootTable.insert('~ ~ ~')

// Replace the first slot of the block
myLootTable.replaceBlock('~ ~ ~', 'container.0')

// Replace the chest plate of the player
myLootTable.replaceEntity('@s', 'armor.chest')