mezz/ModNameTooltip

World Tooltips mod

SpGilbert opened this issue · 3 comments

When this mod is downloaded the item description name appears twice when the item is on the ground and looked at with world tooltips.

https://www.curseforge.com/minecraft/mc-mods/mod-name-tooltip
https://www.curseforge.com/minecraft/mc-mods/world-tooltips

mezz commented

Thanks for the report!

ModNameTooltip checks that the mod name is not already added, so that it doesn't cause duplicates. I think that World Tooltips is adding the mod name after ModNameTooltip, which I can't prevent.

Please report this to World Tooltips and link back here so we can work together on a solution.
ModNameTooltip is open source (MIT) and they are welcome to reuse my code to prevent duplicates too.

private static boolean isModNameAlreadyPresent(List<ITextComponent> tooltip, String modName) {
if (tooltip.size() > 1) {
ITextComponent line = tooltip.get(tooltip.size() - 1);
String lineString = line.getString();
String withoutFormatting = TextFormatting.getTextWithoutFormattingCodes(lineString);
return modName.equals(withoutFormatting);
}
return false;
}

World tooltips is fixing this problem in the next version after I reported it to them.