Skip to content

Instantly share code, notes, and snippets.

@ethernet8023
Created August 27, 2013 19:32
Show Gist options
  • Select an option

  • Save ethernet8023/6357977 to your computer and use it in GitHub Desktop.

Select an option

Save ethernet8023/6357977 to your computer and use it in GitHub Desktop.
tooltip thing
if (this.mc.gameSettings.heldItemTooltips)
{
this.mc.mcProfiler.startSection("toolHighlight");
if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null)
{
s1 = this.highlightingItemStack.getDisplayName();
k1 = (k - fontrenderer.getStringWidth(s1)) / 2;
i2 = l - 59;
if (!this.mc.playerController.shouldDrawHUD())
{
i2 += 14;
}
j2 = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);
if (j2 > 255)
{
j2 = 255;
}
if (j2 > 0)
{
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24));
FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack);
if (font != null)
{
k1 = (k - font.getStringWidth(s1)) / 2;
font.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24));
}
else
{
fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24));
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
this.mc.mcProfiler.endSection();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment