Legendary Tooltips [Forge]

Legendary Tooltips [Forge]

28M Downloads

Item title tooltip components that use more than 1 font don't display properly

chris-wjn opened this issue ยท 2 comments

commented

The project I'm working on uses a custom font to draw icons in item tooltips. Everything works fine in tandem with LegendaryTooltips except for the title component. I'm trying to display an icon directly after the name of the item, but doing so causes the whole title to only be displayed in the icon font.

commented

Thank you for reporting this, is there some resource pack or mod I can download to test this? I don't currently know of any way to test multiple fonts in tooltip titles myself.

commented

Thank you for reporting this, is there some resource pack or mod I can download to test this? I don't currently know of any way to test multiple fonts in tooltip titles myself.

Not aware of any resource packs/mods that use this. To test it you can quickly make a TTF font in your own mod's data structure, and then use ItemTooltipEvent to edit the name component of items. It should always be index 0 of the component list passed by the event.

To make a TTF font, just put a TTF or OTF file in resources/assets/(namespace)/font/(example.ttf)
then create a json file with proper structure for a font file, which you can find here: https://minecraft.fandom.com/wiki/Resource_pack#Fonts

After that you can just grab the json file as a ResourceLocation and use it in any component with Style.withFont(ResourceLocation;)