Enchantment Descriptions

Enchantment Descriptions

153M Downloads

Freezes with limitless present

nnym opened this issue ยท 6 comments

commented

My mod limitless raises the maximum levels of enchantments up to 2^31 - 1. This combined with iteration over all levels of an enchantment leads to excessive memory usage and a permanent freeze. REI appears to add enchanted stacks by using EnchantedBookItem#fillItemCategory (which limitless handles) so I believe that the best solution is for Enchantment Descriptions to do the same.

commented

I believe that the REI code you linked is using that approach to create a display stack however I am using it as an input stack meaning all levels need to be accepted. There is definitely some room for optimization here but I am not familiar enough with REI's API to know where or even if these changes can be made with the current API. I will look further into this.

commented

This is not an issue for "Rooms of optimisation", no matter what you do you can't optimise adding 2 million entries to REI for each and every enchantment present. Either limitless could handle this by modifying how enchantment description works, or enchantment description can only iterate between level 1 to 10 plus the additional max level as an example.

commented

...limitless could handle this by modifying how enchantment description works....

Thanks for the reminder. I've implemented it in https://github.com/auoeke/limitless/commit/d404e0d06dd46157f47b637a946d6536890a98a0#diff-d9a8c1e4e168cf373e7b378c7ea41ba444b2fa3abe3482dd99d65c5bdcec8391. This solution does not involve any limitless classes and that's why I suggested that it be implemented in Enchantment Descriptions instead.

commented

This is not an issue for "Rooms of optimisation", no matter what you do you can't optimise adding 2 million entries to REI for each and every enchantment present. Either limitless could handle this by modifying how enchantment description works, or enchantment description can only iterate between level 1 to 10 plus the additional max level as an example.

This absolutely is an issue where things can be optimized away. As we discussed on Discord the level is not important for these displays and can be registered 1:1 with enchantments. The reason levels are being used currently is to allow players to lookup the description display using items they acquire while playing the game rather than searching the enchantment book up in REI. You discussed a live display generator which seems like the right approach here.

commented

...limitless could handle this by modifying how enchantment description works....

Thanks for the reminder. I've implemented it in auoeke/limitless@d404e0d#diff-d9a8c1e4e168cf373e7b378c7ea41ba444b2fa3abe3482dd99d65c5bdcec8391. This solution does not involve any limitless classes and that's why I suggested that it be implemented in Enchantment Descriptions instead.

Your solution also does not address the issue properly which is why I have not implemented it. Also your Mixin based approach to patching this is very irresponsible.

commented

A flawed workaround is better than nothing. This issue has been open for over a month so I figured that I ought to do something. I intend to remove my workaround should you fix the issue on your side.