Fixed tooltip background being too short for long tooltips

This commit is contained in:
mezz committed 2014-09-18 01:51:23 -07:00
1 parent 05c58ff7a9
commit 2c1224eec0
1 file changed
+21 -19
@@ -320,38 +320,40 @@ public abstract class GuiForestry<T extends TileForestry> extends GuiContainer {
int left = this.guiLeft;
int top = this.guiTop;
int lenght = 0;
int length = 0;
int height = 0;
int x;
int y;
for (ToolTipLine tip : toolTips) {
y = this.fontRendererObj.getStringWidth(tip.text);
if (y > lenght)
lenght = y;
height += 10 + tip.getSpacing();
if (y > length)
length = y;
}
x = mouseX - left + 12;
y = mouseY - top - 12;
int var14 = 8;
if (toolTips.size() > 1)
var14 += 2 + (toolTips.size() - 1) * 10;
this.zLevel = 300.0F;
itemRender.zLevel = 300.0F;
int var15 = -267386864;
this.drawGradientRect(x - 3, y - 4, x + lenght + 3, y - 3, var15, var15);
this.drawGradientRect(x - 3, y + var14 + 3, x + lenght + 3, y + var14 + 4, var15, var15);
this.drawGradientRect(x - 3, y - 3, x + lenght + 3, y + var14 + 3, var15, var15);
this.drawGradientRect(x - 4, y - 3, x - 3, y + var14 + 3, var15, var15);
this.drawGradientRect(x + lenght + 3, y - 3, x + lenght + 4, y + var14 + 3, var15, var15);
int var16 = 1347420415;
int var17 = (var16 & 16711422) >> 1 | var16 & -16777216;
this.drawGradientRect(x - 3, y - 3 + 1, x - 3 + 1, y + var14 + 3 - 1, var16, var17);
this.drawGradientRect(x + lenght + 2, y - 3 + 1, x + lenght + 3, y + var14 + 3 - 1, var16, var17);
this.drawGradientRect(x - 3, y - 3, x + lenght + 3, y - 3 + 1, var16, var16);
this.drawGradientRect(x - 3, y + var14 + 2, x + lenght + 3, y + var14 + 3, var17, var17);
Color backgroundColor = new Color(16, 0, 16, 240);
int backgroundColorInt = backgroundColor.getRGB();
this.drawGradientRect(x - 3, y - 4, x + length + 2, y - 3, backgroundColorInt, backgroundColorInt);
this.drawGradientRect(x - 3, y + height + 1, x + length + 2, y + height + 2, backgroundColorInt, backgroundColorInt);
this.drawGradientRect(x - 3, y - 3, x + length + 2, y + height + 1, backgroundColorInt, backgroundColorInt);
this.drawGradientRect(x - 4, y - 3, x - 3, y + height + 1, backgroundColorInt, backgroundColorInt);
this.drawGradientRect(x + length + 2, y - 3, x + length + 3, y + height + 1, backgroundColorInt, backgroundColorInt);
Color borderColorTop = new Color(80, 0, 255, 80);
int borderColorTopInt = borderColorTop.getRGB();
Color borderColorBottom = new Color((borderColorTopInt & 0xfefefe) >> 1 | borderColorTopInt & -0x1000000, true);
int borderColorBottomInt = borderColorBottom.getRGB();
this.drawGradientRect(x - 3, y - 3 + 1, x - 3 + 1, y + height, borderColorTopInt, borderColorBottomInt);
this.drawGradientRect(x + length + 1, y - 3 + 1, x + length + 2, y + height, borderColorTopInt, borderColorBottomInt);
this.drawGradientRect(x - 3, y - 3, x + length + 2, y - 3 + 1, borderColorTopInt, borderColorTopInt);
this.drawGradientRect(x - 3, y + height, x + length + 2, y + height + 1, borderColorBottomInt, borderColorBottomInt);
for (ToolTipLine tip : toolTips) {
String line = tip.text;