Ejemplo n.º 1
0
  public void createButtons() {
    this.buttons.add(
        new GuiButton(
            0,
            this.width / 2 + 4,
            this.height - 28,
            150,
            20,
            Translator.format("gui.done", new Object[0])));
    this.buttons.add(
        new GuiButton(
            1,
            this.width / 2 - 160,
            this.height - 52,
            80,
            20,
            Translator.format("stat.generalButton", new Object[0])));
    GuiButton var1;
    GuiButton var2;
    GuiButton var3;
    this.buttons.add(
        var1 =
            new GuiButton(
                2,
                this.width / 2 - 80,
                this.height - 52,
                80,
                20,
                Translator.format("stat.blocksButton", new Object[0])));
    this.buttons.add(
        var2 =
            new GuiButton(
                3,
                this.width / 2,
                this.height - 52,
                80,
                20,
                Translator.format("stat.itemsButton", new Object[0])));
    this.buttons.add(
        var3 =
            new GuiButton(
                4,
                this.width / 2 + 80,
                this.height - 52,
                80,
                20,
                Translator.format("stat.mobsButton", new Object[0])));

    if (this.blockStats.getSize() == 0) {
      var1.enabled = false;
    }

    if (this.itemStats.getSize() == 0) {
      var2.enabled = false;
    }

    if (this.mobStats.getSize() == 0) {
      var3.enabled = false;
    }
  }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  @Override
  protected void onInitDialog() {
    buttonList.remove(btnOk);
    btnCancel.xPosition = dialogX + 60;

    buttonList.add(btnImgur = new GuiButton(0, dialogX + 15, dialogY + 40, 70, 20, "Imgur"));
    buttonList.add(btnFacebook = new GuiButton(2, dialogX + 95, dialogY + 10, 70, 20, "Facebook"));
    buttonList.add(btnTwitter = new GuiButton(3, dialogX + 15, dialogY + 10, 70, 20, "Twitter"));
    buttonList.add(btnReddit = new GuiButton(5, dialogX + 95, dialogY + 40, 70, 20, "Reddit"));

    btnDropBox = new GuiButton(1, dialogX + 15, dialogY + 70, 70, 20, "Dropbox");
    btnGoogleDrive = new GuiButton(4, dialogX + 95, dialogY + 70, 70, 20, "Google Drive");
    buttonList.add(btnDropBox);
    buttonList.add(btnGoogleDrive);

    if (!(new File(System.getProperty("user.home"), "/dropbox/").exists())) {
      btnDropBox.enabled = false;
    }
    if (!(new File(System.getProperty("user.home"), "/Google Drive/").exists())) {
      btnGoogleDrive.enabled = false;
    }

    btnFacebook.enabled = false;
  }
Ejemplo n.º 3
0
 @SuppressWarnings("unchecked")
 private void refreshButtons() {
   for (GuiButton button : (List<GuiButton>) buttonList) {
     WeatherTask[] tasks = WeatherTask.values();
     if (button.id >= 0 && button.id < tasks.length) {
       WeatherTask task = WeatherTask.values()[button.id];
       if (WeatherTask.worldIsState(task, getTileEntity().getWorldObj().getWorldInfo())) {
         button.enabled = false;
       } else {
         button.enabled = true;
       }
     }
   }
 }
