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 Summary
Modifier and TypeClassDescriptionstatic interface
Deprecated.static interface
Deprecated.static interface
Deprecated. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Event
<LootTableEvents.Loaded> Deprecated.Please useLootTableEvents.ALL_LOADED
instead.static final Event
<LootTableEvents.Modify> Deprecated.Please useLootTableEvents.MODIFY
instead.static final Event
<LootTableEvents.Replace> Deprecated.Please useLootTableEvents.REPLACE
instead. -
Method Summary
-
Field Details
-
REPLACE
Deprecated.Please useLootTableEvents.REPLACE
instead.This event can be used to replace loot tables. If a loot table is replaced, the iteration will stop for that loot table. -
MODIFY
Deprecated.Please useLootTableEvents.MODIFY
instead.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 table
We'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_LOADED
Deprecated.Please useLootTableEvents.ALL_LOADED
instead.This event can be used for post-processing after all loot tables have been loaded and modified by Fabric.
-
LootTableEvents
instead.