Bernasss12 / BetterEnchantedBooks

Makes it easier to identify different enchantment books.
MIT License
12 stars 9 forks source link

Fix missing tooltip icons when enchantment sorting is disabled #40

Closed Fourmisain closed 2 years ago

Fourmisain commented 3 years ago

When enchantment sorting is disabled, appendEnchantmentsHead() which is responsible for filling cachedTooltipIcons is skipped and thus the icons don't render.

The fix is to simply remove the condition if (ModConfig.configsFirstLoaded && ModConfig.sortingSetting != ModConfig.SortingSetting.DISABLED) { (The first condition should always be true since the config is loaded on title screen.)

I also looked at the tooltip render code again, I'm now much more confident it is actually correct. Instead of applying inverse operations, push()/pop() should be used.

In general, render operations should look like

If matrices is RenderSystem.getModelViewStack() then do RenderSystem.applyModelViewMatrix(); after modifying matrices and matrices.pop().