Example #1
0
  @Override
  protected void actionPerformed(GuiButton button) {
    UpdateManagerMod mod = null;

    if (selected >= 0) mod = mods.get(getSelected());

    if (button.enabled)
      switch (button.id) {
        case 0:
          {
            ModLoader.openGUI(
                ModLoader.getMinecraftInstance().thePlayer, new GuiModListWithUMButton(parentGui));
            break;
          }
        case 1:
          {
            UpdateManager.openWebpage(UpdateManager.umWebpage);
            break;
          }
        case 2:
          {
            try {
              URL url = new URL("https://dl.dropbox.com/u/43671482/Update%20Manager/MotW.txt");
              BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream()));
              UpdateManager.openWebpage(r.readLine());
            } catch (IOException e) {
              e.printStackTrace();
            }

            break;
          }
        case 3:
          {
            ModLoader.openGUI(ModLoader.getMinecraftInstance().thePlayer, new GuiSettings(this));
            break;
          }
        case 4:
          {
            UpdateManager.openWebpage(mod.getModURL());
            break;
          }
        case 5:
          {
            ModLoader.openGUI(
                ModLoader.getMinecraftInstance().thePlayer, new GuiChangelog(this, mod));
            break;
          }
        case 6:
          {
            if (mod.getDisclaimerURL() == null) {
              if (!ThreadDownloadMod.downloadings.contains(mod.getModName())) {
                new ThreadDownloadMod(mod.getDirectDownloadURL(), mod);
                button.enabled = false;
              }
            } else
              ModLoader.openGUI(
                  ModLoader.getMinecraftInstance().thePlayer, new GuiDisclaimer(this, mod));

            break;
          }
        case 7:
          {
            Sys.openURL(
                "file://"
                    + new File(Minecraft.getMinecraftDir(), "downloadedMods").getAbsolutePath());
            break;
          }
        case 8:
          {
            mod.onSpecialButtonClicked();
            break;
          }
      }

    super.actionPerformed(button);
  }
Example #2
0
  @Override
  public void initGui() {
    mods = UpdateManager.sortMods(UpdateManager.loadedModsSet, UpdateManager.loadedModsMap);
    for (UpdateManagerMod mod : mods)
      listWidth = Math.max(listWidth, fontRenderer.getStringWidth(mod.getModName()) + 20);
    StringTranslate.getInstance();
    int shiftx = 10;
    int shifty = 40;

    controlList.add(
        new GuiButton(0, shiftx, height - 30, fontRenderer.getStringWidth("Back") + 8, 20, "Back"));
    shiftx += fontRenderer.getStringWidth("Back") + 12;
    controlList.add(
        new GuiButton(
            1,
            shiftx,
            height - 30,
            fontRenderer.getStringWidth("Update Manager Forum Topic") + 8,
            20,
            "Update Manager Forum Topic"));
    shiftx += fontRenderer.getStringWidth("Update Manager Forum Topic") + 12;
    controlList.add(
        new GuiButton(2, shiftx, height - 30, fontRenderer.getStringWidth("MotW") + 8, 20, "MotW"));
    shiftx += fontRenderer.getStringWidth("MotW") + 12;
    controlList.add(
        new GuiButton(
            3, shiftx, height - 30, fontRenderer.getStringWidth("Settings") + 8, 20, "Settings"));
    shiftx += fontRenderer.getStringWidth("Settings") + 12;
    controlList.add(
        new GuiButton(
            4,
            width - fontRenderer.getStringWidth("Website") - 12,
            shifty,
            fontRenderer.getStringWidth("Website") + 8,
            20,
            "Website"));
    shifty += 22;
    controlList.add(
        new GuiButton(
            5,
            width - fontRenderer.getStringWidth("Changelog") - 12,
            shifty,
            fontRenderer.getStringWidth("Changelog") + 8,
            20,
            "Changelog"));
    shifty += 22;
    controlList.add(
        new GuiButton(
            6,
            width - fontRenderer.getStringWidth("Download") - 12,
            shifty,
            fontRenderer.getStringWidth("Download") + 8,
            20,
            "Download"));
    controlList.add(
        new GuiButton(
            7,
            shiftx,
            height - 30,
            fontRenderer.getStringWidth("View Downloaded Mods") + 8,
            20,
            "View Downloaded Mods"));
    for (int i = UpdateManager.online ? 4 : 1; i <= 6; i++)
      ((GuiButton) controlList.get(i)).enabled = i == 3;

    if (selected >= 0) selectModIndex(selected);

    modList = new GuiUMModSlot(this, listWidth);
    modList.registerScrollButtons(controlList, 7, 8);
  }
Example #3
0
 @Override
 public void drawScreen(int par1, int par2, float par3) {
   modList.drawScreen(par1, par2, par3);
   int d = updateDownloads();
   drawCenteredString(
       fontRenderer,
       UpdateManager.online
           ? "Mod Update Manager by TheWhiteWolves: "
               + UpdateManager.getQuantEntries(Boolean.valueOf(true), UpdateManager.loadedModsMap)
               + "/"
               + UpdateManager.loadedModsSet.size()
               + (d > 0 ? " (" + d + " ongoing Downloads)" : ".")
           : "Mod Update Manager (OFFLINE)",
       width / 2,
       16,
       0xFFFFFF);
   if (UpdateManager.online)
     fontRenderer.drawStringWithShadow(
         motwWeek == null
             ? motwWeek =
                 getMotwWeek("https://dl.dropbox.com/u/43671482/Update%20Manager/MotW_Week.txt")
             : motwWeek,
         180,
         height - 9,
         0xFFFFFF);
   int offset = listWidth + 20;
   UpdateManagerMod selectedMod;
   if (getSelected() >= 0 && (selectedMod = mods.get(getSelected())) != null) {
     int shifty = 35;
     Dimension dim = selectedMod.renderIcon(offset, shifty, this);
     offset += dim.width;
     GL11.glPushMatrix();
     GL11.glScalef(2.0F, 2.0F, 2.0F);
     fontRenderer.drawStringWithShadow(
         selectedMod.getModName(),
         offset / 2,
         shifty / 2 + (dim.height == 0 ? 0 : (dim.height / 2 - 12)),
         selectedMod.getModType().getHex());
     GL11.glScalef(1.0F, 1.0F, 1.0F);
     GL11.glPopMatrix();
     shifty += Math.max(25, dim.height);
     shifty =
         typeLine(
             selectedMod.getModType() != ModType.UNDEFINED
                 ? "Mod Type: " + selectedMod.getModType().getName()
                 : null,
             offset,
             shifty);
     shifty =
         typeLine(
             selectedMod.getReleaseType() != ModReleaseType.RELEASED
                 ? selectedMod.getReleaseType().getName()
                 : null,
             offset,
             shifty,
             selectedMod.getReleaseType().getHex());
     shifty += 5;
     shifty = typeLine("Client Version: " + selectedMod.getUMVersion(), offset, shifty);
     shifty =
         typeLine(
             "Latest Version: " + (UpdateManager.getWebVersionFor(selectedMod)), offset, shifty);
     shifty += 15;
     if (selectedMod.addNotes() != null) {
       shifty = typeLine(selectedMod.getNotesHeadliner(), offset + 10, shifty);
       for (String s : selectedMod.addNotes()) shifty = typeLine(s, offset + 10, shifty);
     }
     if (ThreadDownloadMod.downloadings.contains(selectedMod.getModName()))
       fontRenderer.drawStringWithShadow(
           "Downloading...",
           width - 6 - fontRenderer.getStringWidth("Downloading..."),
           110,
           0x00FF00);
   }
   super.drawScreen(par1, par2, par3);
 }