Ejemplo n.º 4
0
  @Override
  public void initGui() {
    int x = (this.width / 2) - 100;
    int y = (this.height / 4) - 15;

    masterDebugSwitch =
        new GuiButton(
            100,
            x,
            y,
            "Master debug switch: " + (WDLDebugMessageCause.globalDebugEnabled ? "On" : "Off"));
    this.buttonList.add(masterDebugSwitch);

    WDLDebugMessageCause[] causes = WDLDebugMessageCause.values();

    y += 28;

    for (int i = 0; i < causes.length; i++) {
      GuiButton causeBtn = new GuiButton(i, x, y, causes[i].toString());
      causeBtn.enabled = WDLDebugMessageCause.globalDebugEnabled;

      this.buttonList.add(causeBtn);

      y += 22;
    }

    y += 6;

    this.buttonList.add(new GuiButton(101, x, y, "Done"));
  }
  @Override
  public void updateScreen() {
    // Makes the cursor on the text box blink.
    super.updateScreen();

    try {
      babyNameTextField.updateCursorCounter();

      if (babyNameTextField.getText().isEmpty()) {
        doneButton.enabled = false;
      } else {
        doneButton.enabled = true;
      }
    } catch (NullPointerException e) {

    }
  }
 @Override
 public void actionPerformed(IGuiWidget guiWidget) {
   if (guiWidget instanceof GuiCheckBox) {
     GuiCheckBox checkBox = (GuiCheckBox) guiWidget;
     switch (checkBox.getID()) {
       case 0:
         widg.useMetadata = checkBox.checked;
         incButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
         decButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
         break;
       case 2:
         widg.useNBT = checkBox.checked;
         break;
       case 3:
         widg.useOreDict = checkBox.checked;
         checkBoxUseDamage.enabled = !checkBox.checked;
         checkBoxUseNBT.enabled = !checkBox.checked;
         checkBoxUseModSimilarity.enabled = !checkBox.checked;
         incButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
         decButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
         break;
       case 4:
         widg.useModSimilarity = checkBox.checked;
         checkBoxUseDamage.enabled = !checkBox.checked;
         checkBoxUseNBT.enabled = !checkBox.checked;
         checkBoxUseOreDict.enabled = !checkBox.checked;
         incButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
         decButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
         break;
     }
   }
   super.actionPerformed(guiWidget);
 }
Ejemplo n.º 7
0
 private void switchTab(int newTab) {
   GuiButton button;
   for (int i = 0; i < this.buttonList.size(); i++) {
     button = (GuiButton) this.buttonList.get(i);
     if (button.id != 000
         && button.id != 100
         && button.id != 200
         && button.id != 300
         && button.id != 400
         && button.id != 999) // Make sure we're not removing an important button.
     {
       if ((button.id / 100.00F) > (newTab + 0.99F) || (button.id / 100.00F) < (newTab - 0.01F)) {
         button.drawButton = false;
       } else {
         button.drawButton = true;
       }
     }
     if (button.id == (newTab * 100)) {
       button.enabled = false;
     } else {
       button.enabled = true;
     }
   }
 }
Ejemplo n.º 8
0
 private void checkValidInput() {
   boolean valid = true;
   kError = null;
   vError = null;
   if (canEditText && !validName()) {
     valid = false;
     kError = "Duplicate Tag Name";
   }
   try {
     validValue(value.getText(), nbt.getId());
     valid &= true;
   } catch (NumberFormatException e) {
     vError = e.getMessage();
     valid = false;
   }
   save.enabled = valid;
 }
  protected void actionPerformed(GuiButton button) {
    switch (button.id) {
      case 1:
        button.enabled = false;

        try {
          Class oclass = Class.forName("java.awt.Desktop");
          Object object =
              oclass.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]);
          oclass
              .getMethod("browse", new Class[] {URI.class})
              .invoke(object, new Object[] {new URI("http://www.minecraft.net/store?source=demo")});
        } catch (Throwable throwable) {
          logger.error("Couldn\'t open link", throwable);
        }

        break;
      case 2:
        this.mc.displayGuiScreen((GuiScreen) null);
        this.mc.setIngameFocus();
    }
  }
Ejemplo n.º 10
0
  @Override
  protected void actionPerformed(GuiButton guibutton) {
    if (!guibutton.enabled) {
      return;
    }
    if (guibutton.id == 0) {
      if (!MekanismUtils.noUpdates()) {
        updatedRecently = true;
        updateProgress = "Downloading latest version...";
        guibutton.enabled = false;

        if (Mekanism.versionNumber.comparedState(Version.get(Mekanism.latestVersionNumber)) == -1) {
          new ThreadClientUpdate(
              "http://dl.dropbox.com/u/90411166/Mekanism-v" + Mekanism.latestVersionNumber + ".jar",
              "");
        }

        for (IModule module : Mekanism.modulesLoaded) {
          if (module.getVersion().comparedState(Version.get(Mekanism.latestVersionNumber)) == -1) {
            new ThreadClientUpdate(
                "http://dl.dropbox.com/u/90411166/Mekanism"
                    + module.getName()
                    + "-v"
                    + Mekanism.latestVersionNumber
                    + ".jar",
                module.getName());
          }
        }
      } else {
        updateProgress = "You already have the latest version.";
      }
    }
    if (guibutton.id == 1) {
      mc.displayGuiScreen(null);
    }
  }
