[Bug] Durability tooltip appearing in wrong order with other mods adding tooltips.
murao-kun opened this issue ยท 8 comments
Version Info
- Minecraft, Any
- Durability Tooltip, Any
Description of the Bug
When ToolStats mod installed along with Durability Tooltip they are looking wrong in the tooltip.
Steps to Reproduce
Mod link: https://www.curseforge.com/minecraft/mc-mods/tool-stats
Install both mods together.
Also same with shield mechanics mod.
Link: https://www.curseforge.com/minecraft/mc-mods/shield-mechanics
To add additional lines to a tooltip, mods can subscribe to the ItemTooltipEvent
event. During this event there's a list of lines mods can add to. All three of these mods, Durability Tooltip, ToolStats, and Shield mechanics, subscribe to the event when the mod is loaded and during the event simply add their lines onto the list.
There is no way for me to put the tooltip line from Durability Tooltip below these two other mods. The order simply depends on which order the mods get loaded in. In most cases, this is simply alphabetically based on file name.
Additionally, this issue occurs with any mod which adds tooltip lines. Choose any mod which happens to be ordered before ToolStats based on file name and their lines will also appear above the lines from ToolStats.
Got you. But I guess the issue still can be fixed by making this mod loading last. There is no other cases why this mod should not load last, cause your tooltip is made to be the last thing in there?
Forge just loads the mods from the 'mods' directory. The mod cannot do anything if it's not loaded... it's just a file. A mod has no influence over when it gets loaded, since well it's not loaded yet.
It seems the ItemTooltipEvent
is actually fired on the Forge event bus and not the mod event bus. This means I can assign a priority to the event subscriber. The options are HIGHEST
, HIGH
, NORMAL
, LOW
, and LOWEST
and the default is NORMAL
. ToolStats, Shield mechanics, and Durability Tooltip currently all use the default priority. I will change the subscriber from Durability Tooltip to LOWEST
so it gets called after the other two mods.
Still, I would also suggest ToolStats and Shield mechanics to change their priority to HIGH
or HIGHEST
. Their tooltips seem to be specifically intended to be directly underneath the vanilla text. Currently any mod which just adds regular text may be in between the two.
Thank you, I will open issues on their side to inform them about that and redirect to this issue. Thank you for a lot of explaining, that really helps to understand what happening.
Whoops sorry, I updated everything this morning then got side tracked trying to get things to upload automatically to CurseForge and Modrinth. Finally got it to work now, so it's available in Durability Tooltip 1.1.3.
Thank you for reporting the issue!