Apotheosis

Apotheosis

79M Downloads

Crash while trying to add Apotheosis affix to Mjöllnir

noeppi-noeppi opened this issue · 5 comments

commented

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 the ItemStack, including the SWORD validator.
  • The validator for LootCategory.SWORD queries the attribute modifiers here.
  • Mjöllnir uses EnchantmentHelper.getDamageBonus in its implementation of getAttributeModifiers here.
  • This causes EnchantmentHelperMixin#apoth_getDamageBonus to be called forming an infinite loop and crashing with a StackOverflowError.

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.

commented

Thanks in advance for looking into this guys , Love both the mods

commented

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).

commented

as it will cause the actual attack damage of the item to be 2x * getDamageBonus

I know that and it is intentional.

commented

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 .

commented

IMC method loot_category_override has been added to Apoth for 7.3.0 - the payload is a Map.Entry<Item, String> where the string is a loot category ID ("sword" in this case).