Example usage for org.lwjgl.opengl GL11 glColor4f

List of usage examples for org.lwjgl.opengl GL11 glColor4f

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glColor4f.

Prototype

public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);

Source Link

Document

Float version of #glColor4b Color4b

Usage

From source file:cn.liutils.cgui.gui.component.Outline.java

License:Open Source License

public Outline() {
    super("Outline");

    addEventHandler(new FrameEventHandler() {

        @Override/*from w w  w.  j a  v  a2 s.  co m*/
        public void handleEvent(Widget w, FrameEvent event) {
            color.bind();
            HudUtils.drawRectOutline(0, 0, w.transform.width, w.transform.height, lineWidth);
            GL11.glColor4f(1, 1, 1, 1);
        }

    });
}

From source file:cn.liutils.util.RenderUtils.java

License:Open Source License

public static void bindIdentity() {
    GL11.glColor4f(1, 1, 1, 1);
}

From source file:co.uk.mattredmond.basewatcher.inventory.GuiBaseWatcherCore.java

License:Open Source License

/**
 * Draws the specified GUI on the screen
 * @param f Color value (Might be wrong)
 * @param x X position to draw GUI (Might be wrong)
 * @param y Y position to draw GUI (Might be wrong)
 *///  www  . ja  va 2s . c  o  m
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1, 1, 1, 1);

    // Bind the texture
    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);

    // drawTexturedModalRect(xPos, yPos, xOffset, yOffset, xDimension, yDimension)
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

From source file:co.uk.silvania.rpgcore.client.skillgui.GuiScrollingList_Mod.java

License:Open Source License