Ejemplo n.º 11
0
  @Override
  protected void actionPerformed(GuiButton button) throws IOException {
    if (!button.enabled) {
      return;
    }

    if (button.id == 100) {
      // "Master switch"
      WDLDebugMessageCause.globalDebugEnabled ^= true;

      button.displayString =
          "Master debug switch: " + (WDLDebugMessageCause.globalDebugEnabled ? "On" : "Off");

      for (Object obj : buttonList) {
        GuiButton btn = (GuiButton) obj;
        if (btn.id < 100) {
          btn.enabled = WDLDebugMessageCause.globalDebugEnabled;
        }
      }
    } else if (button.id == 101) {
      WDL.baseProps.setProperty(
          "Debug.globalDebugEnabled", WDLDebugMessageCause.globalDebugEnabled ? "true" : "false");
      for (WDLDebugMessageCause cause : WDLDebugMessageCause.values()) {
        WDL.baseProps.setProperty("Debug." + cause.name(), cause.isEnabled() ? "true" : "false");
      }
      WDL.saveProps();

      this.mc.displayGuiScreen(this.parent);
    } else {
      WDLDebugMessageCause cause = WDLDebugMessageCause.values()[button.id];

      cause.toggleEnabled();

      button.displayString = cause.toString();
    }
  }
Ejemplo n.º 12
0
  /** Adds the buttons (and other controls) to the screen in question. */
  public void initGui() {
    int i = 0;
    this.field_152319_i = I18n.format("options.stream.title", new Object[0]);
    this.field_152313_r = I18n.format("options.stream.chat.title", new Object[0]);
    GameSettings.Options[] aoptions = field_152312_a;
    int j = aoptions.length;
    int k;
    GameSettings.Options options;

    for (k = 0; k < j; ++k) {
      options = aoptions[k];

      if (options.getEnumFloat()) {
        this.buttonList.add(
            new GuiOptionSlider(
                options.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                options));
      } else {
        this.buttonList.add(
            new GuiOptionButton(
                options.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                options,
                this.field_152318_h.getKeyBinding(options)));
      }

      ++i;
    }

    if (i % 2 == 1) {
      ++i;
    }

    this.field_152314_s = this.height / 6 + 24 * (i >> 1) + 6;
    i += 2;
    aoptions = field_152316_f;
    j = aoptions.length;

    for (k = 0; k < j; ++k) {
      options = aoptions[k];

      if (options.getEnumFloat()) {
        this.buttonList.add(
            new GuiOptionSlider(
                options.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                options));
      } else {
        this.buttonList.add(
            new GuiOptionButton(
                options.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                options,
                this.field_152318_h.getKeyBinding(options)));
      }

      ++i;
    }

    this.buttonList.add(
        new GuiButton(
            200,
            this.width / 2 - 155,
            this.height / 6 + 168,
            150,
            20,
            I18n.format("gui.done", new Object[0])));
    GuiButton guibutton =
        new GuiButton(
            201,
            this.width / 2 + 5,
            this.height / 6 + 168,
            150,
            20,
            I18n.format("options.stream.ingestSelection", new Object[0]));
    guibutton.enabled =
        this.mc.func_152346_Z().func_152924_m()
                && this.mc.func_152346_Z().func_152925_v().length > 0
            || this.mc.func_152346_Z().func_152908_z();
    this.buttonList.add(guibutton);
  }
