Example #1
0
 @Override
 public void draw(final int x, final int y) {
   super.draw(x, y);
   if (maxValue > 0) {
     int w = 0;
     if (horizontal) {
       w = (int) ((bounds.width) * (float) (value) / (maxValue));
       RenderHelper.drawHorizontalGradientRect(
           x + bounds.x,
           y + bounds.y,
           x + bounds.x + w,
           y + bounds.y + bounds.height - 1,
           0xFFFF0000,
           0xFF550000);
     } else {
       w = (int) ((bounds.height) * (float) (value) / (maxValue));
       RenderHelper.drawVerticalGradientRect(
           x + bounds.x,
           y + bounds.y,
           x + bounds.x + bounds.width - 1,
           y + bounds.y + w,
           0xFFFF0000,
           0xFF550000);
     }
   }
   String s = value + "/" + maxValue;
   mc.fontRenderer.drawString(
       mc.fontRenderer.trimStringToWidth(s, getBounds().width),
       x + bounds.x,
       y + bounds.y + (bounds.height - mc.fontRenderer.FONT_HEIGHT) / 2,
       color);
 }
    public void renderAll() {
      RenderHelper.disableStandardItemLighting();
      fire.render(0.0625F);
      RenderHelper.enableStandardItemLighting();

      stick.render(0.0625F);
      fuel.render(0.0625F);
      cookingItem.render(0.0625F);
    }
