Interface LootEvent
public interface LootEvent
Events related to loot tables and loot generation.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A platform-specific bridge for modifying a specific loot table.static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Event<LootEvent.ModifyLootTable>
An event to modify loot tables when they are loaded.
-
Field Details
-
MODIFY_LOOT_TABLE
An event to modify loot tables when they are loaded. This can be used to add new drops via new loot pools to existing loot tables without replacing the entire table.Built-in loot tables
The event interface includes a
builtin
parameter. If it'strue
, the loot table is built-in to vanilla or a mod. Otherwise, it's from a user data pack. The parameter can be used to only modify built-in loot tables and let user-provided loot tables act as full "overwrites".This event only runs for built-in loot tables on Forge due to the limitations of
LootTableLoadEvent
.Example: adding diamonds as a drop for dirt
LootEvent.MODIFY_LOOT_TABLE.register((lootTables, id, context, builtin) -> { // Check that the loot table is dirt and built-in if (builtin && Blocks.DIRT.getLootTable().equals(id)) { // Create a loot pool with a single item entry of Items.DIAMOND LootPool.Builder pool = LootPool.lootPool().add(LootItem.lootTableItem(Items.DIAMOND)); context.addPool(pool); } });
-