SpongePowered / SpongeAPI

A Minecraft plugin API
http://www.spongepowered.org/
MIT License
1.14k stars 342 forks source link

Enhanced Loot Table support #2423

Open ejm opened 2 years ago

ejm commented 2 years ago

Major SpongeAPI version

8

Is this likely to be a breaking change?

Yes

What are you requesting?

Currently, Sponge supports some concept of Loot tables through the LootTable class and related weighted table utility classes, but there's (seemingly) no way to get the loot table of an entity or block entity nor is there any way to set a custom loot table for an entity with the Data API.

Other mod APIs support such operations, such as the Bukkit (Spigot?) API and Forge API, notably using the concept of a LootContext which contains data used by the Vanilla server to calculate drops (the amount of luck the roller has, etc.).

It would be helpful to have such API support in Sponge for use in minigames and utility plugins like "mob stackers." Chances are, this would require changes to the existing weighted table classes to support a LootContext-like object, so this change would likely be breaking.

Thanks!

Lignium commented 1 year ago

I think we can first add keys Keys#LOOT_TABLE with ResourceKey type and Keys#LOOT_TABLE_SEED to assign a generation seed. This will be enough to assign an existing loot table from a data pack to a chest or mob.