Ejemplo n.º 13
0
  public void createGui() {
    buttonList.clear();

    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;

    buttonList.add(
        new GuiButton(
            returnStates[guiState] == -1337 ? -1337 : 1337 + returnStates[guiState],
            k + this.xSize - 25,
            l + 5,
            20,
            20,
            returnStates[guiState] == -1337
                ? translate("recmod.gui.close")
                : translate("recmod.gui.back")));

    int buttonDelim = 21;
    int buttonSize = this.xSize - 16;
    int smallButtonSize = buttonSize / 2;

    switch (guiState) {
      case 0:
        buttonList.add(
            new GuiButton(
                0,
                k + 8 + smallButtonSize * 0,
                l + 30 + buttonDelim * 0,
                smallButtonSize,
                20,
                '\u00A7'
                    + (RecMod.instance.isPlayerRecording(boundPlayer)
                        ? translate("recmod.gui.enabledcode")
                        : translate("recmod.gui.disabledcode"))
                    + translate("recmod.gui.pane.main.recording")));
        buttonList.add(
            new GuiButton(
                1,
                k + 8 + smallButtonSize * 1,
                l + 30 + buttonDelim * 0,
                smallButtonSize,
                20,
                '\u00A7'
                    + (RecMod.instance.isPlayerStreaming(boundPlayer)
                        ? translate("recmod.gui.enabledcode")
                        : translate("recmod.gui.disabledcode"))
                    + translate("recmod.gui.pane.main.streaming")));
        buttonList.add(
            new GuiButton(1338, k + 8, l + 30 + buttonDelim * 1, buttonSize, 20, stateNames[1]));
        buttonList.add(
            new GuiButton(1339, k + 8, l + 30 + buttonDelim * 2, buttonSize, 20, stateNames[2]));
        buttonList.add(
            new GuiButton(1340, k + 8, l + 30 + buttonDelim * 3, buttonSize, 20, stateNames[3]));

        GuiButton temp =
            new GuiButton(1341, k + 8, l + 30 + buttonDelim * 4, buttonSize, 20, stateNames[4]);
        temp.enabled = false;
        buttonList.add(temp);
        temp = new GuiButton(-1111, k + 8, l + 30 + buttonDelim * 5, buttonSize, 20, stateNames[5]);
        temp.enabled = false;
        buttonList.add(temp);
        break;
      case 1:
        buttonList.add(
            new GuiButton(
                5,
                k + 8,
                l + 30 + buttonDelim * 0,
                buttonSize,
                20,
                translate("recmod.gui.pane.general.kstate")
                    .replace(
                        "$s",
                        '\u00A7'
                            + (RecMod.instance.keepState
                                ? translate("recmod.gui.enabledcode")
                                    + translate("recmod.gui.enabled")
                                : translate("recmod.gui.disabledcode")
                                    + translate("recmod.gui.disabled")))));
        break;
      case 2:
        buttonList.add(
            new GuiButton(
                3,
                k + 8,
                l + 30 + buttonDelim * 0,
                buttonSize,
                20,
                translate("recmod.gui.pane.interface.bobber")
                    .replace(
                        "$s",
                        '\u00A7'
                            + (RecMod.instance.showSelf
                                ? translate("recmod.gui.enabledcode")
                                    + translate("recmod.gui.enabled")
                                : translate("recmod.gui.disabledcode")
                                    + translate("recmod.gui.disabled")))));
        buttonList.add(
            new GuiButton(
                4,
                k + 8,
                l + 30 + buttonDelim * 1,
                buttonSize,
                20,
                translate("recmod.gui.pane.interface.showMode")
                    .replace(
                        "$m",
                        '\u00A7'
                            + (RecMod.instance.showMode != 0
                                ? translate("recmod.gui.enabledcode")
                                : translate("recmod.gui.disabledcode"))
                            + showModes[RecMod.instance.showMode])));
        buttonList.add(
            new GuiButton(
                6,
                k + 8,
                l + 30 + buttonDelim * 2,
                buttonSize,
                20,
                translate("recmod.gui.pane.interface.posMode")
                    .replace("$m", posModes[RecMod.instance.posMode])));

        if (RecMod.instance.posMode == 5) {
          tfAbsX =
              new GuiNumTextField(
                  fontRendererObj,
                  k + 8 + smallButtonSize * 1,
                  l + 30 + buttonDelim * 3,
                  smallButtonSize,
                  20,
                  -4096,
                  4096,
                  RecMod.instance.absX);
          tfAbsY =
              new GuiNumTextField(
                  fontRendererObj,
                  k + 8 + smallButtonSize * 1,
                  l + 30 + buttonDelim * 4,
                  smallButtonSize,
                  20,
                  -2160,
                  2160,
                  RecMod.instance.absY);
          buttonList.add(
              new GuiButton(
                  7,
                  k + 9,
                  l + 30 + buttonDelim * 5,
                  buttonSize,
                  20,
                  translate("recmod.gui.pane.interface.savePos")));
        } else {
          tfAbsX = null;
          tfAbsY = null;
        }

        break;
      case 3:
        buttonList.add(
            new GuiButton(
                2,
                k + 8,
                l + 30 + buttonDelim * 0,
                buttonSize,
                20,
                translate("recmod.gui.pane.keyboard.enable")
                    .replace(
                        "$s",
                        '\u00A7'
                            + (RecMod.instance.enableKeys
                                ? translate("recmod.gui.enabledcode")
                                    + translate("recmod.gui.enabled")
                                : translate("recmod.gui.disabledcode")
                                    + translate("recmod.gui.disabled")))));

        if (RecMod.instance.enableKeys) {
          buttonList.add(
              new GuiButton(
                  1594,
                  k + 9,
                  l + 30 + buttonDelim * 2,
                  buttonSize,
                  20,
                  (listenKeyType == 0 ? '\u00A7' + translate("recmod.gui.highlightcode") : "")
                      + translate("recmod.gui.pane.keyboard.record")
                          .replace(
                              "$s",
                              RecMod.instance.keyRec == -1337
                                  ? translate("recmod.gui.disabled2")
                                  : Keyboard.getKeyName(RecMod.instance.keyRec))));
          buttonList.add(
              new GuiButton(
                  1595,
                  k + 9,
                  l + 30 + buttonDelim * 3,
                  buttonSize,
                  20,
                  (listenKeyType == 1 ? '\u00A7' + translate("recmod.gui.highlightcode") : "")
                      + translate("recmod.gui.pane.keyboard.stream")
                          .replace(
                              "$s",
                              RecMod.instance.keyStr == -1337
                                  ? translate("recmod.gui.disabled2")
                                  : Keyboard.getKeyName(RecMod.instance.keyStr))));
        }

        break;
    }
  }
  @Override
  public void initGui() {
    super.initGui();

    //  metaInfoStat = new GuiAnimatedStat(this, "Metadata?", Textures.GUI_INFO_LOCATION, xStart +
    // xSize, yStart + 5, 0xFF00AA00, null, false);

    buttonList.add(new GuiButton(0, guiLeft + 4, guiTop + 20, 70, 20, "Search item..."));
    buttonList.add(new GuiButton(1, guiLeft + 78, guiTop + 20, 100, 20, "Search inventory..."));
    decButton = new GuiButton(2, guiLeft + 140, guiTop + 85, 10, 20, "-");
    incButton = new GuiButton(3, guiLeft + 167, guiTop + 85, 10, 20, "+");
    buttonList.add(decButton);
    buttonList.add(incButton);
    checkBoxUseDamage =
        new GuiCheckBox(0, guiLeft + 4, guiTop + 72, 0xFF000000, "Use metadata / damage values");
    checkBoxUseDamage.setTooltip(
        Arrays.asList(
            new String[] {
              "Check to handle differently damaged tools",
              "or different colors of Wool as different."
            }));
    checkBoxUseDamage.checked = widg.useMetadata;
    addWidget(checkBoxUseDamage);
    checkBoxUseNBT = new GuiCheckBox(2, guiLeft + 4, guiTop + 108, 0xFF000000, "Use NBT");
    checkBoxUseNBT.setTooltip(
        Arrays.asList(
            new String[] {
              "Check to handle items like Enchanted Books", "or Firework as different."
            }));
    checkBoxUseNBT.checked = widg.useNBT;
    addWidget(checkBoxUseNBT);
    checkBoxUseOreDict =
        new GuiCheckBox(3, guiLeft + 4, guiTop + 120, 0xFF000000, "Use Ore Dictionary");
    checkBoxUseOreDict.setTooltip(
        Arrays.asList(
            new String[] {
              "Check to handle items registered in the", "Ore Dictionary (like Wood) as the same."
            }));
    checkBoxUseOreDict.checked = widg.useOreDict;
    addWidget(checkBoxUseOreDict);
    checkBoxUseModSimilarity =
        new GuiCheckBox(4, guiLeft + 4, guiTop + 132, 0xFF000000, "Use Mod similarity");
    checkBoxUseModSimilarity.setTooltip(
        Arrays.asList(new String[] {"Check to handle items from the", "same mod as the same."}));
    checkBoxUseModSimilarity.checked = widg.useModSimilarity;
    addWidget(checkBoxUseModSimilarity);

    variableField =
        new WidgetComboBox(
            fontRendererObj, guiLeft + 90, guiTop + 56, 80, fontRendererObj.FONT_HEIGHT + 1);
    variableField.setElements(guiProgrammer.te.getAllVariables());
    variableField.setText(widg.getVariable());

    if (Config.getProgrammerDifficulty() == 2) {
      addWidget(variableField);
    }

    checkBoxUseDamage.enabled = !checkBoxUseOreDict.checked && !checkBoxUseModSimilarity.checked;
    incButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
    decButton.enabled = checkBoxUseDamage.enabled && checkBoxUseDamage.checked;
    checkBoxUseNBT.enabled = !checkBoxUseOreDict.checked && !checkBoxUseModSimilarity.checked;
    checkBoxUseOreDict.enabled = !checkBoxUseModSimilarity.checked;
    checkBoxUseModSimilarity.enabled = !checkBoxUseOreDict.checked;

    if (searchGui != null) widg.setFilter(searchGui.getSearchStack());
    if (invSearchGui != null) widg.setFilter(invSearchGui.getSearchStack());
  }
