Package net.fabricmc.fabric.api.loot.v2
Class LootTableEvents
java.lang.Object
net.fabricmc.fabric.api.loot.v2.LootTableEvents
Deprecated.
Events for manipulating loot tables.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceDeprecated.static interfaceDeprecated.static interfaceDeprecated.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Event<LootTableEvents.Loaded> Deprecated.Please useLootTableEvents.ALL_LOADEDinstead.static final Event<LootTableEvents.Modify> Deprecated.Please useLootTableEvents.MODIFYinstead.static final Event<LootTableEvents.Replace> Deprecated.Please useLootTableEvents.REPLACEinstead.
- 
Method Summary
- 
Field Details- 
REPLACEDeprecated.Please useLootTableEvents.REPLACEinstead.This event can be used to replace loot tables. If a loot table is replaced, the iteration will stop for that loot table.
- 
MODIFYDeprecated.Please useLootTableEvents.MODIFYinstead.This event can be used to modify loot tables. The main use case is to add items to vanilla or mod loot tables (e.g. modded seeds to grass).You can also modify loot tables that are created by REPLACE. They have the loot table sourceLootTableSource.REPLACED.Example: adding diamonds to the cobblestone loot tableWe'll add a new diamond loot pool to the cobblestone loot table that will be dropped alongside the original cobblestone loot pool.If you want only one of the items to drop, you can use FabricLootTableBuilder.modifyPools(java.util.function.Consumer)to add the new item to the original loot pool instead.LootTableEvents.MODIFY.register((key, tableBuilder, source) -> { // If the loot table is for the cobblestone block and it is not overridden by a user: if (Blocks.COBBLESTONE.getLootTableKey() == key && source.isBuiltin()) { // Create a new loot pool that will hold the diamonds. LootPool.Builder pool = LootPool.builder() // Add diamonds... .with(ItemEntry.builder(Items.DIAMOND)) // ...only if the block would survive a potential explosion. .conditionally(SurvivesExplosionLootCondition.builder()); // Add the loot pool to the loot table tableBuilder.pool(pool); } });
- 
ALL_LOADEDDeprecated.Please useLootTableEvents.ALL_LOADEDinstead.This event can be used for post-processing after all loot tables have been loaded and modified by Fabric.
 
- 
LootTableEventsinstead.