public void drawScreen(int mouseX, int mouseY, float p_22243_3_) {
    this.mouseX = mouseX;
    this.mouseY = mouseY;
    this.drawBackground();
    int listLength = this.getSize();
    int scrollBarXStart = this.left + this.listWidth - 6;
    int scrollBarXEnd = scrollBarXStart + 6;
    int boxLeft = this.left;
    int boxRight = scrollBarXStart - 1;
    int var10;
    int var11;
    int var13;
    int var19;

    var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4;
    var11 = var10 / this.slotHeight;

    //Tells the GUI which element we're hovering over, for tooltip rendering.
    if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) {
        hoverElement = var11;
    }//from ww  w. jav a  2 s  .  c  o m

    if (Mouse.isButtonDown(0)) {
        if (this.initialMouseClickY == -1.0F) {
            boolean var7 = true;

            if (mouseY >= this.top && mouseY <= this.bottom) {
                var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4;
                var11 = var10 / this.slotHeight;

                if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) {
                    boolean var12 = var11 == this.selectedIndex
                            && System.currentTimeMillis() - this.lastClickTime < 250L;
                    this.elementClicked(var11, var12);
                    this.selectedIndex = var11;
                    this.lastClickTime = System.currentTimeMillis();
                } else if (mouseX >= boxLeft && mouseX <= boxRight && var10 < 0) {
                    this.func_27255_a(mouseX - boxLeft, mouseY - this.top + (int) this.scrollDistance - 4);
                    var7 = false;
                }

                if (mouseX >= scrollBarXStart && mouseX <= scrollBarXEnd) {
                    this.scrollFactor = -1.0F;
                    var19 = this.getContentHeight() - (this.bottom - this.top - 4);

                    if (var19 < 1) {
                        var19 = 1;
                    }

                    var13 = (int) ((float) ((this.bottom - this.top) * (this.bottom - this.top))
                            / (float) this.getContentHeight());

                    if (var13 < 32) {
                        var13 = 32;
                    }

                    if (var13 > this.bottom - this.top - 8) {
                        var13 = this.bottom - this.top - 8;
                    }

                    this.scrollFactor /= (float) (this.bottom - this.top - var13) / (float) var19;
                } else {
                    this.scrollFactor = 1.0F;
                }

                if (var7) {
                    this.initialMouseClickY = (float) mouseY;
                } else {
                    this.initialMouseClickY = -2.0F;
                }
            } else {
                this.initialMouseClickY = -2.0F;
            }
        } else if (this.initialMouseClickY >= 0.0F) {
            this.scrollDistance -= ((float) mouseY - this.initialMouseClickY) * this.scrollFactor;
            this.initialMouseClickY = (float) mouseY;
        }
    } else {
        while (Mouse.next()) {
            int var16 = Mouse.getEventDWheel();

            if (var16 != 0) {
                if (var16 > 0) {
                    var16 = -1;
                } else if (var16 < 0) {
                    var16 = 1;
                }

                this.scrollDistance += (float) (var16 * this.slotHeight / 2);
            }
        }

        this.initialMouseClickY = -1.0F;
    }

    this.applyScrollLimits();
    Tessellator var18 = Tessellator.instance;
    if (this.client.theWorld != null) {
        this.drawGradientRect(this.left, this.top, this.right, this.bottom, -1072689136, -804253680);
    } else {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_FOG);
        this.client.renderEngine.bindTexture(Gui.optionsBackground);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        float var17 = 32.0F;
        var18.startDrawingQuads();
        var18.setColorOpaque_I(2105376);
        var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D,
                (double) ((float) this.left / var17),
                (double) ((float) (this.bottom + (int) this.scrollDistance) / var17));
        var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D,
                (double) ((float) this.right / var17),
                (double) ((float) (this.bottom + (int) this.scrollDistance) / var17));
        var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D,
                (double) ((float) this.right / var17),
                (double) ((float) (this.top + (int) this.scrollDistance) / var17));
        var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / var17),
                (double) ((float) (this.top + (int) this.scrollDistance) / var17));
        var18.draw();
    }
    //boxRight = this.listWidth / 2 - 92 - 16;
    var10 = this.top + 4 - (int) this.scrollDistance;

    if (this.field_27262_q) {
        this.func_27260_a(boxRight, var10, var18);
    }

    int var14;

    for (var11 = 0; var11 < listLength; ++var11) {
        var19 = var10 + var11 * this.slotHeight + this.field_27261_r;
        var13 = this.slotHeight - 4;

        if (var19 <= this.bottom && var19 + var13 >= this.top) {
            if (this.field_25123_p && this.isSelected(var11)) {
                var14 = boxLeft;
                int var15 = boxRight;
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                var18.startDrawingQuads();
                var18.setColorOpaque_I(8421504);
                var18.addVertexWithUV((double) var14, (double) (var19 + var13 + 2), 0.0D, 0.0D, 1.0D);
                var18.addVertexWithUV((double) var15, (double) (var19 + var13 + 2), 0.0D, 1.0D, 1.0D);
                var18.addVertexWithUV((double) var15, (double) (var19 - 2), 0.0D, 1.0D, 0.0D);
                var18.addVertexWithUV((double) var14, (double) (var19 - 2), 0.0D, 0.0D, 0.0D);
                var18.setColorOpaque_I(0);
                var18.addVertexWithUV((double) (var14 + 1), (double) (var19 + var13 + 1), 0.0D, 0.0D, 1.0D);
                var18.addVertexWithUV((double) (var15 - 1), (double) (var19 + var13 + 1), 0.0D, 1.0D, 1.0D);
                var18.addVertexWithUV((double) (var15 - 1), (double) (var19 - 1), 0.0D, 1.0D, 0.0D);
                var18.addVertexWithUV((double) (var14 + 1), (double) (var19 - 1), 0.0D, 0.0D, 0.0D);
                var18.draw();
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }

            this.drawSlot(var11, boxRight, var19, var13, var18);
        }
    }

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    byte var20 = 4;

    if (this.client.theWorld == null) {
        this.overlayBackground(0, this.top, 255, 255);
        this.overlayBackground(this.bottom, this.listHeight, 255, 255);
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    var18.startDrawingQuads();
    var18.setColorRGBA_I(0, 0);
    var18.addVertexWithUV((double) this.left, (double) (this.top + var20), 0.0D, 0.0D, 1.0D);
    var18.addVertexWithUV((double) this.right, (double) (this.top + var20), 0.0D, 1.0D, 1.0D);
    var18.setColorRGBA_I(0, 255);
    var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D);
    var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D);
    var18.draw();
    var18.startDrawingQuads();
    var18.setColorRGBA_I(0, 255);
    var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D);
    var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D);
    var18.setColorRGBA_I(0, 0);
    var18.addVertexWithUV((double) this.right, (double) (this.bottom - var20), 0.0D, 1.0D, 0.0D);
    var18.addVertexWithUV((double) this.left, (double) (this.bottom - var20), 0.0D, 0.0D, 0.0D);
    var18.draw();
    var19 = this.getContentHeight() - (this.bottom - this.top - 4);

    if (var19 > 0) {
        var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();

        if (var13 < 32) {
            var13 = 32;
        }

        if (var13 > this.bottom - this.top - 8) {
            var13 = this.bottom - this.top - 8;
        }

        var14 = (int) this.scrollDistance * (this.bottom - this.top - var13) / var19 + this.top;

        if (var14 < this.top) {
            var14 = this.top;
        }

        var18.startDrawingQuads();
        var18.setColorRGBA_I(0, 255);
        var18.addVertexWithUV((double) scrollBarXStart, (double) this.bottom, 0.0D, 0.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) this.bottom, 0.0D, 1.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) this.top, 0.0D, 1.0D, 0.0D);
        var18.addVertexWithUV((double) scrollBarXStart, (double) this.top, 0.0D, 0.0D, 0.0D);
        var18.draw();
        var18.startDrawingQuads();
        var18.setColorRGBA_I(8421504, 255);
        var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13), 0.0D, 0.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) (var14 + var13), 0.0D, 1.0D, 1.0D);
        var18.addVertexWithUV((double) scrollBarXEnd, (double) var14, 0.0D, 1.0D, 0.0D);
        var18.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D);
        var18.draw();
        var18.startDrawingQuads();
        var18.setColorRGBA_I(12632256, 255);
        var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13 - 1), 0.0D, 0.0D, 1.0D);
        var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) (var14 + var13 - 1), 0.0D, 1.0D, 1.0D);
        var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) var14, 0.0D, 1.0D, 0.0D);
        var18.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D);
        var18.draw();
    }

    this.func_27257_b(mouseX, mouseY);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:co.uk.silvania.rpgcore.client.skillgui.GuiScrollingList_Mod.java

