# ILootTable > Represents a loot table containing weighted items. `gg.lode.chestapi.api.ILootTable` --- ## Signature ```java public interface ILootTable ``` --- ## Methods | Method | Return Type | Description | |--------|-------------|-------------| | `getId()` | `String` | Returns the unique identifier. | | `getName()` | `String` | Returns the display name. | | `setName(String name)` | `void` | Sets the display name. | | `getIcon()` | `Material` | Returns the icon material for GUI display. | | `setIcon(Material icon)` | `void` | Sets the icon material. | | `getItems()` | `List<ILootTableItem>` | Returns all weighted items in this table. | | `addItem(ItemStack item, int weight)` | `void` | Adds an item with the specified weight. | | `addItem(ILootTableItem item)` | `void` | Adds a pre-built [[ILootTableItem]]. | | `populate(Inventory inventory, int min, int max)` | `void` | Populates an inventory with a random number of items between `min` and `max`. | | `getRandomItem()` | `ItemStack` | Returns a single random item based on weight, or `null` if empty. | | `getRandomItems(int count)` | `List<ItemStack>` | Returns multiple random items. | | `merge(ILootTable other)` | `void` | Merges another loot table into this one. | | `getMergedTables()` | `List<ILootTable>` | Returns all tables that have been merged into this one. | --- ## Usage ```java ILootTable table = ChestAPI.getApi().getLootTableManager().getLootTableById("my_table"); // Add items directly table.addItem(new ItemStack(Material.IRON_SWORD), 1); // Populate an inventory table.populate(chestInventory, 3, 6); // Get a random item ItemStack item = table.getRandomItem(); ``` --- ## Related Pages - [[ILootTableItem]] - [[ILootTableManager]] - [[IChestAPI]]