Overview
IrisLootEvent is fired when Iris is about to populate a container with loot. This event allows you to modify or add custom loot tables before the inventory is filled.
Event Properties
| Property | Type | Description |
|---|---|---|
engine | Engine | The Iris engine instance |
block | Block | The block containing the inventory (chest, barrel, etc.) |
slot | InventorySlotType | The type of inventory slot being filled |
tables | KList<IrisLootTable> | Mutable list of loot tables to be used |
When It Fires
This event fires when:- A container (chest, barrel, shulker box, etc.) is generated in the world
- Iris is about to populate the container with loot based on the dimension’s loot tables
- Before the actual items are placed in the inventory
Important Notes
- The
tableslist is mutable - you can add, remove, or modify loot tables - Cannot be cancelled directly
- Integrates with Bukkit’s
LootGenerateEventfor compatibility with other plugins
Event Handler Examples
Basic Loot Modification
Conditional Loot by Location
Removing Default Loot
Bukkit Integration
Iris also fires Bukkit’sLootGenerateEvent for compatibility. You can listen to both events:
Registering the Event
Register your listener in your plugin’sonEnable() method:
Source Code Reference
Location:core/src/main/java/com/volmit/iris/core/events/IrisLootEvent.java