License:Open Source License

private void overlayBackground(int p_22239_1_, int p_22239_2_, int p_22239_3_, int p_22239_4_) {
    Tessellator var5 = Tessellator.instance;
    this.client.renderEngine.bindTexture(Gui.optionsBackground);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float var6 = 32.0F;
    var5.startDrawingQuads();
    var5.setColorRGBA_I(4210752, p_22239_4_);
    var5.addVertexWithUV(0.0D, (double) p_22239_2_, 0.0D, 0.0D, (double) ((float) p_22239_2_ / var6));
    var5.addVertexWithUV((double) this.listWidth + 30, (double) p_22239_2_, 0.0D,
            (double) ((float) (this.listWidth + 30) / var6), (double) ((float) p_22239_2_ / var6));
    var5.setColorRGBA_I(4210752, p_22239_3_);
    var5.addVertexWithUV((double) this.listWidth + 30, (double) p_22239_1_, 0.0D,
            (double) ((float) (this.listWidth + 30) / var6), (double) ((float) p_22239_1_ / var6));
    var5.addVertexWithUV(0.0D, (double) p_22239_1_, 0.0D, 0.0D, (double) ((float) p_22239_1_ / var6));
    var5.draw();/*w  w  w.  j a  va2  s  .com*/
}

From source file:com.aerialmage.magnetchem.GUI.MagFurnaceGui.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    // new "bind tex"
    this.mc.getTextureManager()
            .bindTexture(new ResourceLocation("amp", "textures/gui/magneticinductionfurnace.png"));
    int x = (width - 184) / 2;
    int y = (height - 202) / 2;
    drawTexturedModalRect(x, y, 0, 0, 175, 202);
    if (inventory != null) {
        int i1 = (int) this.inventory.gauss / 1000;
        //System.out.println("got inventory, gauss: "+i1);
        //int i2 = 72-i1;
        if (i1 < 72000)
            this.drawTexturedModalRect(x + 6, y + 6 + 72 - i1, 176, 72 - i1, 16, i1);
        else// w  w w. j  a v  a  2s.com
            this.drawTexturedModalRect(x + 6, y + 6, 176, 0, 16, 72);
    }
    drawContainerGUI();
}

