Modify Drops API
Modify Drops API provides developers with advanced capabilities for managing item drops in Minecraft. This tool creates complex and context-dependent drop systems, originally developed for Chest Cavity and Hellish Materials mods, but equally useful for any content creator wanting complete control over loot tables.
How It Works
When the game generates loot from a drop table (even if the result is empty), the API sequentially triggers three events: GenerateLootCallbackAddLoot, GenerateLootCallbackModifyLoot, and GenerateLootCallbackAddUnmodifiableLoot.
GenerateLootCallbackAddLoot handlers accept the loot context type (LootContextType) and the context itself (LootContext), returning an item list (List
GenerateLootCallbackModifyLoot receives the same parameters plus the current list of dropping items and returns a new list that completely replaces the old one. As with AddLoot, simplified versions for working with entities and blocks are also provided here.
GenerateLootCallbackAddUnmodifiableLoot functions similarly to AddLoot but executes after ModifyLoot, making it ideal for adding items that should not be modified by other handlers.
Project Integration
To use Modify Drops API in your mod, add the following line to the dependencies section of your build.gradle file:
modApi "com.github.tigereye504:modify-drops-api:x.x.x"
If necessary, you can embed the API directly into your mod by adding an additional dependency:
include "com.github.tigereye504:modify-drops-api:x.x.x"
Where x.x.x is the version of the API you want to use.