Example #3
0
  @SideOnly(Side.CLIENT)
  private static void renderEnderSky() {
    TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();

    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    GL11.glDepthMask(false);
    renderEngine.bindTexture(locationEndSkyPng);
    Tessellator tessellator = Tessellator.instance;

    for (int i = 0; i < 6; ++i) {
      GL11.glPushMatrix();

      if (i == 1) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
      }

      if (i == 2) {
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
      }

      if (i == 3) {
        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
      }

      if (i == 4) {
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
      }

      if (i == 5) {
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
      }

      tessellator.startDrawingQuads();
      tessellator.setColorOpaque_I(2631720);
      tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, 0.0D, 0.0D);
      tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, 0.0D, 16.0D);
      tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D);
      tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D);
      tessellator.draw();
      GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
  }
  protected void doRenderItem(
      ItemRenderType type, ItemStack item, Item iconItem, FluidStack fluid) {

    IIcon icon = iconItem.getIcon(item, 0);
    IIcon mask = iconItem.getIcon(item, 1);
    boolean hasFluid = fluid != null;

    IIcon fluidIcon = hasFluid ? fluid.getFluid().getIcon(fluid) : mask;
    int fluidSheet = hasFluid ? fluid.getFluid().getSpriteNumber() : 0;
    int colorMult = hasFluid ? fluid.getFluid().getColor(fluid) : 0xFFFFFF;
    boolean isFloaty = hasFluid ? fluid.getFluid().getDensity(fluid) < 0 : false;

    if (fluid == null) {
      fluidIcon = Blocks.flowing_lava.getIcon(2, 0);
      fluidSheet = 0;
      colorMult = 0x3F3F3F;
    }
    GL11.glPushMatrix();

    Tessellator tessellator = Tessellator.instance;

    float iconMinX = icon.getMinU();
    float iconMaxX = icon.getMaxU();
    float iconMinY = icon.getMinV();
    float iconMaxY = icon.getMaxV();

    float maskMinX = mask.getMinU();
    float maskMaxX = mask.getMaxU();
    float maskMinY = mask.getMinV();
    float maskMaxY = mask.getMaxV();

    float fluidMinX = fluidIcon.getMinU();
    float fluidMaxX = fluidIcon.getMaxU();
    float fluidMinY = fluidIcon.getMinV();
    float fluidMaxY = fluidIcon.getMaxV();

    if (isFloaty && canFlip) {
      iconMaxY = icon.getMinV();
      iconMinY = icon.getMaxV();

      maskMaxY = mask.getMinV();
      maskMinY = mask.getMaxV();

      fluidMaxY = fluidIcon.getMinV();
      fluidMinY = fluidIcon.getMaxV();
    }
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    OpenGlHelper.glBlendFunc(
        GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    int texture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

    if (type == ItemRenderType.INVENTORY) {
      GL11.glDisable(GL11.GL_LIGHTING);

      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV(0, 16, 0, iconMinX, iconMaxY);
      tessellator.addVertexWithUV(16, 16, 0, iconMaxX, iconMaxY);
      tessellator.addVertexWithUV(16, 0, 0, iconMaxX, iconMinY);
      tessellator.addVertexWithUV(0, 0, 0, iconMinX, iconMinY);
      tessellator.draw();

      if (hasFluid) {
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0, 16, 0.001, maskMinX, maskMaxY);
        tessellator.addVertexWithUV(16, 16, 0.001, maskMaxX, maskMaxY);
        tessellator.addVertexWithUV(16, 0, 0.001, maskMaxX, maskMinY);
        tessellator.addVertexWithUV(0, 0, 0.001, maskMinX, maskMinY);
        tessellator.draw();

        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDepthMask(false);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        bindTexture(RenderHelper.engine(), fluidSheet);
        OpenGlHelper.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ONE, GL11.GL_ZERO);

        tessellator.startDrawingQuads();
        tessellator.setColorOpaque_I(colorMult);
        tessellator.addVertexWithUV(0, 16, 0.001, fluidMinX, fluidMaxY);
        tessellator.addVertexWithUV(16, 16, 0.001, fluidMaxX, fluidMaxY);
        tessellator.addVertexWithUV(16, 0, 0.001, fluidMaxX, fluidMinY);
        tessellator.addVertexWithUV(0, 0, 0.001, fluidMinX, fluidMinY);
        tessellator.draw();

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDepthMask(true);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }

      GL11.glEnable(GL11.GL_LIGHTING);
    } else {
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);

      if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0.5f, 4 / -16f, 0);
        GL11.glRotatef(180, 0, 1, 0);
      }
      ItemRenderer.renderItemIn2D(
          tessellator,
          iconMaxX,
          iconMinY,
          iconMinX,
          iconMaxY,
          icon.getIconWidth(),
          icon.getIconHeight(),
          0.0625F);

      if (hasFluid) {
        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, 1);
        tessellator.addVertexWithUV(0, 0, 0.001, maskMaxX, maskMaxY);
        tessellator.addVertexWithUV(1, 0, 0.001, maskMinX, maskMaxY);
        tessellator.addVertexWithUV(1, 1, 0.001, maskMinX, maskMinY);
        tessellator.addVertexWithUV(0, 1, 0.001, maskMaxX, maskMinY);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, -1);
        tessellator.addVertexWithUV(0, 1, -0.0635, maskMinX, maskMinY);
        tessellator.addVertexWithUV(1, 1, -0.0635, maskMaxX, maskMinY);
        tessellator.addVertexWithUV(1, 0, -0.0635, maskMaxX, maskMaxY);
        tessellator.addVertexWithUV(0, 0, -0.0635, maskMinX, maskMaxY);
        tessellator.draw();

        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDepthMask(false);
        bindTexture(RenderHelper.engine(), fluidSheet);
        OpenGlHelper.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ONE, GL11.GL_ZERO);

        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, 1);
        tessellator.setColorOpaque_I(colorMult);
        tessellator.addVertexWithUV(0, 0, 0.001, fluidMaxX, fluidMaxY);
        tessellator.addVertexWithUV(1, 0, 0.001, fluidMinX, fluidMaxY);
        tessellator.addVertexWithUV(1, 1, 0.001, fluidMinX, fluidMinY);
        tessellator.addVertexWithUV(0, 1, 0.001, fluidMaxX, fluidMinY);
        tessellator.draw();

        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, -1);
        tessellator.setColorOpaque_I(colorMult);
        tessellator.addVertexWithUV(0, 1, -0.0635, fluidMinX, fluidMinY);
        tessellator.addVertexWithUV(1, 1, -0.0635, fluidMaxX, fluidMinY);
        tessellator.addVertexWithUV(1, 0, -0.0635, fluidMaxX, fluidMaxY);
        tessellator.addVertexWithUV(0, 0, -0.0635, fluidMinX, fluidMaxY);
        tessellator.draw();

        GL11.glDepthMask(true);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    OpenGlHelper.glBlendFunc(
        GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glPopMatrix();
  }
