Example usage for org.lwjgl.opengl GL11 glPopMatrix

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

Introduction

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

Prototype

public static native void glPopMatrix();

Source Link

Document

Pops the top entry off the current matrix stack, replacing the current matrix with the matrix that was the second entry in the stack.

Usage

From source file:allout58.mods.techtree.client.elements.GuiButtonEditNode.java

License:Open Source License

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
    if (this.visible) {
        FontRenderer fontRenderer = mc.fontRenderer;
        boolean mouseOver = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width
                && mouseY < yPosition + height;

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + height,
                Config.INSTANCE.client.colorBtnUnlocked1, Config.INSTANCE.client.colorBtnUnlocked2);

        if (isSelected) {
            drawRect(xPosition - 1, yPosition - 1, xPosition + width + 1, yPosition + height + 1, 0x99101010);
        }//ww w .j a va 2  s . co m

        if (mouseOver) {
            drawRect(xPosition - 2, yPosition - 2, xPosition + width + 2, yPosition + height + 2, 0x30FFFFFF);
        }

        GL11.glPushMatrix();

        GL11.glScaled(0.75, 0.75, 0.75);
        GL11.glTranslated(xPosition * .33, yPosition * .33, 0);
        fontRenderer.drawString(node.getName(), xPosition + 2, yPosition + 2,
                Config.INSTANCE.client.colorBtnText, true);

        GL11.glPopMatrix();

        this.mouseDragged(mc, mouseX, mouseY);
    }
}

From source file:allout58.mods.techtree.client.elements.GuiButtonTechNode.java

License:Open Source License

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
    if (this.visible) {
        try {// w ww .  j  av  a 2  s . co m
            bar.setMax((float) (ResearchClient.getInstance().getResearch(node.getId()))
                    / (float) (node.getScienceRequired()));
        } catch (Exception e) {
            e.printStackTrace();
        }

        FontRenderer fontRenderer = mc.fontRenderer;
        boolean mouseOver = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width
                && mouseY < yPosition + height;

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        String playerUUID = FMLClientHandler.instance().getClient().thePlayer.getUniqueID().toString();

        switch (ResearchClient.getInstance(playerUUID).getMode(node.getId())) {
        case Locked:
            drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + height,
                    Config.INSTANCE.client.colorBtnLocked1, Config.INSTANCE.client.colorBtnLocked2);
            break;
        case Unlocked:
            drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + height,
                    Config.INSTANCE.client.colorBtnUnlocked1, Config.INSTANCE.client.colorBtnUnlocked2);
            try {
                bar.setEnabled(ResearchClient.getInstance().getResearch(node.getId()) > 0);
            } catch (Exception e) {
                e.printStackTrace();
            }
            break;
        case Researching:
            drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + height,
                    Config.INSTANCE.client.colorBtnResearch1, Config.INSTANCE.client.colorBtnResearch2);
            bar.setEnabled(true);
            break;
        case Completed:
            drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + height,
                    Config.INSTANCE.client.colorBtnCompleted1, Config.INSTANCE.client.colorBtnCompleted2);
            bar.setEnabled(false);
            break;
        default:
            System.err.println("ERROR! Invalid button state! o.O");
        }

        if (mouseOver) {
            drawRect(xPosition - 1, yPosition - 1, xPosition + width + 1, yPosition + height + 1, 0x30FFFFFF);
        }

        GL11.glPushMatrix();

        GL11.glScaled(0.75, 0.75, 0.75);
        GL11.glTranslated(xPosition * .33, yPosition * .33, 0);
        fontRenderer.drawString(node.getName(), xPosition + 2, yPosition + 2,
                Config.INSTANCE.client.colorBtnText, true);

        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glScaled(.5, .5, .5);
        GL11.glTranslated(xPosition, yPosition, 0);
        fontRenderer.drawString(ResearchClient.getInstance(playerUUID).getMode(node.getId()).name(),
                xPosition + 2, yPosition + 10 + fontRenderer.FONT_HEIGHT, Config.INSTANCE.client.colorBtnText,
                false);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glScaled(1, 1, 1);
        bar.doRender();
        GL11.glPopMatrix();

        this.mouseDragged(mc, mouseX, mouseY);
    }
}