From source file:com.aerialmage.magnetchem.GUI.WorldgenLiquifierGui.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    // new "bind tex"
    this.mc.getTextureManager().bindTexture(new ResourceLocation("amp", "textures/gui/worldgenliquifier.png"));
    int x = (width - 184) / 2;
    int y = (height - 202) / 2;
    drawTexturedModalRect(x, y, 0, 0, 175, 202);
    if (inventory != null) {
        int i1 = (int) this.inventory.gauss / 1000;
        //System.out.println("got inventory, gauss: "+i1);
        //int i2 = 72-i1;
        if (i1 < 72000)
            this.drawTexturedModalRect(x + 6, y + 6 + 72 - i1, 176, 72 - i1, 16, i1);
        else//from  w  w  w  .  ja va2  s .  c o m
            this.drawTexturedModalRect(x + 6, y + 6, 176, 0, 16, 72);
        drawTexturedModalRect(x + 80, y + 35, 193, 0, this.inventory.phase / 4, 15);

    }
    //System.out.println("tank found to contain ");
    if (inventory.tank.amount > 0) {
        FluidStack liquid = inventory.tank;
        int squaled = (int) (((float) liquid.amount / 4000f) * 63);

        int start = 0;

        IIcon liquidIcon = null;
        Fluid fluid = liquid.getFluid();
        //System.out.println("displaying gauge for "+liquid.getFluid().getLocalizedName());
        if (fluid != null && fluid.getStillIcon() != null) {
            liquidIcon = fluid.getStillIcon();
        }
        mc.renderEngine.bindTexture(BLOCK_TEXTURE);

        if (liquidIcon != null) {
            //System.out.println("drawing liquid");

            int offset = 0;
            while (squaled > 0) {
                int tx;

                if (squaled > 11) {
                    tx = 11;
                    squaled -= 11;
                } else {
                    tx = squaled;
                    squaled = 0;
                }

                //drawTexturedModelRectFromIcon(j + col, k + line + 58 - x - start, liquidIcon, 16, 16 - (16 - x));
                drawTexturedModelRectFromIcon(x + 116, y + 74 - tx - offset, liquidIcon, 11, 16 - (16 - tx));
                offset += 11;
            }
        }
    }
    this.mc.getTextureManager().bindTexture(new ResourceLocation("amp", "textures/gui/worldgenliquifier.png"));
    drawTexturedModalRect(x + 116, y + 11, 193, 15, 15, 62);

    //drawContainerGUI();
}

