Example usage for org.lwjgl.opengl GL11 glTranslated

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

Introduction

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

Prototype

public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glTranslatef Translatef .

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);
        }// w w  w. ja v  a 2s . 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  w  w.ja  v 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;//from w w  w  .  j a  va  2  s .  c  om
            }

            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;/*from   w ww  . j a  v  a  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: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 w w  w  .j  a  v a  2  s.c  o 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.render.BaseBlockRender.java

License:Open Source License

protected void applyTESRRotation(final double x, final double y, final double z, ForgeDirection forward,
        ForgeDirection up) {/*from w w w . j  a v a  2 s  .  c  o  m*/
    if (forward != null && up != null) {
        if (forward == ForgeDirection.UNKNOWN) {
            forward = ForgeDirection.SOUTH;
        }

        if (up == ForgeDirection.UNKNOWN) {
            up = ForgeDirection.UP;
        }

        final ForgeDirection west = Platform.crossProduct(forward, up);

        this.rotMat.put(0, west.offsetX);
        this.rotMat.put(1, west.offsetY);
        this.rotMat.put(2, west.offsetZ);
        this.rotMat.put(3, 0);

        this.rotMat.put(4, up.offsetX);
        this.rotMat.put(5, up.offsetY);
        this.rotMat.put(6, up.offsetZ);
        this.rotMat.put(7, 0);

        this.rotMat.put(8, forward.offsetX);
        this.rotMat.put(9, forward.offsetY);
        this.rotMat.put(10, forward.offsetZ);
        this.rotMat.put(11, 0);

        this.rotMat.put(12, 0);
        this.rotMat.put(13, 0);
        this.rotMat.put(14, 0);
        this.rotMat.put(15, 1);
        GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
        GL11.glMultMatrix(this.rotMat);
        GL11.glTranslated(-0.5, -0.5, -0.5);
    } else {
        GL11.glTranslated(x, y, z);
    }
}

From source file:appeng.client.render.blocks.RenderBlockCraftingCPUMonitor.java

License:Open Source License

@Override
public void renderTile(final BlockCraftingMonitor block, final TileCraftingMonitorTile tile,
        final Tessellator tess, final double x, final double y, final double z, final float f,
        final RenderBlocks renderer) {
    if (tile != null) {
        final IAEItemStack ais = tile.getJobProgress();

        if (tile.getDisplayList() == null) {
            tile.setUpdateList(true);/*  w ww  . j  a  v  a2  s .  co m*/
            tile.setDisplayList(GLAllocation.generateDisplayLists(1));
        }

        if (ais != null) {
            GL11.glPushMatrix();
            GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);

            if (tile.isUpdateList()) {
                tile.setUpdateList(false);
                GL11.glNewList(tile.getDisplayList(), GL11.GL_COMPILE_AND_EXECUTE);
                this.tesrRenderScreen(tess, tile, ais);
                GL11.glEndList();
            } else {
                GL11.glCallList(tile.getDisplayList());
            }

            GL11.glPopMatrix();
        }
    }
}

From source file:appeng.client.render.blocks.RenderBlockCraftingCPUMonitor.java

License:Open Source License

private void tesrRenderScreen(final Tessellator tess, final TileCraftingMonitorTile cmt,
        final IAEItemStack ais) {
    final ForgeDirection side = cmt.getForward();

    ForgeDirection walrus = side.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP;
    int spin = 0;

    int max = 5;/* w  w w. jav a2s  . c o m*/
    while (walrus != cmt.getUp() && max > 0) {
        max--;
        spin++;
        walrus = Platform.rotateAround(walrus, side);
    }
    max--;

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glTranslated(side.offsetX * 0.69, side.offsetY * 0.69, side.offsetZ * 0.69);

    final float scale = 0.7f;
    GL11.glScalef(scale, scale, scale);

    if (side == ForgeDirection.UP) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(spin * 90.0F, 0, 0, 1);
    }

    if (side == ForgeDirection.DOWN) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(spin * -90.0F, 0, 0, 1);
    }

    if (side == ForgeDirection.EAST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (side == ForgeDirection.WEST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (side == ForgeDirection.NORTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
    }

    if (side == ForgeDirection.SOUTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    }

    GL11.glPushMatrix();
    try {
        final ItemStack sis = ais.getItemStack();
        sis.stackSize = 1;

        final int br = 16 << 20 | 16 << 4;
        final int var11 = br % 65536;
        final int var12 = br / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F);

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

        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        // RenderHelper.enableGUIStandardItemLighting();
        tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);

        ClientHelper.proxy.doRenderItem(sis, cmt.getWorldObj());
    } catch (final Exception e) {
        AELog.error(e);
    }

    GL11.glPopMatrix();

    GL11.glTranslatef(0.0f, 0.14f, -0.24f);
    GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f);

    final long stackSize = ais.getStackSize();
    final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize);

    final FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    final int width = fr.getStringWidth(renderedStackSize);
    GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
    fr.drawString(renderedStackSize, 0, 0, 0);

    GL11.glPopAttrib();
}

From source file:appeng.client.render.blocks.RenderBlockCrank.java

