Modules

Lootables are chests or other containers that generate their contents based on custom rules and probabilities. They can optionally refill themselves on a schedule, or in response to dynamic filters.

Lootables Element Description
<lootables> </lootables>
Sub-elements Value/Children
<loot> A generated set of items Loot Sub-elements
<fill> Configuration for filling containers with loot Fill Sub-elements

Loot

The <loot> element defines a generated set of items, using literal <item> elements, and operations for choosing them.

Loot Element Description Value/Children
<loot> A generated set of items Loot Sub-elements
Loot Attributes Description Value Default
id Unique identifier used to reference this loot elsewhere String
Loot Sub-elements Description Type
<item> An item to include in the loot. This can be any type of item element, and can have any item attributes. Item
<any> Random selection of children
<maybe> Include child conditionally based on a filter

Random Selection

The <any> element makes a random selection from any number of child elements. Its children can be <option> elements, or any other <loot> sub-element.

Any Attributes Description Value Default
count Number of child elements to choose Numeric Range
unique true if each child can only be chosen once.
false to allow a child to be chosen multiple times.
true/false true
Any Sub-elements Description Type
<option> A single option for the random selection
Option Attributes Description Value Default
weight Weight of this option relative to all others Number 1
filter Filter used to decide the eligibility of this option Filter always

Conditional Inclusion

The <maybe> element includes its child elements only if the specified filter matches. The filter is matched against the first player to access the loot.

Maybe Attributes Description Value Default
filter Filter used to decide inclusion of children Filter


Fill

The <fill> element fills containers with generated loot. It will fill anything that has an inventory, and matches its filter property. This can include chests, dispensers, storage minecarts, or any other container block or entity. It will fill containers regardless of where they came from, so if you don’t want player-placed chests to be filled, then you will have to prevent that somehow.

Fill Element Description Value/Children
<fill> Automatically fills containers with loot
Fill Attributes Description Value Default
loot Loot to fill containers with Loot
filter Selects which blocks/entities to fill Filter always
refill-trigger Optional dynamic filter that causes containers to be refilled Dynamic Filter
refill-interval Time to refill containers after they are first accessed Time Period oo (never)
refill-clear Whether to clear containers before refilling them true/false true

Examples

<lootables>
    <!-- Define a procedural list of loot -->
    <!-- Can be different every time it is used -->
    <!-- All operators can be composed within each other -->
    <loot id="stuff">
        <!-- Always include these items -->
        <item material="stone sword"/>
        <item material="bow"/>

        <!-- Include if filter matches opener of the container -->
        <maybe filter="red-team">
            <item material="stained clay" damage="14" amount="64"/>
            <item material="leather helmet" color="#f00"/>
        </maybe>

        <!-- Choose one element at random -->
        <any>
            <item material="stone" damage="1"/>
            <item material="stone" damage="2"/>
            <item material="stone" damage="3"/>
        </any>

        <!-- Weighted choice -->
        <any>
            <option weight="5">
                <item material="cookie"/>
            </option>
            <option weight="3">
                <item material="bread"/>
            </option>
            <option weight="1">
                <item material="golden apple"/>
            </option>
        </any>

        <!-- Choose any two unique elements (unique="false" to allow duplicates) -->
        <any count="2">
            ...
        </any>

        <!-- Choose between 3 and 5 unique elements -->
        <any count="3..5">
            ...
        </any>
    </loot>

    <!-- Define inventories to refill -->
    <!-- Filling always happens when a player opens the inventory -->
    <!-- Any block or entity that has an inventory (and matches the filter) will be filled -->
    <fill loot="stuff"          <!-- Loot to fill inventory with -->
          filter="chests"       <!-- Inventories to fill (blocks or entities) -->
          refill-interval="3s"  <!-- Minimum interval between refills (default +inf) -->
          refill-trigger="..."  <!-- Dynamic filter to trigger refill (default none) -->
          refill-clear="true"   <!-- Clear inventory before refilling (default true) -->
    />
</lootables>