From source file:com.aerialmage.magnetchem.GUI.WorldgenRegeneratorGui.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    ((WorldgenRegeneratorContainer) inventorySlots).redoLayout();
    //System.out.println("F: "+f+", I: "+i+", J: "+j);
    mouseMovedOrUp(i, j, -1);//  www.  j ava 2 s  .co m
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    // new "bind tex"
    this.mc.getTextureManager().bindTexture(myBG);
    x = (width - 184) / 2;
    y = (height - 202) / 2;
    drawTexturedModalRect(x, y, 0, 0, 175, 202);

    drawTexturedModalRect(x + 152, y + 57, 176, 73 + 16 * button1Phase, 16, 16);
    drawTexturedModalRect(x + 133, y + 57, 176, 121 + 16 * button2Phase, 16, 16);

    drawTexturedModalRect(x + 152, y + 10, 192, 121 + 16 * button3Phase, 16, 16);
    drawTexturedModalRect(x + 133, y + 10, 208, 121 + 16 * button4Phase, 16, 16);
    if (inventory != null) {
        int i1 = (int) this.inventory.gauss / 1000;
        //System.out.println("got inventory, gauss: "+i1);
        //int i2 = 72-i1;
        if (i1 < 72000)
            this.drawTexturedModalRect(x + 6, y + 6 + 72 - i1, 176, 72 - i1, 16, i1);
        else
            this.drawTexturedModalRect(x + 6, y + 6, 176, 0, 16, 72);
        //System.out.println("got inventory, gauss: "+i1);
        //int i2 = 72-i1;
    }

    if (inventory.tank.amount > 0) {
        FluidStack liquid = inventory.tank;
        int squaled = (int) (((float) liquid.amount / 4000f) * 63);

        IIcon liquidIcon = null;
        Fluid fluid = liquid.getFluid();
        //System.out.println("displaying gauge for "+liquid.getFluid().getLocalizedName());
        if (fluid != null && fluid.getStillIcon() != null) {
            liquidIcon = fluid.getStillIcon();
        }
        mc.renderEngine.bindTexture(BLOCK_TEXTURE);

        if (liquidIcon != null) {
            //System.out.println("drawing liquid");

            int offset = 0;
            while (squaled > 0) {
                int tx;

                if (squaled > 11) {
                    tx = 11;
                    squaled -= 11;
                } else {
                    tx = squaled;
                    squaled = 0;
                }

                //drawTexturedModelRectFromIcon(j + col, k + line + 58 - x - start, liquidIcon, 16, 16 - (16 - x));
                drawTexturedModelRectFromIcon(x + 25, y + 71 - tx - offset, liquidIcon, 11, 16 - (16 - tx));
                offset += 11;
            }
        }
    }

    this.mc.getTextureManager().bindTexture(myBG);
    drawTexturedModalRect(x + 25, y + 8, 193, 15, 15, 62);

    drawContainerGUI();
}

From source file:com.aesireanempire.eplus.gui.GuiModTable.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glDisable(GL11.GL_LIGHTING);/*from   w  w w . j  a  va 2  s  . c  om*/
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    mc.renderEngine.bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

    for (final GuiItem item : enchantmentArray) {
        if (item.yPos < guiTop + 15 || item.yPos >= guiTop + 87) {
            item.show(false);
        } else {
            item.show(true);
        }
        item.draw();
    }
}

From source file:com.aesireanempire.eplus.gui.GuiModTable.java

License:LGPL