License:Open Source License

@Override
public void renderTile(final BlockCrank blk, final TileCrank tile, final Tessellator tess, final double x,
        final double y, final double z, final float f, final RenderBlocks renderBlocks) {
    if (tile.getUp() == null || tile.getUp() == ForgeDirection.UNKNOWN) {
        return;/*from w w w  .ja va  2s.  c  om*/
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    RenderHelper.disableStandardItemLighting();

    if (Minecraft.isAmbientOcclusionEnabled()) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
    } else {
        GL11.glShadeModel(GL11.GL_FLAT);
    }

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

    this.applyTESRRotation(x, y, z, tile.getForward(), tile.getUp());

    GL11.glTranslated(0.5, 0, 0.5);
    GL11.glRotatef(tile.getVisibleRotation(), 0, 1, 0);
    GL11.glTranslated(-0.5, 0, -0.5);

    tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord);
    tess.startDrawingQuads();
    renderBlocks.renderAllFaces = true;
    renderBlocks.blockAccess = tile.getWorldObj();

    renderBlocks.setRenderBounds(0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.1, 0.5D + 0.05);

    renderBlocks.renderStandardBlock(blk, tile.xCoord, tile.yCoord, tile.zCoord);

    renderBlocks.setRenderBounds(0.70D - 0.15, 0.55D - 0.05, 0.5D - 0.05, 0.70D + 0.15, 0.55D + 0.05,
            0.5D + 0.05);

    renderBlocks.renderStandardBlock(blk, tile.xCoord, tile.yCoord, tile.zCoord);

    tess.draw();
    tess.setTranslation(0, 0, 0);
    RenderHelper.enableStandardItemLighting();
}

From source file:appeng.client.render.BusRenderer.java

License:Open Source License

@Override
public void renderItem(final ItemRenderType type, final ItemStack item, final Object... data) {
    if (item == null) {
        return;/*from w w w  .  j  av a2 s . c o  m*/
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);

    if (AEConfig.instance.isFeatureEnabled(AEFeature.AlphaPass) && item.getItem() instanceof IAlphaPassItem
            && ((IAlphaPassItem) item.getItem()).useAlphaPass(item)) {
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_BLEND);
    } else {
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.4f);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glDisable(GL11.GL_BLEND);
    }

    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glTranslatef(-0.2f, -0.1f, -0.3f);
    }

    if (type == ItemRenderType.ENTITY) {
        GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
        GL11.glScalef(0.8f, 0.8f, 0.8f);
        GL11.glTranslatef(-0.8f, -0.87f, -0.7f);
    }

    if (type == ItemRenderType.INVENTORY) {
        GL11.glTranslatef(0.0f, -0.1f, 0.0f);
    }

    GL11.glTranslated(0.2, 0.3, 0.1);
    GL11.glScaled(1.2, 1.2, 1.);

    GL11.glColor4f(1, 1, 1, 1);
    Tessellator.instance.setColorOpaque_F(1, 1, 1);
    Tessellator.instance.setBrightness(14 << 20 | 14 << 4);

    BusRenderHelper.INSTANCE.setBounds(0, 0, 0, 1, 1, 1);
    BusRenderHelper.INSTANCE.setTexture(null);
    BusRenderHelper.INSTANCE.setInvColor(0xffffff);
    this.getRenderer().blockAccess = ClientHelper.proxy.getWorld();

    BusRenderHelper.INSTANCE.setOrientation(ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH);

    this.getRenderer().uvRotateBottom = this.getRenderer().uvRotateEast = this
            .getRenderer().uvRotateNorth = this.getRenderer().uvRotateSouth = this
                    .getRenderer().uvRotateTop = this.getRenderer().uvRotateWest = 0;
    this.getRenderer().useInventoryTint = false;
    this.getRenderer().overrideBlockTexture = null;

    if (item.getItem() instanceof IFacadeItem) {
        final IFacadeItem fi = (IFacadeItem) item.getItem();
        final IFacadePart fp = fi.createPartFromItemStack(item, ForgeDirection.SOUTH);

        if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
            GL11.glRotatef(160.0f, 0.0f, 1.0f, 0.0f);
            GL11.glTranslated(-0.4, 0.1, -1.6);
        }

        if (fp != null) {
            fp.renderInventory(BusRenderHelper.INSTANCE, this.getRenderer());
        }
    } else {
        final IPart ip = this.getRenderer(item, (IPartItem) item.getItem());
        if (ip != null) {
            if (type == ItemRenderType.ENTITY) {
                final int depth = ip.cableConnectionRenderTo();
                GL11.glTranslatef(0.0f, 0.0f, -0.04f * (8 - depth) - 0.06f);
            }

            ip.renderInventory(BusRenderHelper.INSTANCE, this.getRenderer());
        }
    }

    this.getRenderer().uvRotateBottom = this.getRenderer().uvRotateEast = this
            .getRenderer().uvRotateNorth = this.getRenderer().uvRotateSouth = this
                    .getRenderer().uvRotateTop = this.getRenderer().uvRotateWest = 0;

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}