Ejemplo n.º 15
0
  public void updateButtonList() {
    for (int k1 = buttonList.size() - 1; k1 >= 0; k1--) {
      GuiButton btn = (GuiButton) this.buttonList.get(k1);

      if (btn.id >= 5 && btn.id <= 7
          || btn.id == 15
          || btn.id >= 11 && btn.id <= 13
          || btn.id >= ID_HAT_START_ID) {
        buttonList.remove(k1);
      } else if (btn.id == ID_PAGE_LEFT) {
        if (pageNumber == 0 || view == VIEW_COLOURIZER) {
          btn.enabled = false;
        } else {
          btn.enabled = true;
        }
      } else if (btn.id == ID_PAGE_RIGHT) {
        if ((pageNumber + 1) * 6 >= hatsToShow.size() || view == VIEW_COLOURIZER) {
          btn.enabled = false;
        } else {
          btn.enabled = true;
        }
      } else if (btn.id == ID_NONE) {
        if (stand.hatName.equalsIgnoreCase("")) {
          btn.enabled = false;
        } else {
          btn.enabled = true;
        }
      } else if (btn.id == ID_DONE_SELECT) {
        btn.enabled = view != VIEW_COLOURIZER;
      }
    }

    if (view == VIEW_HATS) {
      int button = 0;

      for (int i = pageNumber * 6; i < hatsToShow.size() && i < (pageNumber + 1) * 6; i++) {
        GuiButton btn;
        String hatName = (String) hatsToShow.get(i);

        btn =
            new GuiButton(
                ID_HAT_START_ID + i,
                width / 2 - 6,
                height / 2 - 78 + (22 * button),
                88,
                20,
                hatName);

        if ((view == VIEW_HATS) && hatName.toLowerCase().equalsIgnoreCase(stand.hatName)) {
          btn.enabled = false;
        }

        buttonList.add(btn);

        button++;
        if (button == 6) {
          button = 0;
          break;
        }
      }

      int pageCount = (int) Math.ceil((float) hatsToShow.size() / 6F);
      if (pageCount <= 0) {
        pageCount = 1;
      }
      currentDisplay =
          StatCollector.translateToLocal("hats.gui.allHats")
              + " ("
              + (pageNumber + 1)
              + "/"
              + (pageCount)
              + ")";
    } else if (view == VIEW_COLOURIZER) {
      int button = 0;

      for (int i = 0; i < 4; i++) {
        GuiButton btn =
            new GuiSlider(
                i == 3 ? 15 : 5 + i,
                width / 2 - 6,
                height / 2 - 78 + (22 * button),
                88,
                i == 0
                    ? StatCollector.translateToLocal("item.fireworksCharge.red") + ": "
                    : i == 1
                        ? StatCollector.translateToLocal("item.fireworksCharge.green") + ": "
                        : i == 2
                            ? StatCollector.translateToLocal("item.fireworksCharge.blue") + ": "
                            : StatCollector.translateToLocal("hats.gui.alpha") + ": ",
                "",
                0,
                255,
                i == 0 ? colourR : i == 1 ? colourG : i == 2 ? colourB : alpha,
                false,
                true,
                this);
        buttonList.add(btn);

        button++;
      }

      buttonList.add(
          new GuiButton(
              ID_HEAD,
              width / 2 - 6,
              height / 2 - 78 + (22 * button),
              88,
              20,
              StatCollector.translateToLocal("item.skull.char.name")
                  + ": "
                  + TileEntityHatStand.headNames[stand.head]));
      button++;

      buttonList.add(
          new GuiButton(
              ID_BASE,
              width / 2 - 6,
              height / 2 - 78 + (22 * button),
              88,
              20,
              StatCollector.translateToLocal("hats.addon.hatstands.gui.base")
                  + ": "
                  + (base
                      ? StatCollector.translateToLocal("gui.yes")
                      : StatCollector.translateToLocal("gui.no"))));
      button++;

      GuiButton btn;
      btn =
          new GuiButton(
              ID_STAND,
              width / 2 - 6,
              height / 2 - 78 + (22 * button),
              88,
              20,
              StatCollector.translateToLocal("hats.addon.hatstands.gui.stand")
                  + ": "
                  + (standPost
                      ? StatCollector.translateToLocal("gui.yes")
                      : StatCollector.translateToLocal("gui.no")));

      if (!stand.isOnFloor || !base) {
        btn.enabled = false;
      }

      buttonList.add(btn);

      button++;

      currentDisplay = StatCollector.translateToLocal("hats.gui.personalize");
    }
  }
