Fix Line endings in tooltips not handled properly in multiplayer screen Closes #7738 (#7739)

This commit is contained in:
JoJoModding authored and GitHub committed 2021-04-30 10:42:15 -07:00
1 parent 929c7b7a0b
commit 5125775992
1 file changed
+5 -4
@@ -172,10 +172,11 @@ public class ClientHooks
Minecraft.getInstance().getTextureManager().bind(iconSheet);
AbstractGui.blit(mStack, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256);
if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26)
//TODO using StringTextComponent here is a hack, we should be using TranslationTextComponents.
gui.setToolTip(Collections.singletonList(new StringTextComponent(tooltip)));
if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26) {
//this is not the most proper way to do it,
//but works best here and has the least maintenance overhead
gui.setToolTip(Arrays.stream(tooltip.split("\n")).map(StringTextComponent::new).collect(Collectors.toList()));
}
}
public static String fixDescription(String description)