/** finds and deletes a Chat line by ID */
  public void deleteChatLine(int par1) {
    Iterator var2 = this.chatLines.iterator();
    ChatLine var3;

    do {
      if (!var2.hasNext()) {
        return;
      }

      var3 = (ChatLine) var2.next();
    } while (var3.getChatLineID() != par1);

    var2.remove();
  }
  public void drawChat(int par1) {
    if (this.mc.gameSettings.chatVisibility != 2) {
      byte var2 = 10;
      boolean var3 = false;
      int var4 = 0;
      int var5 = this.chatLines.size();
      float var6 = this.mc.gameSettings.chatOpacity * 0.9F + 0.1F;

      if (var5 > 0) {
        if (this.getChatOpen()) {
          var2 = 20;
          var3 = true;
        }

        int line = 0;
        int var7;
        int var9;
        int var12;
        int c = 0;

        for (var7 = 0; var7 + this.field_73768_d < this.chatLines.size() && var7 < var2; ++var7) {
          ChatLine var8 = (ChatLine) this.chatLines.get(var7 + this.field_73768_d);

          if (var8 != null) {
            var9 = par1 - var8.getUpdatedCounter();

            if (var9 < 200 || var3) {
              double var10 = (double) var9 / 200.0D;
              var10 = 1.0D - var10;
              var10 *= 10.0D;

              if (var10 < 0.0D) {
                var10 = 0.0D;
              }

              if (var10 > 1.0D) {
                var10 = 1.0D;
              }

              var10 *= var10;
              var12 = (int) (255.0D * var10);

              if (var3) {
                var12 = 255;
              }

              var12 = (int) ((float) var12 * var6);
              ++var4;

              if (var12 > 3) {
                c += 1;
                byte var13 = 3;
                int var14 = -var7 * 9;
                line += 9;

                GL11.glEnable(GL11.GL_BLEND);
                String var15 = var8.getChatLineString();

                if (!this.mc.gameSettings.chatColours) {
                  var15 = StringUtils.stripControlCodes(var15);
                }

                if (var12 / 2 << 24 == 33554432) {
                  c -= 1;
                }

                // chong = var12;
              }
            }
          }
        }

        if (c != 0) { // && Pringles.manager.chat.isEnabled()) {
          drawBorderedRect(
              3, 0 - (c * 9 + 7), 327, 0 - (c * 9 - 5), 1, -15658735, true); // , -2146365167);
          TTF.drawShadowString(
              font, "Chat", 5, 2 - (c * 9 + 6), org.newdawn.slick.Color.decode("0xFFFFFF"));
          drawBorderedRect(
              3, -c * 9 + 7, 327, -c * 9 + 12 + line - 2, 1, -15658735, true); // -2146365167);
        }

        for (var7 = 0; var7 + this.field_73768_d < this.chatLines.size() && var7 < var2; ++var7) {
          ChatLine var8 = (ChatLine) this.chatLines.get(var7 + this.field_73768_d);

          if (var8 != null) {
            var9 = par1 - var8.getUpdatedCounter();

            if (var9 < 200 || var3) {
              double var10 = (double) var9 / 200.0D;
              var10 = 1.0D - var10;
              var10 *= 10.0D;

              if (var10 < 0.0D) {
                var10 = 0.0D;
              }

              if (var10 > 1.0D) {
                var10 = 1.0D;
              }

              var10 *= var10;
              var12 = (int) (255.0D * var10);

              if (var3) {
                var12 = 255;
              }

              var12 = (int) ((float) var12 * var6);
              ++var4;

              if (var12 > 3) {
                c += 1;
                byte var13 = 3;
                int var14 = -var7 * 9;
                line += 9;
                // if (!Pringles.manager.chat.isEnabled())
                drawRect(var13, var14 - 1, 327, var14 + 8, var12 / 2 << 24);

                GL11.glEnable(GL11.GL_BLEND);
                String var15 = var8.getChatLineString();

                if (!this.mc.gameSettings.chatColours) {
                  var15 = StringUtils.stripControlCodes(var15);
                }

                if (var12 / 2 << 24 == 33554432) {
                  c -= 1;
                }

                TTF.drawShadowString(
                    font,
                    var15,
                    var13,
                    var14,
                    org.newdawn.slick.Color.decode(
                        "0xFFFFFF")); // 16777215 + org.newdawn.slick.Color((var12 << 24)));
                // chong = var12;
              }
            }
          }
        }
        if (var3) {
          var7 = this.mc.fontRenderer.FONT_HEIGHT;
          GL11.glTranslatef(0.0F, (float) var7, 0.0F);
          int var16 = var5 * var7 + var5;
          var9 = var4 * var7 + var4;
          int var17 = this.field_73768_d * var9 / var5;
          int var11 = var9 * var9 / var16;

          if (var16 != var9) {
            var12 = var17 > 0 ? 170 : 96;
            int var18 = this.field_73769_e ? 13382451 : 3355562;
            drawRect(0, -var17, 2, -var17 - var11, var18 + (var12 << 24));
            drawRect(2, -var17, 1, -var17 - var11, 13421772 + (var12 << 24));
          }
        }
      }
    }
  }