@SuppressWarnings("unchecked")
@Override/*  w w w.  ja  v a 2  s  .c  o m*/
public void drawScreen(int par1, int par2, float par3) {
    super.drawScreen(par1, par2, par3);

    final int adjustedMouseX = par1 - guiLeft;
    final int adjustedMouseY = par2 - guiTop;

    mc.renderEngine.bindTexture(texture);

    int tempY = adjustedMouseY - 16;
    if (tempY <= 0) {
        tempY = 0;
    }
    if (tempY >= 57) {
        tempY = 57;
    }
    sliderIndex = sliding ? MathHelper.round(tempY / 57D * enchantingPages, .25) : sliderIndex;

    if (sliderIndex >= enchantingPages) {
        sliderIndex = enchantingPages;
    }

    double sliderY = sliding ? tempY : 57 * (sliderIndex / enchantingPages);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    drawTexturedModalRect(guiLeft + guiOffset + 180, guiTop + 16 + (int) sliderY, 0, 182, 12, 15);

    if (!clicked && Mouse.isButtonDown(0)) {
        for (final GuiItem item : enchantmentArray) {
            if (getItemFromPos(par1, par2) == item && !item.disabled && !item.locked) {
                item.dragging = true;
            }
        }
        if (adjustedMouseX <= 191 + guiOffset && adjustedMouseX >= 180 + guiOffset) {
            if (enchantingPages != 0) {
                sliding = true;
            }
        }
    }

    for (final GuiItem item : enchantmentArray) {
        if (item.dragging && getItemFromPos(par1, par2) != item) {
            item.dragging = false;
        }
    }

    if (!Mouse.isButtonDown(0)) {
        for (final GuiItem item : enchantmentArray) {
            if (getItemFromPos(par1, par2) == item) {
                item.dragging = false;
            }
        }
        if (adjustedMouseX <= 191 + guiOffset && adjustedMouseX >= 180 + guiOffset) {
            sliding = false;
        }
    }

    clicked = Mouse.isButtonDown(0);

    for (final GuiItem item : enchantmentArray) {
        if (item.dragging) {
            item.scroll(adjustedMouseX - 36);
        }
    }
    if (EnchantingPlus.Debug) {
        fontRendererObj.drawString(String.format("%s: %s", "Error", error), 5, 5, 0xffaabbaa);
    }
    final int maxWidth = guiLeft - 20;
    final List<List<String>> information = new ArrayList<List<String>>();
    information.add(fontRendererObj.listFormattedStringToWidth(
            String.format("%s: %s", Strings.playerLevel, player.experienceLevel), maxWidth));

    if (container.tableInventory.getStackInSlot(0) == null || levelChanged()
            || !levelChanged() && !container.tableInventory.getStackInSlot(0).isItemDamaged()) {
        information.add(fontRendererObj.listFormattedStringToWidth(
                String.format("%s: %s", Strings.enchantingCost, totalCost), maxWidth));
    } else if (ConfigurationSettings.AllowRepair && !levelChanged()
            && container.tableInventory.getStackInSlot(0).isItemDamaged()) {
        information.add(fontRendererObj
                .listFormattedStringToWidth(String.format("%s: %s", Strings.repairCost, totalCost), maxWidth));
    }
    information.add(fontRendererObj.listFormattedStringToWidth(
            String.format("%s: %s", Strings.maxEnchantLevel, container.bookCases()), maxWidth));

    for (final List<String> display : information) {
        int height = information.indexOf(display) == 0 ? guiTop + fontRendererObj.FONT_HEIGHT + 8
                : guiTop + (fontRendererObj.FONT_HEIGHT + 8) * (information.indexOf(display) + 1);
        if (information.indexOf(display) > 0) {
            for (int i = information.indexOf(display) - 1; i >= 0; i--) {
                height += (fontRendererObj.FONT_HEIGHT + 3) * (information.get(i).size() - 1);
            }
        }

        try {
            drawHoveringText(display, guiLeft - 20 - maxWidth, height, fontRendererObj);
        } catch (NoSuchMethodError e) {
            final StringBuilder sb = new StringBuilder();

            for (final String text : display) {
                sb.append(text);
                sb.append(" ");
            }
            drawCreativeTabHoveringText(sb.toString(), guiLeft - 20 - maxWidth, height);
            if (!TMInagged) {
                EnchantingPlus.log.error("Please update or remove NEI / TMI. It is causing issues.");
                TMInagged = true;
            }
        }
    }

    if (isShiftKeyDown() && getItemFromPos(par1, par2) != null) {
        final String name = FontFormat.BOLD + getItemFromPos(par1, par2).getTranslatedName();
        String info = EnchantmentHelp.getToolTip(getItemFromPos(par1, par2).enchantment);

        if (info.isEmpty()) {
            info = FontFormat.DARKRED + String.format("%s ", Strings.errorToolTip)
                    + getItemFromPos(par1, par2).enchantment.getName();
        }

        info = FontFormat.PURPLE + info;

        final List<String> display = new ArrayList<String>();

        display.add(name);
        display.addAll(fontRendererObj.listFormattedStringToWidth(info, 150));
        try {
            drawHoveringText(display, par1, par2, fontRendererObj);
        } catch (NoSuchMethodError e) {
            final StringBuilder sb = new StringBuilder();

            for (final String text : display) {
                sb.append(text);
                sb.append(" ");
            }
            drawCreativeTabHoveringText(sb.toString(), guiLeft - 20 - maxWidth, height);
            if (!TMInagged) {
                EnchantingPlus.log.error("Please update or remove NEI / TMI. It is causing issues.");
                TMInagged = true;
            }
        }
    }

    if (!error.isEmpty()) {
        drawCreativeTabHoveringText(error, (xSize + guiLeft) / 2 - fontRendererObj.getStringWidth(error) / 4,
                guiTop - fontRendererObj.FONT_HEIGHT);
    }
}