Chest Types - fnar/minecraft-roguelike GitHub Wiki

Chest types are used to link the contents of a chest to rooms that use that chest type. Arbitrary chest types can be used by providing any name you wish so long as it links between a loot rule and a room.

Defaults

Default chest types have been provided for convenience. These are used in many of the rooms and in the built-in loot tables. These are also used as fallbacks when no chest type is defined for a given room (as specified by the Room Types).

The following explains what's included in these chest types by default

  • ARMOUR : A piece of armour and some consumables
  • BLOCKS : A few stacks of blocks
  • BREWING : Brewing supplies
  • EMPTY : Nothing. This chest is excluded from rules that target all chests.
  • ENCHANTING : An enchanted book and some experience bottles
  • FOOD : A few stacks of food
  • MUSIC : A record
  • ORE : A few stacks of ore
  • POTIONS : A few stacks of potions
  • REWARD : Vanilla Minecraft loot by default. This is included in special reward rooms. If mods automatically inject their loot into Vanilla Minecraft loot tables, that loot should appear in these chests.
  • SMITH : A Tempered blade and some ore
  • STARTER : Pantaloons and other gubbins. Also the mod book.
  • SUPPLIES : Various bits and bobs, often includes seeds and saplings
  • TOOLS : A tool and some ore
  • WEAPONS : A weapon and some consumables

Treasure Sets

These unfortunately cannot yet be specified in settings, but are referenced from rooms.

  • COMMON chests can manifest as one of any of [ARMOUR, BLOCKS, FOOD, SUPPLIES, TOOLS, WEAPONS]
  • RARE chests can manifest as one of any of [ARMOUR, ENCHANTING, POTIONS, ORE, REWARD, TOOLS, WEAPONS]

Custom

Custom Chest Types can be specified in both loot rules and inside of rooms. An example of creating a custom loot type looks like this:

Loot Rule creating a custom Chest Type

Here is a loot rule that creates a chest type of FOO, and adds a level-2 tool to each chest of type FOO on the first floor of the dungeon.

{
  "name": "loot_rules:generic",
  "loot_rules": [
    {
      "level": 0, "type": "FOO", "each": true, "quantity": 1,
      "loot": [
        {"data": {"type": "tool", "level": 2}, "weight": 1}
      ]
    }
  ]
}

Rooms setting using a custom Chest Type

Although very basic, here is an example of a rooms setting which utilised the custom Chest Type FOO and places chests of that type in the REWARD rooms on each floor. Note that FOO chests will spawn in every REWARD room in the dungeon, one on each floor, but only the FOO chest on the first floor (floor 0) will contain anything as is defined by the loot rule above.

{
  "name": "rooms:generic",
  "overrides": ["ROOMS"],
  "rooms": [
    {"level": [0, 1, 2, 3, 4], "frequency": "single", "type": "REWARD", "count": 1, "chestType": "FOO"},
    {"level": [0, 1, 2, 3, 4], "frequency": "random", "type": "CORNER", "weight": 10},
    {"level": [0, 1, 2, 3, 4], "frequency": "random", "type": "DARKHALL", "weight": 10}
  ]
}