Class LootTableHandler
java.lang.Object
com.ryandw11.structure.loottables.LootTableHandler
This handles the loot tables.
Get this handler via CustomStructuresAPI.getLootTableHandler()
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addLootItem(String typeName, Class<? extends ConfigLootItem> lootItemClass)
Add a loot item to the LootTableHandler.boolean
addLootTable(LootTable lootTable)
Add a loot table to the LootTableHandler.Class<? extends ConfigLootItem>
getLootItemClassByName(String typeName)
Get a loot item's class by its type name.Map<String,Class<? extends ConfigLootItem>>
Get loot items.getLootTableByName(String lootTableName)
Get the loot table by the name.Get the map of loot tables.Get a list with the names of all loot tables.
-
Constructor Details
-
LootTableHandler
public LootTableHandler()
-
-
Method Details
-
addLootTable
Add a loot table to the LootTableHandler.Addons should be using
CustomStructureAddon.registerLootTable(LootTable)
to add custom LootTables since the LootTableHandler is reset every time the plugin is reloaded.- Parameters:
lootTable
- The loot table to add.- Returns:
- If the loot table was added successfully.
-
addLootItem
Add a loot item to the LootTableHandler.Addons should be using
CustomStructureAddon.registerLootItem(String, Class)
to add custom LootItems since the LootTableHandler is reset every time the plugin is reloaded.- Parameters:
typeName
- The type name for the LootItem. (All names are set to be upper-case).lootItemClass
- The loot item class.- Returns:
- If the loot item was added successfully.
-
getLootTableByName
Get the loot table by the name.This will automatically load a loot table
If the name starts with
minecraft:
, it will try to load a minecraft loot table.- Parameters:
lootTableName
- The name of the loot table.- Returns:
- The loot table. This will return null if the loot table does not exist or loads with an error.
-
getLootTables
Get the map of loot tables.This returns an unmodifiable map.
- Returns:
- The unmodifiable map of loot tables.
-
getLootTablesNames
Get a list with the names of all loot tables.- Returns:
- The list with names of all loot tables.
-
getLootItemClassByName
Get a loot item's class by its type name. (Built-In loot items won't be returned).- Parameters:
typeName
- The type name. (All type names are uppercase).- Returns:
- The loot item's class.
-
getLootItems
Get loot items.- Returns:
- The unmodifiable map of loot items.
-