draw item overlay scaled

This commit is contained in:
Tom Erik
2016-03-25 20:54:25 +01:00
parent 69048d35fb
commit d1cd667f48

View File

@@ -161,13 +161,35 @@ public abstract class GuiBase extends GuiContainer {
itemRender.renderItemIntoGUI(stack, x, y);
if (withOverlay) {
itemRender.renderItemOverlayIntoGUI(font, stack, x, y, message);
}
renderSlotOverlay(stack, message,x,y);
}
zLevel = 0.0F;
itemRender.zLevel = 0.0F;
}
private void renderSlotOverlay(ItemStack stack, String text, int x, int y) {
if (text != null) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 1);
GL11.glScalef(0.5f, 0.5f, 1);
int stringWidth = fontRendererObj.getStringWidth(text);
GlStateManager.disableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 771);
GlStateManager.disableDepth();
fontRendererObj.drawString(text, 30-stringWidth, 22, 16777215);
GlStateManager.enableDepth();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
}
public void drawString(int x, int y, String message) {
drawString(x, y, message, 4210752);
}