public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4)
    {
        Tessellator var5 = Tessellator.instance;
        int var7 = par1Block.getBedDirection(blockAccess, par2, par3, par4);
        boolean var8 = par1Block.isBedFoot(blockAccess, par2, par3, par4);
        float var9 = 0.5F;
        float var10 = 1.0F;
        float var11 = 0.8F;
        float var12 = 0.6F;
        int var13 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4);
        var5.setBrightness(var13);
        var5.setColorOpaque_F(var9, var9, var9);
        int var14 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 0);
        int var15 = (var14 & 15) << 4;
        int var16 = var14 & 240;
        double var17 = (double)((float)var15 / 256.0F);
        double var19 = ((double)(var15 + 16) - 0.01D) / 256.0D;
        double var21 = (double)((float)var16 / 256.0F);
        double var23 = ((double)(var16 + 16) - 0.01D) / 256.0D;
        double var25 = (double)par2 + par1Block.minX;
        double var27 = (double)par2 + par1Block.maxX;
        double var29 = (double)par3 + par1Block.minY + 0.1875D;
        double var31 = (double)par4 + par1Block.minZ;
        double var33 = (double)par4 + par1Block.maxZ;
        var5.addVertexWithUV(var25, var29, var33, var17, var23);
        var5.addVertexWithUV(var25, var29, var31, var17, var21);
        var5.addVertexWithUV(var27, var29, var31, var19, var21);
        var5.addVertexWithUV(var27, var29, var33, var19, var23);
        var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4));
        var5.setColorOpaque_F(var10, var10, var10);
        var14 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 1);
        var15 = (var14 & 15) << 4;
        var16 = var14 & 240;
        var17 = (double)((float)var15 / 256.0F);
        var19 = ((double)(var15 + 16) - 0.01D) / 256.0D;
        var21 = (double)((float)var16 / 256.0F);
        var23 = ((double)(var16 + 16) - 0.01D) / 256.0D;
        var25 = var17;
        var27 = var19;
        var29 = var21;
        var31 = var21;
        var33 = var17;
        double var35 = var19;
        double var37 = var23;
        double var39 = var23;

        if (var7 == 0)
        {
            var27 = var17;
            var29 = var23;
            var33 = var19;
            var39 = var21;
        }
        else if (var7 == 2)
        {
            var25 = var19;
            var31 = var23;
            var35 = var17;
            var37 = var21;
        }
        else if (var7 == 3)
        {
            var25 = var19;
            var31 = var23;
            var35 = var17;
            var37 = var21;
            var27 = var17;
            var29 = var23;
            var33 = var19;
            var39 = var21;
        }

        double var41 = (double)par2 + par1Block.minX;
        double var43 = (double)par2 + par1Block.maxX;
        double var45 = (double)par3 + par1Block.maxY;
        double var47 = (double)par4 + par1Block.minZ;
        double var49 = (double)par4 + par1Block.maxZ;
        var5.addVertexWithUV(var43, var45, var49, var33, var37);
        var5.addVertexWithUV(var43, var45, var47, var25, var29);
        var5.addVertexWithUV(var41, var45, var47, var27, var31);
        var5.addVertexWithUV(var41, var45, var49, var35, var39);
        var14 = Direction.headInvisibleFace[var7];

        if (var8)
        {
            var14 = Direction.headInvisibleFace[Direction.footInvisibleFaceRemap[var7]];
        }

        byte var51 = 4;

        switch (var7)
        {
            case 0:
                var51 = 5;
                break;

            case 1:
                var51 = 3;

            case 2:
            default:
                break;

            case 3:
                var51 = 2;
        }

        if (var14 != 2 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2)))
        {
            var5.setBrightness(par1Block.minZ > 0.0D ? var13 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1));
            var5.setColorOpaque_F(var11, var11, var11);
            this.flipTexture = var51 == 2;
            this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2));
        }

        if (var14 != 3 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3)))
        {
            var5.setBrightness(par1Block.maxZ < 1.0D ? var13 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1));
            var5.setColorOpaque_F(var11, var11, var11);
            this.flipTexture = var51 == 3;
            this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3));
        }

        if (var14 != 4 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4)))
        {
            var5.setBrightness(par1Block.minZ > 0.0D ? var13 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4));
            var5.setColorOpaque_F(var12, var12, var12);
            this.flipTexture = var51 == 4;
            this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4));
        }

        if (var14 != 5 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5)))
        {
            var5.setBrightness(par1Block.maxZ < 1.0D ? var13 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4));
            var5.setColorOpaque_F(var12, var12, var12);
            this.flipTexture = var51 == 5;
            this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5));
        }

        this.flipTexture = false;
        return true;
    }