Ejemplo n.º 16
0
  /**
   * Adds the buttons (and other controls) to the screen in question. Called when the GUI is
   * displayed and when the window resizes, the buttonList is cleared beforehand.
   */
  public void initGui() {
    int i = 0;
    this.field_152319_i = I18n.format("options.stream.title", new Object[0]);
    this.field_152313_r = I18n.format("options.stream.chat.title", new Object[0]);

    for (GameSettings.Options gamesettings$options : field_152312_a) {
      if (gamesettings$options.getEnumFloat()) {
        this.buttonList.add(
            new GuiOptionSlider(
                gamesettings$options.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                gamesettings$options));
      } else {
        this.buttonList.add(
            new GuiOptionButton(
                gamesettings$options.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                gamesettings$options,
                this.field_152318_h.getKeyBinding(gamesettings$options)));
      }

      ++i;
    }

    if (i % 2 == 1) {
      ++i;
    }

    this.field_152314_s = this.height / 6 + 24 * (i >> 1) + 6;
    i = i + 2;

    for (GameSettings.Options gamesettings$options1 : field_152316_f) {
      if (gamesettings$options1.getEnumFloat()) {
        this.buttonList.add(
            new GuiOptionSlider(
                gamesettings$options1.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                gamesettings$options1));
      } else {
        this.buttonList.add(
            new GuiOptionButton(
                gamesettings$options1.returnEnumOrdinal(),
                this.width / 2 - 155 + i % 2 * 160,
                this.height / 6 + 24 * (i >> 1),
                gamesettings$options1,
                this.field_152318_h.getKeyBinding(gamesettings$options1)));
      }

      ++i;
    }

    this.buttonList.add(
        new GuiButton(
            200,
            this.width / 2 - 155,
            this.height / 6 + 168,
            150,
            20,
            I18n.format("gui.done", new Object[0])));
    GuiButton guibutton =
        new GuiButton(
            201,
            this.width / 2 + 5,
            this.height / 6 + 168,
            150,
            20,
            I18n.format("options.stream.ingestSelection", new Object[0]));
    guibutton.enabled =
        this.mc.getTwitchStream().isReadyToBroadcast()
                && this.mc.getTwitchStream().func_152925_v().length > 0
            || this.mc.getTwitchStream().func_152908_z();
    this.buttonList.add(guibutton);
  }