Beispiel #1
0
  public void selectModIndex(int var1) {
    selected = var1;
    UpdateManagerMod mod = mods.get(var1);
    GuiButton bWebsite = (GuiButton) controlList.get(4);
    GuiButton bChangelog = (GuiButton) controlList.get(5);
    GuiButton bDownload = (GuiButton) controlList.get(6);

    if (UpdateManager.online) {
      bWebsite.enabled = true;
      bChangelog.enabled = mod.getChangelogURL() != null;
      bDownload.enabled =
          mod.getDirectDownloadURL() != null
              && !ThreadDownloadMod.downloadings.contains(mod.getModName());
    }

    if (specialButton != null) controlList.remove(specialButton);

    if (mod.getSpecialButtonName() != null) {
      String name = mod.getSpecialButtonName();
      specialButton =
          new GuiButton(
              8,
              width - fontRenderer.getStringWidth(name) - 12,
              106,
              fontRenderer.getStringWidth(name) + 8,
              20,
              name);
      controlList.add(specialButton);
    }
  }
 /** intilize the buttons for this GUI */
 public void initButtons() {
   StringTranslate stringtranslate = StringTranslate.getInstance();
   controlList.add(
       buttonSelect =
           new GuiButton(
               1,
               width / 2 - 154,
               height - 52,
               150,
               20,
               stringtranslate.translateKey("selectWorld.select")));
   controlList.add(
       buttonDelete =
           new GuiButton(
               6,
               width / 2 - 154,
               height - 28,
               70,
               20,
               stringtranslate.translateKey("selectWorld.rename")));
   controlList.add(
       buttonRename =
           new GuiButton(
               2,
               width / 2 - 74,
               height - 28,
               70,
               20,
               stringtranslate.translateKey("selectWorld.delete")));
   controlList.add(
       new GuiButton(
           3,
           width / 2 + 4,
           height - 52,
           150,
           20,
           stringtranslate.translateKey("selectWorld.create")));
   controlList.add(
       new GuiButton(
           0, width / 2 + 4, height - 28, 150, 20, stringtranslate.translateKey("gui.cancel")));
   buttonSelect.enabled = false;
   buttonRename.enabled = false;
   buttonDelete.enabled = false;
 }
Beispiel #3
0
  int updateDownloads() {
    if (selected < 0) return 0;
    int i = ThreadDownloadMod.downloadings.size();
    GuiButton bDownload = (GuiButton) controlList.get(6);
    if (mods.get(selected).getDirectDownloadURL() != null
        && !ThreadDownloadMod.downloadings.contains(mods.get(selected).getModName()))
      bDownload.enabled = true;

    return i;
  }
  /** Adds Demo buttons on Main Menu for players who are playing Demo. */
  private void addDemoButtons(int par1, int par2) {
    buttonList.add(new GuiButton(11, width / 2 - 100, par1, I18n.func_135053_a("menu.playdemo")));
    buttonList.add(
        buttonResetDemo =
            new GuiButton(
                12, width / 2 - 100, par1 + par2 * 1, I18n.func_135053_a("menu.resetdemo")));
    ISaveFormat isaveformat = mc.getSaveLoader();
    WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

    if (worldinfo == null) {
      buttonResetDemo.enabled = false;
    }
  }
Beispiel #5
0
 /** Adds the buttons (and other controls) to the screen in question. */
 public void initGui() {
   controlList.clear();
   Keyboard.enableRepeatEvents(true);
   controlList.add(new GuiButton(0, width / 2 - 100, height / 4 + 120, "Done"));
   // Spout start
   controlList.add(
       unicode = new GuiButton(1, width / 2 - 100, height / 4 + 142, "Send As Unicode"));
   if (!ConfigReader.sendColorsAsUnicode) {
     unicode.displayString = "Send As Plain Text";
   }
   if (!this.mc.theWorld.isRemote) {
     unicode.drawButton = false;
     unicode.enabled = false;
   }
   // Spout end
 }
Beispiel #6
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);
  }