Crash while trying to add Apotheosis affix to Mjöllnir
noeppi-noeppi opened this issue · 5 comments
This is a duplicate of #929 which, contrary to what is said there, is still is not fixed in the latest 1.20.1 version. The problem is a stack overflow involving an apotheosis mixin to EnchantmentHelper
:
- EnchantmentHelperMixin#apoth_getDamageBonus calls
AffixHelper.getAffixes
here. - This causes LootCategory.forItem to be called here.
LootCategory.forItem
tests all the validators of the different loot categories in theItemStack
, including theSWORD
validator.- The validator for
LootCategory.SWORD
queries the attribute modifiers here. - Mjöllnir uses
EnchantmentHelper.getDamageBonus
in its implementation ofgetAttributeModifiers
here. - This causes
EnchantmentHelperMixin#apoth_getDamageBonus
to be called forming an infinite loop and crashing with aStackOverflowError
.
The crash can be triggered by putting Mjöllnir into a reforging table and hover over the suggested affix combinations.
I want this issue to be fixed, however, I can't see any good way to do that in MythicBotany, therefore it would be great if Apotheosis could provide some way (maybe through IMC) in which a mod can set the default LootCategory of an item preventing the validators from being called. This would allow me to set the loot category of Mjöllnir to SWORD
manually and prevent the infinite loop.
The previous issue was caused by the same circularity issue but with enchantment levels rather than getDamageBonus
- my opinion here is that you should not be calling getDamageBonus
in this method, as it will cause the actual attack damage of the item to be 2x * getDamageBonus
(which is probably unintentional).
as it will cause the actual attack damage of the item to be
2x * getDamageBonus
I know that and it is intentional.
it does it with no enchants on it also , just clicking the reforger , any level of reforging a plain hammer , with no enchants causes the crash also , this is in ATM 9 , but the previous one was in atm 7 ? one of the ATM worked perfect I think it was 6 no crashes at all from enchanted or unenchanted . 2x dmg is great , silent gears weapons do 5-8k , and the morgan is capped recently to 5k do the damage isnt a big deal .