Ejemplo n.º 1
0
  @Override
  protected void drawSlot(
      int slotIndex, int minX, int maxX, int minY, int maxY, Tessellator tesselator) {
    Update update = updateList.get(slotIndex);
    if (update != null && !update.oldVersion.matches(update.newVersion)) {
      this.parent
          .getFontRenderer()
          .drawString(
              this.parent.getFontRenderer().trimStringToWidth(update.displayName, listWidth - 10),
              minX + 5,
              minY + 4,
              0xFFFFFF);
      if (this.parent.getFontRenderer().getStringWidth(update.newVersion) >= (listWidth - 125)) {
        this.parent
            .getFontRenderer()
            .drawString(
                this.parent
                    .getFontRenderer()
                    .trimStringToWidth(update.oldVersion + " -> ", listWidth - 10),
                minX + 5,
                minY + 15,
                0xCCCCCC);
        this.parent
            .getFontRenderer()
            .drawString(
                this.parent
                    .getFontRenderer()
                    .trimStringToWidth("  " + update.newVersion, listWidth - 10),
                minX + 5,
                minY + 25,
                0xCCCCCC);
      } else {
        this.parent
            .getFontRenderer()
            .drawString(
                this.parent
                    .getFontRenderer()
                    .trimStringToWidth(
                        update.oldVersion + " -> " + update.newVersion, listWidth - 10),
                minX + 5,
                minY + 15,
                0xCCCCCC);
      }

      String info;

      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      Minecraft.getMinecraft().renderEngine.bindTexture(Resources.GUI_ICONS);

      if (DownloadThread.isUpdating(update)) {
        Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 0, 0, 16, 16, 64, 32);

        info = StatCollector.translateToLocal(Strings.UPDATING);
      } else if (update.isDownloaded()) {
        Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 16, 0, 16, 16, 64, 32);

        if (!update.MOD_ID.equalsIgnoreCase(Reference.MOD_ID)) {
          info = StatCollector.translateToLocal(Strings.IS_DOWNLOADED);
        } else {
          info = StatCollector.translateToLocal(Strings.UNABLE_TO_REMOVE_SELF);
        }
      } else if (update.isErrored()) {
        Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 32, 0, 16, 16, 64, 32);

        info = StatCollector.translateToLocal(Strings.ERRORED);
      } else if (update.isDirectLink) {
        Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 16, 16, 16, 16, 64, 32);

        info = StatCollector.translateToLocal(Strings.DL_AVAILABLE);
      } else if (update.updateURL != null) {
        Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 0, 16, 16, 16, 64, 32);

        info = StatCollector.translateToLocal(Strings.LINK_TO_DL);
      } else {
        info = StatCollector.translateToLocal(Strings.CANNOT_UPDATE);
      }

      if (update.updateType == Update.UpdateType.NOT_ENOUGH_MODS) {
        Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 32, 16, 16, 16, 64, 32);
      } else if (update.updateType == Update.UpdateType.CURSE) {
        Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 48, 0, 16, 16, 64, 32);
      }

      this.parent
          .getFontRenderer()
          .drawString(
              this.parent.getFontRenderer().trimStringToWidth(info, listWidth - 10),
              minX + 5,
              minY + 35,
              0xCCCCCC);
    }
  }