Excessive mod drops from enchanted tool
Saporous opened this issue ยท 10 comments
Versions
- Silent Gear: 1.15.2-1.7.0+93
- Silent's Gems: N/A
- Silent Lib: SilentLib-1.15.2-4.6.1+49.jar
- Forge: 31.2.0
- Modpack: Valhelsia 2 2.21a
- Optifine Installed: No
Expected Behavior
I was expecting a 1-3 extra vanilla and modded items to drop when I enchanted the machete with Fortune 3.
Actual Behavior
Killing an Enderman dropped 4 stacks of the Ender Pearl Fragments from Forbidden&Arcanus v1.15.2-1.3.1. Killing a bat dropped 10+ stacks of Bat Wings also from Forbidden&Arcanus.
Links/Images
https://i.imgur.com/YWmgJdD.png.
Steps to Reproduce the Problem
- Enchant weapon with Fortune 3 and use a Bone for the tool rod (to grant Luck)
- Kill an Enderman or Bat to drop stacks upon stacks of Forbidden&Arcanus items
Really curious about this. I thought luck only affected loot tables entries with "bonus rolls" or a positive "quality"?
The loot tables, for reference:
https://github.com/stal111/Forbidden-Arcanus/blob/1.15/src/main/resources/data/forbidden_arcanus/loot_tables/inject/enderman.json
https://github.com/stal111/Forbidden-Arcanus/blob/1.15/src/main/resources/data/forbidden_arcanus/loot_tables/inject/bat.json
I'm not sure how loot table injection works so I suppose it's possible Forbidden Arcanus is doing something strange there
Forbidden Arcanus seems to be adding bonus rolls to the injected pools: https://github.com/stal111/Forbidden-Arcanus/blob/1.15/src/main/java/com/stal111/forbidden_arcanus/event/LootTableListener.java#L54
But that still doesn't explain why a single entity would drop multiple stacks at once. Should be about double with +1 luck.
I would report this to Forbidden Arcanus (and link back to this issue).
At the very least it was reported on our GitHub issue tracker (Valhelsia) to also be happening with MineColonies NPCs too, so I think a good place to start with is to look at the code of both mods and see where the similarities lie and how they're different to some other loot.
I'll try to take some time tonight to investigate and I'll let you know if I find out, so that you can either close this issue or fix it, depending on where the cause ends up being. I haven't had a chance to even really look at the code for the mods involved yet.
Update: It's pretty safe to say that this isn't anything to do with Silent Gear: Dungeon Chests also have greatly increased quantities of Forbidden and Arcanus loot in them.
Hmm, actually, never mind. I hadn't realised that the Lucky trait was added recently, so I can't rule it out completely yet. I think I commented too early since I wasn't aware that Silent Gear could be impacting Dungeon Chest loot tables too. I also hadn't thought about when Forbidden and Arcanus last updated and when this bug started occurring.
Luck is a Vanilla attribute. Does the same thing happen with just Forbidden Arcanus and using /effect give @p luck
?
Ok, I've got some sort of repeatable system. Using the grindstone on a SG weapon with the lapis upgrade (Luck +2) applied removes the enchantments but for some reason increases F&A drops. Then, killing a bat with the disenchanted SG sword yields about 30 Bat Wings. Going forwards, killing an enemy with any weapon drops 30+ bat wings. Looting and luck increases drops further, possibly explaining the 5 - 8 stacks of bat wings I personally experienced in my world.
One thing I also noticed but needs more testing is that enchanting the looting sword with more enchantments increases the drops further, even enchantments that would otherwise be unrelated such as CoFH Leech and Vorpal.
Exiting the world and reentering it does not fix this issue. One only needs to kill a mob with the disenchanted SG sword and all further weapons have luck applied to F&A drops. A full Minecraft restart is required. Memory usage increases each time I close and open the world to the point that garbage collection happens every few seconds, but this may be related to the modpack itself.
I figured it out after some testing. Every time you deselect and then select a Lucky sword on the hotbar the luck increases, stacking again and again. It doesn't decrease again until reloading the world. You can get an insane amount of luck just by putting the sword in slot 1 and then tapping 1, 2, 1, 2, 1, 2 over and over again.
I am not sure if other attributes are impacted by the same thing as I haven't delved deep into the code yet.
Confirmed, attribute modifiers added by traits are not being removed. Every time the item is equipped you get a new stacking modifier added to your player. Looking for a fix.