SilentChaos512 / Treasure-Bags

Minecraft mod: Loot bags created with data packs
MIT License
1 stars 4 forks source link

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

Open TheIllusiveC4 opened 2 years ago

TheIllusiveC4 commented 2 years ago

Versions

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: https://github.com/SilentChaos512/Treasure-Bags/blob/f3c45078e61cb2cda8c3f11d1b42179621eff577/src/main/java/net/silentchaos512/treasurebags/events/EventHandler.java#L64 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.

Darkosto commented 10 months ago

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.