zabi94 / ExtraAlchemy

Extra Alchemy: a Minecraft mod that expands on potions
Other
38 stars 16 forks source link

Tooltip is too long #105

Closed gralp-1 closed 3 years ago

gralp-1 commented 3 years ago

Describe the bug The tooltip for the potion ring goes off the screen

To Reproduce Steps to reproduce the behaviour:

  1. Hover over the potion ring to show the tooltip

Expected behaviour I think it should break into a new line

Screenshots image

Environment (please complete the following information):

Additional context I think adding a \n should fix it.

zabi94 commented 3 years ago

For now https://www.curseforge.com/minecraft/mc-mods/tooltipfix should do the trick. I'll fix this eventually on the mod alone, but since it only happens on misconfigured rings this should not be a very common issue to begin with.

A newline in the tooltip should not work actually, tooltips are divided into lines by adding different objects to a list, and splitting them is not as straightforward as one would think

gralp-1 commented 3 years ago

I've found a fix for it. just replace the tooltip.add() with this:

tooltip.add(new LiteralText("Error: rings must have exactly").formatted(Formatting.RED, Formatting.BOLD)); tooltip.add(new LiteralText("1 potion effect applied to them").formatted(Formatting.RED, Formatting.BOLD));

I tested this and got this: image

obviously, you can change it wherever you see fit.

zabi94 commented 3 years ago

Yes, that would be the correct way to fix it. However, I still think that would look weird if someone has a bigger screen and the tooltip just breaks in half, so I plan on letting the mod I linked in my first message do the proper line wrapping dynamically