}
else {
this.drawString(minecraft.fontRenderer, this.displayString, this.xPosition, this.yPosition + (this.height - 8) / 2, 0x999999);
}
InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft);
if (tooltipLines != null) {
// Compute hover time
if (isMouseOverButton(i, j)) {
long systemTime = System.currentTimeMillis();
if (prevSystemTime != 0) {
hoverTime += systemTime - prevSystemTime;
}
prevSystemTime = systemTime;
}
else {
hoverTime = 0;
prevSystemTime = 0;
}
// Draw tooltip if hover time is long enough
if (hoverTime > InvTweaksConst.TOOLTIP_DELAY && tooltipLines != null) {
FontRenderer fontRenderer = obf.getFontRenderer();
// Compute tooltip params
int x = i + 12, y = j - LINE_HEIGHT*tooltipLines.length;
if (tooltipWidth == -1) {
for (String line : tooltipLines) {
tooltipWidth = Math.max(
obf.getStringWidth(fontRenderer, line),
tooltipWidth);
}
}
if (x + tooltipWidth > obf.getWindowWidth(obf.getCurrentScreen())) {
x = obf.getWindowWidth(obf.getCurrentScreen()) - tooltipWidth;
}
// Draw background
drawGradientRect(x - 3, y - 3,
x + tooltipWidth + 3, y + LINE_HEIGHT*tooltipLines.length,
0xc0000000, 0xc0000000);
// Draw lines
int lineCount = 0;
for (String line : tooltipLines) {
obf.drawStringWithShadow(fontRenderer,
line, x, y + (lineCount++)*LINE_HEIGHT, -1);
}
}
}