fabric/fabric-loot-api-v2
LLytho 6f9f09e0c4 Add LootTableEvents.LOADED event (#3352)
* Implement `LootTableEvents.LOADED` event

* Update for checkstyle

* rename event

* Update fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/api/loot/v2/LootTableEvents.java

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>

---------

Co-authored-by: modmuss <modmuss50@gmail.com>
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
(cherry picked from commit 96dfa9590d)
(cherry picked from commit 3ba460fb29)
2023-10-08 13:06:23 +01:00
..
src Add LootTableEvents.LOADED event (#3352) 2023-10-08 13:06:23 +01:00
build.gradle Update to loom 1.3 and use Mod Publish Plugin (#3158) 2023-08-02 18:51:21 +01:00
README.md Loot table API v2 2022-05-31 13:09:54 +01:00

Fabric Loot API (v2)

This module includes APIs for modifying and creating loot tables.

Loot table events

This class provides two events for modifying loot tables.

LootTableEvents.REPLACE runs first and lets you replace loot tables completely.

LootTableEvents.MODIFY runs after and lets you modify loot tables, including the ones created in REPLACE, by adding new loot pools or loot functions to them.

Loot table sources

Both events have access to a loot table source that you can use to check where a loot table is loaded from.

For example, you can use this to check if a loot table is from a user data pack and not modify the user-provided data in your event.

Enhanced loot table and loot pool builders

LootTable.Builder and LootPool.Builder implement injected interfaces (FabricLootTableBuilder and FabricLootPoolBuilder) which have additional methods for dealing with already-built objects and collections of objects.

Those interfaces also have copyOf methods for creating copies of existing loot tables/pools as builders.