From source file:allout58.mods.techtree.client.GuiEditTree2.java

License:Open Source License

@SuppressWarnings("unchecked")
protected void drawOverlay(int mouseX, int mouseY) {
    for (AbstractGuiButtonNode btn : buttons.values()) {
        if (btn.mousePressed(this.mc, mouseX, mouseY)) {
            int w = Math.max(fontRendererObj.getStringWidth(btn.getNode().getName()) + 20, 100);
            int h = (int) ((fontRendererObj.listFormattedStringToWidth(btn.getNode().getDescription(), w).size()
                    + 1) * fontRendererObj.FONT_HEIGHT * 0.5 + fontRendererObj.FONT_HEIGHT + 35);
            if (mouseX > width / 2) {
                mouseX -= w;/* w w w  .ja  v a2  s .  c  o  m*/
            }

            try {
                RenderingHelper.drawRoundedRectangle(mouseX + 2, mouseY + 2, w, h, 7,
                        Config.INSTANCE.client.colorOverlayBackground);
                fontRendererObj.drawString(btn.getNode().getName(), mouseX + 2 + 6, mouseY + 2 + 6,
                        Config.INSTANCE.client.colorOverlayText, true);
                drawHorizontalLine(mouseX + 7, mouseX + w - 7, mouseY + 10 + fontRendererObj.FONT_HEIGHT,
                        Config.INSTANCE.client.colorOverlayOther);

                GL11.glPushMatrix();
                GL11.glScaled(0.5, 0.5, 0);
                GL11.glTranslated(mouseX, mouseY, 0);
                fontRendererObj.drawString(
                        StatCollector.translateToLocalFormatted("gui.scienceRequired",
                                btn.getNode().getScienceRequired()),
                        mouseX + 14, mouseY + 17 + fontRendererObj.FONT_HEIGHT * 3,
                        Config.INSTANCE.client.colorOverlayText);
                fontRendererObj.drawSplitString(btn.getNode().getDescription(), mouseX + 14,
                        mouseY + 22 + fontRendererObj.FONT_HEIGHT * 4, w * 2 - 10,
                        Config.INSTANCE.client.colorOverlayText);
                GL11.glPopMatrix();

                for (int i = 0; i < btn.getNode().getLockedItems().length; i++) {
                    GL11.glDisable(GL11.GL_ALPHA_TEST);
                    GL11.glDisable(GL11.GL_LIGHTING);
                    drawRect(mouseX + 14 + 18 * i, mouseY + h - 18, mouseX + 30 + 18 * i, mouseY + h - 2,
                            0xFFB0B0B0);
                    itemRender.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().renderEngine,
                            btn.getNode().getLockedItems()[i], mouseX + 14 + 18 * i, mouseY + h - 18);
                }

            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:allout58.mods.techtree.client.GuiTree.java

License:Open Source License

@SuppressWarnings("unchecked")
protected void drawOverlay(int mouseX, int mouseY) {
    for (AbstractGuiButtonNode btn : buttons.values()) {
        if (btn.mousePressed(this.mc, mouseX, mouseY)) {
            int w = Math.max(fontRendererObj.getStringWidth(btn.getNode().getName()) + 20, 100);
            int h = (int) ((fontRendererObj.listFormattedStringToWidth(btn.getNode().getDescription(), w).size()
                    + 1) * fontRendererObj.FONT_HEIGHT * 0.5 + fontRendererObj.FONT_HEIGHT + 35);
            if (mouseX < width / 2) {
                mouseX -= w;/*ww  w  .  j  a  va  2 s.  c  o m*/
            }

            try {
                RenderingHelper.drawRoundedRectangle(mouseX + 2, mouseY + 2, w, h, 7,
                        Config.INSTANCE.client.colorOverlayBackground);
                fontRendererObj.drawString(btn.getNode().getName(), mouseX + 2 + 6, mouseY + 2 + 6,
                        Config.INSTANCE.client.colorOverlayText, true);
                drawHorizontalLine(mouseX + 7, mouseX + w - 7, mouseY + 10 + fontRendererObj.FONT_HEIGHT,
                        Config.INSTANCE.client.colorOverlayOther);

                GL11.glPushMatrix();
                GL11.glScaled(0.5, 0.5, 0);
                GL11.glTranslated(mouseX, mouseY, 0);
                fontRendererObj.drawString(
                        StatCollector.translateToLocalFormatted("gui.scienceRequired",
                                btn.getNode().getScienceRequired()),
                        mouseX + 14, mouseY + 17 + fontRendererObj.FONT_HEIGHT * 3,
                        Config.INSTANCE.client.colorOverlayText);
                fontRendererObj.drawSplitString(btn.getNode().getDescription(), mouseX + 14,
                        mouseY + 22 + fontRendererObj.FONT_HEIGHT * 4, w * 2 - 10,
                        Config.INSTANCE.client.colorOverlayText);
                GL11.glPopMatrix();

                for (int i = 0; i < btn.getNode().getLockedItems().length; i++) {
                    GL11.glDisable(GL11.GL_ALPHA_TEST);
                    GL11.glDisable(GL11.GL_LIGHTING);
                    drawRect(mouseX + 14 + 18 * i, mouseY + h - 18, mouseX + 30 + 18 * i, mouseY + h - 2,
                            0xFFB0B0B0);
                    itemRender.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().renderEngine,
                            btn.getNode().getLockedItems()[i], mouseX + 14 + 18 * i, mouseY + h - 18);
                }

            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:allout58.mods.techtree.util.RenderingHelper.java

License:Open Source License

public static void draw2DLine(int x1, int y1, int x2, int y2, float width, int colorRGB) {
    float red = (float) (colorRGB >> 16 & 255) / 255.0F;
    float blue = (float) (colorRGB >> 8 & 255) / 255.0F;
    float green = (float) (colorRGB & 255) / 255.0F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from   www.  ja v a  2  s.  c om*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glLineWidth(width);

    GL11.glPushMatrix();
    GL11.glColor3f(red, green, blue);
    GL11.glBegin(GL11.GL_LINE_STRIP);
    GL11.glVertex3d(x1, y1, 0.0D);
    GL11.glVertex3d(x2, y2, 0.0D);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:allout58.mods.techtree.util.RenderingHelper.java

License:Open Source License

public static void drawRoundedRectangle(int x, int y, int width, int height, int radius, int color,
        int borderColor) throws IllegalArgumentException {
    if (radius * 2 > Math.abs(width))
        throw new IllegalArgumentException("Error! Width not large enough for radius!");
    if (radius * 2 > Math.abs(height))
        throw new IllegalArgumentException("Error! Height not large enough for radius!");

    if (width < 0) {
        x += width;//  w w w .  ja  v  a2 s  .  c o m
        width = Math.abs(width);
    }
    if (height < 0) {
        y += height;
        height = Math.abs(height);
    }

    int x1Inner = x + radius;
    int y1Inner = y + radius;
    int x2Inner = x + width - radius;
    int y2Inner = y + height - radius;

    float red = (float) (borderColor >> 16 & 255) / 255.0F;
    float green = (float) (borderColor >> 8 & 255) / 255.0F;
    float blue = (float) (borderColor & 255) / 255.0F;
    float alpha = (float) (borderColor >> 24 & 255) / 255.0F;

    Gui.drawRect(x, y1Inner, x1Inner, y2Inner, borderColor);
    Gui.drawRect(x1Inner, y, x2Inner, y1Inner, borderColor);
    Gui.drawRect(x2Inner, y1Inner, x + width, y2Inner, borderColor);
    Gui.drawRect(x1Inner, y2Inner, x2Inner, y + height, borderColor);
    Gui.drawRect(x1Inner, y1Inner, x2Inner, y2Inner, color);

    ArrayList<Point> curves = new ArrayList<Point>();

    final double[][] start = new double[][] { { x1Inner, y1Inner }, { x2Inner, y1Inner }, { x2Inner, y2Inner },
            { x1Inner, y2Inner } };

    for (int corner = 0; corner < 4; corner++) {
        curves.clear();
        for (int i = 0; i < VERTEX_PER_CURVE + 1; i++) {
            double theta = deltaTheta * i + dT[corner];
            Point p = new Point(Math.cos(theta), Math.sin(theta));
            curves.add(p);
        }

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glPushMatrix();
        GL11.glColor4f(red, green, blue, alpha);
        GL11.glBegin(GL11.GL_TRIANGLE_FAN);
        GL11.glVertex3d(start[corner][0], start[corner][1], 0);
        for (int i = curves.size() - 1; i >= 0; i--) {
            GL11.glVertex3d((curves.get(i).getX()) * radius + start[corner][0],
                    (curves.get(i).getY()) * radius + start[corner][1], 0);
        }
        GL11.glEnd();
        GL11.glPopMatrix();
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}

From source file:analog.clock.AnalogClock.java

private void drawCircle(double r, int n) {
    GL11.glColor3f(1.0f, 1.0f, 0.0f);//from   w w w .  java 2 s .  c  o  m
    double theta = 2 * Math.PI / n;
    GL11.glPushMatrix();
    GL11.glBegin(GL11.GL_LINES);
    for (int i = 0; i < n;) {
        //GL11.glVertex3f(0, 0, 0);
        float x = (float) (r * Math.cos(theta * i));
        float y = (float) (r * Math.sin(theta * i));
        GL11.glVertex3f(x, y, 0);
        i++;
        x = (float) (r * Math.cos(theta * i));
        y = (float) (r * Math.sin(theta * i));
        GL11.glVertex3f(x, y, 0);
    }
    GL11.glEnd();
    GL11.glPopMatrix();
}

From source file:analog.clock.AnalogClock.java

private void loop() {
    try {// w w w. ja  v  a 2 s  . c om
        for (int i = 0; i < 1000; i++) {
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
            drawCircle(0.25, 8); // draw the sun

            earthOrbitAngle += 1;
            moonOrbitAngle += 5;
            earthAxisAngle += 10;

            GL11.glPushMatrix();
            GL11.glRotatef(earthOrbitAngle, 0, 0, 1);
            GL11.glTranslatef(0.75f, 0.0f, 0.0f);
            GL11.glPushMatrix();
            GL11.glRotatef(earthAxisAngle, 0, 0, 1);
            GL11.glScalef(0.5f, 0.5f, 0.5f);
            drawCircle(0.25, 3); // draw the earth
            GL11.glPopMatrix();

            GL11.glPushMatrix();
            GL11.glRotatef(moonOrbitAngle, 0, 0, 1);
            GL11.glTranslatef(0.25f, 0.0f, 0.0f);
            GL11.glScalef(0.25f, 0.25f, 0.25f);
            drawCircle(0.25, 5); // draw the moon
            GL11.glPopMatrix();
            GL11.glPopMatrix();

            Thread.sleep(10);
            GLFW.glfwSwapBuffers(window);
        }
    } catch (InterruptedException ex) {
        Logger.getLogger(AnalogClock.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:appeng.client.ClientHelper.java

License:Open Source License

@Override
public void doRenderItem(final ItemStack itemstack, final World w) {
    if (itemstack != null) {
        final EntityItem entityitem = new EntityItem(w, 0.0D, 0.0D, 0.0D, itemstack);
        entityitem.getEntityItem().stackSize = 1;

        // set all this stuff and then do shit? meh?
        entityitem.hoverStart = 0;/*from  ww w .  j  av  a2  s .co m*/
        entityitem.age = 0;
        entityitem.rotationYaw = 0;

        GL11.glPushMatrix();
        GL11.glTranslatef(0, -0.04F, 0);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        // GL11.glDisable( GL11.GL_CULL_FACE );

        if (itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses()) {
            GL11.glTranslatef(0.0f, -0.05f, -0.25f);
            GL11.glScalef(1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f);
            // GL11.glTranslated( -8.0, -12.2, -10.6 );
            GL11.glScalef(1.0f, -1.0f, 0.005f);
            // GL11.glScalef( 1.0f , -1.0f, 1.0f );

            final Block block = Block.getBlockFromItem(itemstack.getItem());
            if ((itemstack.getItemSpriteNumber() == 0 && block != null
                    && RenderBlocks.renderItemIn3d(block.getRenderType()))) {
                GL11.glRotatef(25.0f, 1.0f, 0.0f, 0.0f);
                GL11.glRotatef(15.0f, 0.0f, 1.0f, 0.0f);
                GL11.glRotatef(30.0f, 0.0f, 1.0f, 0.0f);
            }

            final IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack,
                    IItemRenderer.ItemRenderType.ENTITY);
            if (customRenderer != null && !(itemstack.getItem() instanceof ItemBlock)) {
                if (customRenderer.shouldUseRenderHelper(IItemRenderer.ItemRenderType.ENTITY, itemstack,
                        IItemRenderer.ItemRendererHelper.BLOCK_3D)) {
                    GL11.glTranslatef(0, -0.04F, 0);
                    GL11.glScalef(0.7f, 0.7f, 0.7f);
                    GL11.glRotatef(35, 1, 0, 0);
                    GL11.glRotatef(45, 0, 1, 0);
                    GL11.glRotatef(-90, 0, 1, 0);
                }
            } else if (itemstack.getItem() instanceof ItemBlock) {
                GL11.glTranslatef(0, -0.04F, 0);
                GL11.glScalef(1.1f, 1.1f, 1.1f);
                GL11.glRotatef(-90, 0, 1, 0);
            } else {
                GL11.glTranslatef(0, -0.14F, 0);
                GL11.glScalef(0.8f, 0.8f, 0.8f);
            }

            RenderItem.renderInFrame = true;
            RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
            RenderItem.renderInFrame = false;
        } else {
            GL11.glScalef(1.0f / 42.0f, 1.0f / 42.0f, 1.0f / 42.0f);
            GL11.glTranslated(-8.0, -10.2, -10.4);
            GL11.glScalef(1.0f, 1.0f, 0.005f);

            RenderItem.renderInFrame = false;
            final FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
            if (!ForgeHooksClient.renderInventoryItem(BLOCK_RENDERER, Minecraft.getMinecraft().renderEngine,
                    itemstack, true, 0, 0, 0)) {
                ITEM_RENDERER.renderItemIntoGUI(fr, Minecraft.getMinecraft().renderEngine, itemstack, 0, 0,
                        false);
            }
        }

        GL11.glPopMatrix();
    }
}

From source file:appeng.client.gui.implementations.GuiCraftConfirm.java

License:Open Source License

@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
    final long BytesUsed = this.ccc.getUsedBytes();
    final String byteUsed = NumberFormat.getInstance().format(BytesUsed);
    final String Add = BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal())
            : GuiText.CalculatingWait.getLocal();
    this.fontRendererObj.drawString(GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752);

    String dsp = null;/*from w w  w.j av a 2s . c  om*/

    if (this.isSimulation()) {
        dsp = GuiText.Simulation.getLocal();
    } else {
        dsp = this.ccc.getCpuAvailableBytes() > 0
                ? (GuiText.Bytes.getLocal() + ": " + this.ccc.getCpuAvailableBytes() + " : "
                        + GuiText.CoProcessors.getLocal() + ": " + this.ccc.getCpuCoProcessors())
                : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
    }

    final int offset = (219 - this.fontRendererObj.getStringWidth(dsp)) / 2;
    this.fontRendererObj.drawString(dsp, offset, 165, 4210752);

    final int sectionLength = 67;

    int x = 0;
    int y = 0;
    final int xo = 9;
    final int yo = 22;
    final int viewStart = this.getScrollBar().getCurrentScroll() * 3;
    final int viewEnd = viewStart + 3 * this.rows;

    String dspToolTip = "";
    final List<String> lineList = new LinkedList<String>();
    int toolPosX = 0;
    int toolPosY = 0;

    final int offY = 23;

    for (int z = viewStart; z < Math.min(viewEnd, this.visual.size()); z++) {
        final IAEItemStack refStack = this.visual.get(z);// repo.getReferenceItem( z );
        if (refStack != null) {
            GL11.glPushMatrix();
            GL11.glScaled(0.5, 0.5, 0.5);

            final IAEItemStack stored = this.storage.findPrecise(refStack);
            final IAEItemStack pendingStack = this.pending.findPrecise(refStack);
            final IAEItemStack missingStack = this.missing.findPrecise(refStack);

            int lines = 0;

            if (stored != null && stored.getStackSize() > 0) {
                lines++;
            }
            if (pendingStack != null && pendingStack.getStackSize() > 0) {
                lines++;
            }
            if (pendingStack != null && pendingStack.getStackSize() > 0) {
                lines++;
            }

            final int negY = ((lines - 1) * 5) / 2;
            int downY = 0;

            if (stored != null && stored.getStackSize() > 0) {
                String str = Long.toString(stored.getStackSize());
                if (stored.getStackSize() >= 10000) {
                    str = Long.toString(stored.getStackSize() / 1000) + 'k';
                }
                if (stored.getStackSize() >= 10000000) {
                    str = Long.toString(stored.getStackSize() / 1000000) + 'm';
                }

                str = GuiText.FromStorage.getLocal() + ": " + str;
                final int w = 4 + this.fontRendererObj.getStringWidth(str);
                this.fontRendererObj.drawString(str,
                        (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
                        (y * offY + yo + 6 - negY + downY) * 2, 4210752);

                if (this.tooltip == z - viewStart) {
                    lineList.add(GuiText.FromStorage.getLocal() + ": " + Long.toString(stored.getStackSize()));
                }

                downY += 5;
            }

            boolean red = false;
            if (missingStack != null && missingStack.getStackSize() > 0) {
                String str = Long.toString(missingStack.getStackSize());
                if (missingStack.getStackSize() >= 10000) {
                    str = Long.toString(missingStack.getStackSize() / 1000) + 'k';
                }
                if (missingStack.getStackSize() >= 10000000) {
                    str = Long.toString(missingStack.getStackSize() / 1000000) + 'm';
                }

                str = GuiText.Missing.getLocal() + ": " + str;
                final int w = 4 + this.fontRendererObj.getStringWidth(str);
                this.fontRendererObj.drawString(str,
                        (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
                        (y * offY + yo + 6 - negY + downY) * 2, 4210752);

                if (this.tooltip == z - viewStart) {
                    lineList.add(
                            GuiText.Missing.getLocal() + ": " + Long.toString(missingStack.getStackSize()));
                }

                red = true;
                downY += 5;
            }

            if (pendingStack != null && pendingStack.getStackSize() > 0) {
                String str = Long.toString(pendingStack.getStackSize());
                if (pendingStack.getStackSize() >= 10000) {
                    str = Long.toString(pendingStack.getStackSize() / 1000) + 'k';
                }
                if (pendingStack.getStackSize() >= 10000000) {
                    str = Long.toString(pendingStack.getStackSize() / 1000000) + 'm';
                }

                str = GuiText.ToCraft.getLocal() + ": " + str;
                final int w = 4 + this.fontRendererObj.getStringWidth(str);
                this.fontRendererObj.drawString(str,
                        (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
                        (y * offY + yo + 6 - negY + downY) * 2, 4210752);

                if (this.tooltip == z - viewStart) {
                    lineList.add(
                            GuiText.ToCraft.getLocal() + ": " + Long.toString(pendingStack.getStackSize()));
                }
            }

            GL11.glPopMatrix();
            final int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
            final int posY = y * offY + yo;

            final ItemStack is = refStack.copy().getItemStack();

            if (this.tooltip == z - viewStart) {
                dspToolTip = Platform.getItemDisplayName(is);

                if (lineList.size() > 0) {
                    dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
                }

                toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
                toolPosY = y * offY + yo;
            }

            this.drawItem(posX, posY, is);

            if (red) {
                final int startX = x * (1 + sectionLength) + xo;
                final int startY = posY - 4;
                drawRect(startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000);
            }

            x++;

            if (x > 2) {
                y++;
                x = 0;
            }
        }
    }

    if (this.tooltip >= 0 && dspToolTip.length() > 0) {
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        this.drawTooltip(toolPosX, toolPosY + 10, 0, dspToolTip);
        GL11.glPopAttrib();
    }
}