Example #5
0
  /** Renders the sky with the partial tick time. Args: partialTickTime */
  @SideOnly(Side.CLIENT)
  private static void renderSky(float partialTickTime, DimensionInformation information) {
    initialize();

    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
    WorldClient world = Minecraft.getMinecraft().theWorld;
    TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Vec3 vec3 = world.getSkyColor(player, partialTickTime);
    float skyRed = (float) vec3.xCoord;
    float skyGreen = (float) vec3.yCoord;
    float skyBlue = (float) vec3.zCoord;
    float f6;

    boolean anaglyph = Minecraft.getMinecraft().gameSettings.anaglyph;
    if (anaglyph) {
      float f4 = (skyRed * 30.0F + skyGreen * 59.0F + skyBlue * 11.0F) / 100.0F;
      float f5 = (skyRed * 30.0F + skyGreen * 70.0F) / 100.0F;
      f6 = (skyRed * 30.0F + skyBlue * 70.0F) / 100.0F;
      skyRed = f4;
      skyGreen = f5;
      skyBlue = f6;
    }

    GL11.glColor3f(skyRed, skyGreen, skyBlue);
    Tessellator tessellator = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(skyRed, skyGreen, skyBlue);
    GL11.glCallList(glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    float[] sunsetColors =
        world.provider.calcSunriseSunsetColors(
            world.getCelestialAngle(partialTickTime), partialTickTime);
    float f7;
    float f8;
    float f9;
    float f10;

    if (sunsetColors != null) {
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glShadeModel(GL11.GL_SMOOTH);
      GL11.glPushMatrix();
      GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(
          MathHelper.sin(world.getCelestialAngleRadians(partialTickTime)) < 0.0F ? 180.0F : 0.0F,
          0.0F,
          0.0F,
          1.0F);
      GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
      f6 = sunsetColors[0];
      f7 = sunsetColors[1];
      f8 = sunsetColors[2];
      float f11;

      if (anaglyph) {
        f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
        f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
        f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
        f6 = f9;
        f7 = f10;
        f8 = f11;
      }

      tessellator.startDrawing(6);
      tessellator.setColorRGBA_F(f6, f7, f8, sunsetColors[3]);
      tessellator.addVertex(0.0D, 100.0D, 0.0D);
      byte b0 = 16;
      tessellator.setColorRGBA_F(sunsetColors[0], sunsetColors[1], sunsetColors[2], 0.0F);

      for (int j = 0; j <= b0; ++j) {
        f11 = j * (float) Math.PI * 2.0F / b0;
        float f12 = MathHelper.sin(f11);
        float f13 = MathHelper.cos(f11);
        tessellator.addVertex((f12 * 120.0F), (f13 * 120.0F), (-f13 * 40.0F * sunsetColors[3]));
      }

      tessellator.draw();
      GL11.glPopMatrix();
      GL11.glShadeModel(GL11.GL_FLAT);
    }

    renderCelestialBodies(partialTickTime, information, world, renderEngine, tessellator);

    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = player.getPosition(partialTickTime).yCoord - world.getHorizon();

    if (d0 < 0.0D) {
      GL11.glPushMatrix();
      GL11.glTranslatef(0.0F, 12.0F, 0.0F);
      GL11.glCallList(glSkyList2);
      GL11.glPopMatrix();
      f8 = 1.0F;
      f9 = -((float) (d0 + 65.0D));
      f10 = -f8;
      tessellator.startDrawingQuads();
      tessellator.setColorRGBA_I(0, 255);
      tessellator.addVertex((-f8), f9, f8);
      tessellator.addVertex(f8, f9, f8);
      tessellator.addVertex(f8, f10, f8);
      tessellator.addVertex((-f8), f10, f8);
      tessellator.addVertex((-f8), f10, (-f8));
      tessellator.addVertex(f8, f10, (-f8));
      tessellator.addVertex(f8, f9, (-f8));
      tessellator.addVertex((-f8), f9, (-f8));
      tessellator.addVertex(f8, f10, (-f8));
      tessellator.addVertex(f8, f10, f8);
      tessellator.addVertex(f8, f9, f8);
      tessellator.addVertex(f8, f9, (-f8));
      tessellator.addVertex((-f8), f9, (-f8));
      tessellator.addVertex((-f8), f9, f8);
      tessellator.addVertex((-f8), f10, f8);
      tessellator.addVertex((-f8), f10, (-f8));
      tessellator.addVertex((-f8), f10, (-f8));
      tessellator.addVertex((-f8), f10, f8);
      tessellator.addVertex(f8, f10, f8);
      tessellator.addVertex(f8, f10, (-f8));
      tessellator.draw();
    }

    if (world.provider.isSkyColored()) {
      GL11.glColor3f(skyRed * 0.2F + 0.04F, skyGreen * 0.2F + 0.04F, skyBlue * 0.6F + 0.1F);
    } else {
      GL11.glColor3f(skyRed, skyGreen, skyBlue);
    }

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
  }
Example #6
0
  @SideOnly(Side.CLIENT)
  private static void renderSkyTexture(ResourceLocation sky, ResourceLocation sky2, int type) {
    TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();

    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    GL11.glDepthMask(false);
    Tessellator tessellator = Tessellator.instance;

    for (int i = 0; i < 6; ++i) {
      GL11.glPushMatrix();

      UV[] uv = faceDown;
      int col = 0xffffff;

      if (i == 0) { // Down face
        uv = faceDown;
        switch (type) {
          case SKYTYPE_ALL:
            renderEngine.bindTexture(sky);
            break;
          case SKYTYPE_ALLHORIZONTAL:
          case SKYTYPE_ALTERNATING:
            renderEngine.bindTexture(sky2);
            break;
          default:
            col = 0;
            break;
        }
      } else if (i == 1) { // North face
        renderEngine.bindTexture(sky);
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        uv = faceNorth;
      } else if (i == 2) { // South face
        renderEngine.bindTexture(sky);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        uv = faceSouth;
      } else if (i == 3) { // Up face
        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
        uv = faceUp;
        switch (type) {
          case SKYTYPE_ALL:
            renderEngine.bindTexture(sky);
            break;
          case SKYTYPE_ALLHORIZONTAL:
          case SKYTYPE_ALTERNATING:
            renderEngine.bindTexture(sky2);
            break;
          default:
            col = 0;
            break;
        }
      } else if (i == 4) { // East face
        if (type == SKYTYPE_ALTERNATING && sky2 != null) {
          renderEngine.bindTexture(sky2);
        } else {
          renderEngine.bindTexture(sky);
        }
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
        uv = faceEast;
      } else if (i == 5) { // West face
        if (type == SKYTYPE_ALTERNATING && sky2 != null) {
          renderEngine.bindTexture(sky2);
        } else {
          renderEngine.bindTexture(sky);
        }
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
        uv = faceWest;
      }

      tessellator.startDrawingQuads();
      tessellator.setColorOpaque_I(col);
      tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, uv[0].u, uv[0].v);
      tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, uv[1].u, uv[1].v);
      tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, uv[2].u, uv[2].v);
      tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, uv[3].u, uv[3].v);
      tessellator.draw();
      GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
  }
  /**
   * Renders the active item in the player's hand when in first person mode. Args: partialTickTime
   */
  public void renderItemInFirstPerson(float par1) {
    float f1 =
        this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * par1;
    EntityClientPlayerMP entityclientplayermp = this.mc.thePlayer;
    float f2 =
        entityclientplayermp.prevRotationPitch
            + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * par1;
    GL11.glPushMatrix();
    GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(
        entityclientplayermp.prevRotationYaw
            + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * par1,
        0.0F,
        1.0F,
        0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
    float f3;
    float f4;

    if (entityclientplayermp instanceof EntityPlayerSP) {
      EntityPlayerSP entityplayersp = (EntityPlayerSP) entityclientplayermp;
      f3 =
          entityplayersp.prevRenderArmPitch
              + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * par1;
      f4 =
          entityplayersp.prevRenderArmYaw
              + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * par1;
      GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
    }

    ItemStack itemstack = this.itemToRender;
    f3 =
        this.mc.theWorld.getLightBrightness(
            MathHelper.floor_double(entityclientplayermp.posX),
            MathHelper.floor_double(entityclientplayermp.posY),
            MathHelper.floor_double(entityclientplayermp.posZ));
    f3 = 1.0F;
    int i =
        this.mc.theWorld.getLightBrightnessForSkyBlocks(
            MathHelper.floor_double(entityclientplayermp.posX),
            MathHelper.floor_double(entityclientplayermp.posY),
            MathHelper.floor_double(entityclientplayermp.posZ),
            0);
    int j = i % 65536;
    int k = i / 65536;
    OpenGlHelper.setLightmapTextureCoords(
        OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float f5;
    float f6;
    float f7;

    if (itemstack != null) {
      i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
      f7 = (float) (i >> 16 & 255) / 255.0F;
      f6 = (float) (i >> 8 & 255) / 255.0F;
      f5 = (float) (i & 255) / 255.0F;
      GL11.glColor4f(f3 * f7, f3 * f6, f3 * f5, 1.0F);
    } else {
      GL11.glColor4f(f3, f3, f3, 1.0F);
    }

    float f8;
    float f9;
    float f10;
    Render render;
    RenderPlayer renderplayer;

    if (itemstack != null && itemstack.getItem() instanceof ItemMap) {
      GL11.glPushMatrix();
      f4 = 0.8F;
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glTranslatef(
          -f5 * 0.4F,
          MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI * 2.0F) * 0.2F,
          -f6 * 0.2F);
      f7 = 1.0F - f2 / 45.0F + 0.1F;

      if (f7 < 0.0F) {
        f7 = 0.0F;
      }

      if (f7 > 1.0F) {
        f7 = 1.0F;
      }

      f7 = -MathHelper.cos(f7 * (float) Math.PI) * 0.5F + 0.5F;
      GL11.glTranslatef(0.0F, 0.0F * f4 - (1.0F - f1) * 1.2F - f7 * 0.5F + 0.04F, -0.9F * f4);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(f7 * -85.0F, 0.0F, 0.0F, 1.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));
      this.mc.renderEngine.resetBoundTexture();

      for (k = 0; k < 2; ++k) {
        int l = k * 2 - 1;
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) l);
        GL11.glRotatef((float) (-45 * l), 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef((float) (-65 * l), 0.0F, 1.0F, 0.0F);
        render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
        renderplayer = (RenderPlayer) render;
        f10 = 1.0F;
        GL11.glScalef(f10, f10, f10);
        renderplayer.renderFirstPersonArm(this.mc.thePlayer);
        GL11.glPopMatrix();
      }

      f6 = entityclientplayermp.getSwingProgress(par1);
      f5 = MathHelper.sin(f6 * f6 * (float) Math.PI);
      f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float) Math.PI);
      GL11.glRotatef(-f5 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F);
      f9 = 0.38F;
      GL11.glScalef(f9, f9, f9);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
      f10 = 0.015625F;
      GL11.glScalef(f10, f10, f10);
      this.mc.renderEngine.bindTexture("/misc/mapbg.png");
      Tessellator tessellator = Tessellator.instance;
      GL11.glNormal3f(0.0F, 0.0F, -1.0F);
      tessellator.startDrawingQuads();
      byte b0 = 7;
      tessellator.addVertexWithUV((double) (0 - b0), (double) (128 + b0), 0.0D, 0.0D, 1.0D);
      tessellator.addVertexWithUV((double) (128 + b0), (double) (128 + b0), 0.0D, 1.0D, 1.0D);
      tessellator.addVertexWithUV((double) (128 + b0), (double) (0 - b0), 0.0D, 1.0D, 0.0D);
      tessellator.addVertexWithUV((double) (0 - b0), (double) (0 - b0), 0.0D, 0.0D, 0.0D);
      tessellator.draw();

      IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
      MapData mapdata = ((ItemMap) itemstack.getItem()).getMapData(itemstack, this.mc.theWorld);

      if (custom == null) {
        if (mapdata != null) {
          this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, mapdata);
        }
      } else {
        custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.renderEngine, mapdata);
      }

      GL11.glPopMatrix();
    } else if (itemstack != null) {
      GL11.glPushMatrix();
      f4 = 0.8F;

      if (entityclientplayermp.getItemInUseCount() > 0) {
        EnumAction enumaction = itemstack.getItemUseAction();

        if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) {
          f6 = (float) entityclientplayermp.getItemInUseCount() - par1 + 1.0F;
          f5 = 1.0F - f6 / (float) itemstack.getMaxItemUseDuration();
          f8 = 1.0F - f5;
          f8 = f8 * f8 * f8;
          f8 = f8 * f8 * f8;
          f8 = f8 * f8 * f8;
          f9 = 1.0F - f8;
          GL11.glTranslatef(
              0.0F,
              MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float) Math.PI) * 0.1F)
                  * (float) ((double) f5 > 0.2D ? 1 : 0),
              0.0F);
          GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F);
          GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F);
        }
      } else {
        f7 = entityclientplayermp.getSwingProgress(par1);
        f6 = MathHelper.sin(f7 * (float) Math.PI);
        f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
        GL11.glTranslatef(
            -f5 * 0.4F,
            MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI * 2.0F) * 0.2F,
            -f6 * 0.2F);
      }

      GL11.glTranslatef(0.7F * f4, -0.65F * f4 - (1.0F - f1) * 0.6F, -0.9F * f4);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f5 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-f5 * 80.0F, 1.0F, 0.0F, 0.0F);
      f8 = 0.4F;
      GL11.glScalef(f8, f8, f8);
      float f11;
      float f12;

      if (entityclientplayermp.getItemInUseCount() > 0) {
        EnumAction enumaction1 = itemstack.getItemUseAction();

        if (enumaction1 == EnumAction.block) {
          GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
          GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
        } else if (enumaction1 == EnumAction.bow) {
          GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
          GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
          f10 =
              (float) itemstack.getMaxItemUseDuration()
                  - ((float) entityclientplayermp.getItemInUseCount() - par1 + 1.0F);
          f11 = f10 / 20.0F;
          f11 = (f11 * f11 + f11 * 2.0F) / 3.0F;

          if (f11 > 1.0F) {
            f11 = 1.0F;
          }

          if (f11 > 0.1F) {
            GL11.glTranslatef(
                0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F);
          }

          GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F);
          GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glTranslatef(0.0F, 0.5F, 0.0F);
          f12 = 1.0F + f11 * 0.2F;
          GL11.glScalef(1.0F, 1.0F, f12);
          GL11.glTranslatef(0.0F, -0.5F, 0.0F);
          GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
        }
      }

      if (itemstack.getItem().shouldRotateAroundWhenRendering()) {
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
      }

      if (itemstack.getItem().requiresMultipleRenderPasses()) {
        this.renderItem(entityclientplayermp, itemstack, 0);
        for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) {
          int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, x);
          f10 = (float) (i1 >> 16 & 255) / 255.0F;
          f11 = (float) (i1 >> 8 & 255) / 255.0F;
          f12 = (float) (i1 & 255) / 255.0F;
          GL11.glColor4f(f3 * f10, f3 * f11, f3 * f12, 1.0F);
          this.renderItem(entityclientplayermp, itemstack, x);
        }
      } else {
        this.renderItem(entityclientplayermp, itemstack, 0);
      }

      GL11.glPopMatrix();
    } else if (!entityclientplayermp.getHasActivePotion()) {
      GL11.glPushMatrix();
      f4 = 0.8F;
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glTranslatef(
          -f5 * 0.3F,
          MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI * 2.0F) * 0.4F,
          -f6 * 0.4F);
      GL11.glTranslatef(0.8F * f4, -0.75F * f4 - (1.0F - f1) * 0.6F, -0.9F * f4);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glRotatef(f5 * 70.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));
      this.mc.renderEngine.resetBoundTexture();
      GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
      GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
      GL11.glScalef(1.0F, 1.0F, 1.0F);
      GL11.glTranslatef(5.6F, 0.0F, 0.0F);
      render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
      renderplayer = (RenderPlayer) render;
      f10 = 1.0F;
      GL11.glScalef(f10, f10, f10);
      renderplayer.renderFirstPersonArm(this.mc.thePlayer);
      GL11.glPopMatrix();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.disableStandardItemLighting();
  }
  protected void drawToolTip(List par1List, int par2, int par3) {
    if (!par1List.isEmpty()) {
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glDisable(GL11.GL_DEPTH_TEST);
      int k = 0;
      Iterator iterator = par1List.iterator();

      while (iterator.hasNext()) {
        String s = (String) iterator.next();
        int l = this.fontRenderer.getStringWidth(s);

        if (l > k) {
          k = l;
        }
      }

      int i1 = par2 + 12;
      int j1 = par3 - 12;
      int k1 = 8;

      if (par1List.size() > 1) {
        k1 += 2 + (par1List.size() - 1) * 10;
      }

      if (i1 + k > this.width) {
        i1 -= 28 + k;
      }

      if (j1 + k1 + 6 > this.height) {
        j1 = this.height - k1 - 6;
      }

      this.zLevel = 300.0F;
      itemRenderer.zLevel = 300.0F;
      int l1 = -267386864;
      this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
      this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
      this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
      this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
      this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
      int i2 = 1347420415;
      int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
      this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
      this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
      this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
      this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);

      for (int k2 = 0; k2 < par1List.size(); ++k2) {
        String s1 = (String) par1List.get(k2);
        this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);

        if (k2 == 0) {
          j1 += 2;
        }

        j1 += 10;
      }

      this.zLevel = 0.0F;
      itemRenderer.zLevel = 0.0F;
    }
  }