Treasure Bags

Treasure Bags

3M Downloads

[Bug] Treasure Bags causes Global Loot Modifiers to run twice

TheIllusiveC4 opened this issue ยท 1 comments

commented

Versions

  • Treasure Bags: 1.18.2-1.7.0
  • Forge: 40.1.73
  • Modpack (if applicable): Custom

Expected behavior

Using a mod that adds loot using a GLM, the loot should only be added once.

Actual behaviour

Using a mod that adds loot using a GLM, the loot is doubled.

Steps to reproduce the problem

  1. Install the above Treasure Bags and Forge versions.
  2. Install Champions 1.18.2-2.1.5.6.
  3. Enter a world and run /champions summon spider 1.
  4. Kill the spider and observe that instead of a single enchanted book, it drops two.

I believe the problem lies here:

List<ItemStack> list = lootTable.getRandomItems(contextBuilder.create(LootContextParamSets.ENTITY));

Global Loot Modifiers have already been processed before the LivingDropsEvent fires. Calling lootTable.getRandomItems(context) will cause all Global Loot Modifiers to fire again for the same collection of drops.

commented

Has there been any new information regarding this issue? It's still a problem in 1.20.1 and causing all of my custom CraftTweaker scripts to drop much more than intended.