Skip to content

Loot Tables

Ryandw11 edited this page Jan 23, 2022 · 14 revisions

Everytime a structure is spawned the plugin will search for all the containers (chests, brewingstands, furnaces, ...) and fill them with the loottable content. Loottables can be configured using yaml files in the lootTables folder.

Creating a Loot Table

First open the CustomStructures folder. Inside it is a lootTables folder, open it. Inside is a file named lootTable.yml. Click on that file and press ctrl + c to copy the file. Then click on the background of the file explorer (unselect the file) and press ctrl + v to paste the file. You now have a template for your new lootTable.

Editing the Loot Table files.

#LootTable Example
#You can create as many files as you want, each file represents a loot table

#Determines how many Items will be chosen from the Items list bellow
Rolls:  3
Items:
  item0:
    #Item custom Name, you can use color codes (https://minecraft.tools/en/color-code.php)
    Name: '&1Test'
    #Material Type https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
    Type: 'IRON_SWORD'
    #Number of items per stack
    Amount: [1;3]
    #Determines how often this entry will be chosen out of all the entries in the list.
    Weight: 10
    #List of Enchantments, one item can have multiple enchantments
    Enchantments:
      #Enchantment name and level (As of 1.5.4.2, it is using the Minecraft Names with '_' instead of spaces.)
      LOOTING: [1;3]
      SHARPNESS: 1
    Lore:
      - '&cExample Lore 1'
  item1:
    Name: '&2Test2'
    Type: 'IRON_HELMET'
    Amount: [1;10]
    Weight: 5
  item2:
    Name: '&3Test3'
    Type: 'ROTTEN_FLESH'
    Amount: [1;30]
    Weight: 20

Rolls

Rolls: 3

This determines how many Items will be chosen from the Items List.

Items

  item0:
    #Item custom Name, you can use color codes (https://minecraft.tools/en/color-code.php)
    Name: '&1Test'
    #Material Type https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
    Type: 'IRON_SWORD'
    #Number of items per stack
    Amount: 1
    #Determines how often this entry will be chosen out of all the entries in the list.
    Weight: 10
    #List of Enchantments, one item can have multiple enchantments
    Enchantments:
      #Enchantment name and level (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html)
      LOOTING: 1
      SHARPNESS: 1

item0: - This is just any name for the item. (There can only be one with this name)
Name: '&1Test' - This is the name of the item.
Type: 'IRON_SWORD' - This is what item the item is.
Amount: 1 - Is the amount of items to spawn per roll. This can be random range too: [3;5].
Weight: 10 - Determines how often the item will be chosen out of all the items in the loottable. (Higher numbers mean higher chance)

Enchantments:
      #Enchantment name and level
      LOOTING: 1
      SHARPNESS: 1

For the levels of an enchantment, a random value can be used: LOOTING: [1;3]. That will result in a random looting level between 1 and 3.

This is what enchantments the item will have. Minecraft enchantment names are use here after version 1.5.4.1.

Lore:
  - '&cExample Lore'

You can define the lore for an item. This supports the use of color codes.

Using Loot Tables

You define what loot tables a structure uses in its configuration file. A loot table can be used by multiple structures and on multiple types of containers. For more information, see the Structure Configuration Guide

Adding Custom Items

See this page here!