-
Notifications
You must be signed in to change notification settings - Fork 33
Loot Tables
LootTables replace the contents of containers within structures. There are two parts to defining Loot Tables for a structure:
- The creation of LootTables through loot table configuration files.
- Defining what LootTables a structure can use.
There are also three types of LootTables:
- Configuration Loot Tables
- Minecraft Loot Tables
- Plugin Defined Loot Tables
You only need to create loot table configuration files if you are using method #1 for your LootTables. You can also mix and match all 3 loot tables within a structure.
LootTable configuration files allow you to define a custom LootTables through the CustomStructure plugin. Loot Table configuration files are defined in the CustomStructures\lootTables
folder. There is no command to create a new LootTable, so you must manually add a new .yml
file. That name of that new file is also the name of your loot table. By default a lootTable.yml
configuration file exists for you to use as an example. You can copy its contents if you don't want to create a new loot table from scratch.
Rolls: 3
Items:
item0:
Name: '&1Test'
Type: 'STANDARD'
Material: 'IRON_SWORD'
Amount: 1
Weight: 10
Enchantments:
LOOTING: 1
SHARPNESS: 1
Lore:
- '&cExample Lore 1'
item1:
Name: '&2Test2'
Type: 'STANDARD'
Material: 'IRON_HELMET'
Amount: 1
Weight: 5
item2:
Name: '&3Test3'
Type: 'STANDARD'
Material: 'ROTTEN_FLESH'
Amount: 5
Weight: 20
Rolls: 3
This determines how many items will be chosen from the items list. (An item can be selected more than one).
item0:
Name: '&1Test'
Type: 'STANDARD'
Material: 'IRON_SWORD'
Amount: 1
Weight: 10
Enchantments:
LOOTING: 1
SHARPNESS: 1
item0:
Is a unique name of the item (this is not the same as the display name and will not appear in game).
There can many different types of items. The properties you can define for an item depend on its type. CustomStructures has STANDARD
and CUSTOM
items built-in. See the Custom Item page for more information about them.
Developers of other plugins can also define custom item types. In this case, refer to their documentation for information about what properties are available.
All items have the following standard properties:
- Type
- Amount
- Weight
Below are the properties for Standard items; however, the information for Type
, Weight
, and Amount
apply to all items.
Name: '&1Test'
This is the display name of the item. You can use fancy colors and formatting here.
Quick Reference:
Item Type:STANDARD
Required: True
Value: String
Default Value: None (Required)
Type: 'STANDARD'
This defines what type the item is. The options are: STANDARD
and CUSTOM
.
The developers of other plugins can also define custom item types. See the Developer API page for more information for how to create one.
Quick Reference:
Item Type: ALL
Required: True
Value: String
Default Value: None (Required)
Material: 'IRON_SWORD'
Define the material of the item. See the list of all valid materials here..
Quick Reference:
Item Type:STANDARD
Required: True
Value: Material String Enumeration
Default Value: None (Required)
Amount: 1
This is the amount of items to spawn per roll. This property also accepts a range value: [3;5]
.
Quick Reference:
Item Type: ALL
Required: False
Value: Stylized Integer
Default Value: 1
Weight: 10
The Weight
property determines how often the item will be chosen out of all the items in the LootTable.
See the page dedicated to Weighted Probability for more information.
Quick Reference:
Item Type: ALL
Required: True
Value: Integer
Default Value: None (Required)
Enchantments:
#Enchantment name and level
LOOTING: 1
SHARPNESS: 1
For the levels of an enchantment, a ranged 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 used.
Quick Reference:
Item Type:STANDARD
Required: False
Value: Key-Value Pair
Default Value: No Enchantments
Lore:
- '&cExample Lore'
- '&5Lore Line #2'
You can define the lore for an item. This supports the use of color codes.
Quick Reference:
Item Type:STANDARD
Required: False
Value: String List
Default Value: No Lore
Key: 'MY_KEY'
This property is only used by CUSTOM
items. The Key
property defines what custom item will be used.
See the Custom Item page for more information.
Quick Reference:
Item Type:CUSTOM
Required: True
Value: String
Default Value: None (Required)
You define what LootTables a structure can use in the LootTables
property section of the structure configuration file. This allows you to use a single LootTable is multiple structures.
LootTables:
CHEST:
lootTable: 5
lootTableTwo: 4
BARREL:
lootTable: 5
This property takes the form of:
ContainerType:
LootTableName: {Weight}
ContainerType
is the type of container that the LootTables below it can spawn in. Valid container types are: CHEST
, FURANCE
, HOPPER
, BREWING_STAND
, TRAPPED_CHEST
, BARREL
, and SHULKER
.
Each container type has its own probability system. The probability system used by LootTables is the familiar Weighted Probability system. See the Weighted Probability page for more details.
Loot Table Names can be 3 possible values:
- A Configuration Loot Table
- A Minecraft Loot Table
- A Plugin Defined Loot Table
To use a configuration loot table, just use the same name as the file name. So if you have a configuration loot table in the file MyLootTable.yml
, then you can use it by putting MyLootTable: 5
.
CustomStructures allow you to use Loot Tables defined by vanilla Minecraft or Loot Tables defined by datapacks. You specify a Minecraft LootTable to use by doing namespace:table_name
.
'minecraft:chests/abandoned_mineshaft': 5
The example above will add the abandoned mineshaft chest loot table. Here is a list of all vanilla loot tables (3rd party):
https://mcreator.net/wiki/minecraft-vanilla-loot-tables-list
'datapack:loot_table': 5
The example above will add a loot table from an enabled datapack. datapack
is the name of the datapack namespace, while loot_table
is the name of the loot table to use.
Plugin developers can programmatically define loot tables for use. To use a plugin defined loot table, just put the name that the developer selected for it:
MyCustomPluginLootTable: 5
See the Developer API page for how to create custom loot tables.
It is possible to set a single container's loot table explicitly. This will make it so that specific container will always spawn with the same loot table. You can configure this by using the /cstruct setLootTable
when looking at the specific container. This needs to be done before creating the schematic of the structure. Running that command while looking at a container will put a piece of paper in the first item slot of the container, which tells the plugin what loot table the container should have. You can increase the number of items in the stack to add more rolls for the loot table.
It is possible to test a LootTable by running the /cstruct testLootTable
command. Running that command while looking at a container will replace any existing contents with ones from the specified loot table. You can test all 3 types of loot tables using this command.
Custom Structure WIKI
- Main Page
- Installation
- Commands
- Creating Schematics
-
Structure Configuration
- Structure Configuration File
- Configuration Signs
- Weighted Probability
- Updating The Plugin
- Addons
- Developer API