Example #1
0
  @Override
  /**
   * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX,
   * mouseY, lastButtonClicked & timeSinceMouseClick.
   */
  protected void mouseClickMove(
      int mouseX, int mouseY, int lastButtonClicked, long timeSinceMouseClick) {
    super.mouseClickMove(mouseX, mouseY, lastButtonClicked, timeSinceMouseClick);

    if (lastClick == 0) {
      gb.xPosition = mouseX - (lastClickX - lastButtonX);
      gb.yPosition = mouseY - (lastClickY - lastButtonY);
    } else if (lastClick == 1) {
      if (mouseX > gb.xPosition && mouseY > gb.yPosition) {
        int sizeY = mouseY - gb.yPosition;

        if (sizeY > 20) sizeY = 20;

        gb = new GuiButton(1, gb.xPosition, gb.yPosition, mouseX - gb.xPosition, sizeY, "text");
        buttonList.set(0, gb);
      }
    }

    positionX = gb.xPosition;
    positionY = gb.yPosition;
  }
 private void markButtons(boolean on) {
   this.initGui();
   for (int i = 0; i < buttonList.size(); i++) {
     GuiButton b2 = (GuiButton) buttonList.get(i);
     b2.visible = on;
   }
 }
Example #3
0
  public final void onMouseClick(int mouseX, int mouseY, int btn) {
    if (btn == 0 && needsScrollbar()) {
      if (Guis.isPointInRegion(
          x + (width - scrollbarWidth),
          y + scrollbarY,
          scrollbarWidth,
          scrollbarHeight,
          mouseX,
          mouseY)) {
        isDragging = true;
        scrollbarClickOffset = mouseY - (y + scrollbarY);
      }
    }

    mouseX -= x;
    mouseY -= computeYTranslate();
    if (isPointInRegion(0, 0, width, height, mouseX, mouseY)) {
      for (GuiButton button : buttons) {
        if (button.mousePressed(mc, mouseX, mouseY)) {
          SCReflector.instance.actionPerformed(screen, button);
        }
      }
    }
    handleMouseClick(mouseX, mouseY, btn);
  }
  @Override
  public void initGui() {
    if (TabMap != null) {
      this.buttonList.removeAll(TabMap.keySet());
      TabMap.clear();
    } else {
      TabMap = new HashMap<GuiButton, GuiConfigTabEntry>();
    }

    int x = 8;
    int y = 27;
    int height = 16;

    for (GuiConfigTabEntry tab : Provider.getTabs()) {
      String text = tab.Title;
      int width = this.fontRendererObj.getStringWidth(text) + 16;

      GuiButton button = new GuiButton(getUniqueButtonId(), x, y, width, height, text);
      if (tab.Category.equals(this.Category)) {
        button.packedFGColour = 255 << 8;
      }

      this.TabMap.put(button, tab);
      this.buttonList.add(button);

      x += (width + 8);
    }

    super.initGui();
    this.entryList.top = y + height;
  }
Example #5
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;
  }
Example #6
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"));
  }
Example #7
0
  @Override
  public void initGui() {
    if (rankList == null) {
      rankList = new RankList();
    }

    rankList.func_148122_a(width, height, 32, height - 28);

    if (doneButton == null) {
      doneButton = new GuiButtonExt(0, 0, 0, 145, 20, I18n.format("gui.done"));
    }

    doneButton.xPosition = width / 2 + 10;
    doneButton.yPosition = height - doneButton.height - 4;

    if (detailInfo == null) {
      detailInfo = new GuiCheckBox(1, 0, 5, I18n.format(Caveworld.CONFIG_LANG + "detail"), true);
    }

    detailInfo.setIsChecked(CaveConfigGui.detailInfo);
    detailInfo.xPosition = width / 2 + 95;

    if (instantFilter == null) {
      instantFilter =
          new GuiCheckBox(
              2,
              0,
              detailInfo.yPosition + detailInfo.height + 2,
              I18n.format(Caveworld.CONFIG_LANG + "instant"),
              true);
    }

    instantFilter.setIsChecked(CaveConfigGui.instantFilter);
    instantFilter.xPosition = detailInfo.xPosition;

    buttonList.clear();
    buttonList.add(doneButton);
    buttonList.add(detailInfo);
    buttonList.add(instantFilter);

    if (filterTextField == null) {
      filterTextField = new GuiTextField(fontRendererObj, 0, 0, 150, 16);
      filterTextField.setMaxStringLength(100);
    }

    filterTextField.xPosition = width / 2 - filterTextField.width - 5;
    filterTextField.yPosition = height - filterTextField.height - 6;

    detailHoverChecker = new HoverChecker(detailInfo, 800);
    instantHoverChecker = new HoverChecker(instantFilter, 800);
  }
Example #8
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;
       }
     }
   }
 }
Example #9
0
  @Override
  protected void keyTyped(char c, int code) throws IOException {
    super.keyTyped(c, code);

    switch (code) {
      case Keyboard.KEY_RIGHT:
        nextButton.playPressSound(mc.getSoundHandler());
        actionPerformed(nextButton);
        break;
      case Keyboard.KEY_LEFT:
        prevButton.playPressSound(mc.getSoundHandler());
        actionPerformed(prevButton);
        break;
    }
  }
 @Override
 protected void actionPerformed(GuiButton guibutton) {
   if (guibutton.equals(btnOk)) {
     retrying = true;
   }
   super.actionPerformed(guibutton);
 }
  protected void actionPerformed(GuiButton par1GuiButton) throws IOException {
    if (par1GuiButton.enabled) {
      int var2 = this.guiGameSettings.guiScale;

      if (par1GuiButton.id < 200 && par1GuiButton instanceof GuiOptionButton) {
        this.guiGameSettings.setOptionValue(
            ((GuiOptionButton) par1GuiButton).returnEnumOptions(), 1);
        par1GuiButton.displayString =
            this.guiGameSettings.getKeyBinding(
                GameSettings.Options.getEnumOptions(par1GuiButton.id));
      }

      if (par1GuiButton.id == 200) {
        this.mc.gameSettings.saveOptions();
        this.mc.displayGuiScreen(this.parentGuiScreen);
      }

      if (this.guiGameSettings.guiScale != var2) {
        ScaledResolution scr =
            new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
        int var4 = scr.getScaledWidth();
        int var5 = scr.getScaledHeight();
        this.setWorldAndResolution(this.mc, var4, var5);
      }

      if (par1GuiButton.id == 201) {
        this.mc.gameSettings.saveOptions();
        GuiDetailSettingsOF scr1 = new GuiDetailSettingsOF(this, this.guiGameSettings);
        this.mc.displayGuiScreen(scr1);
      }

      if (par1GuiButton.id == 202) {
        this.mc.gameSettings.saveOptions();
        GuiQualitySettingsOF scr2 = new GuiQualitySettingsOF(this, this.guiGameSettings);
        this.mc.displayGuiScreen(scr2);
      }

      if (par1GuiButton.id == 211) {
        this.mc.gameSettings.saveOptions();
        GuiAnimationSettingsOF scr3 = new GuiAnimationSettingsOF(this, this.guiGameSettings);
        this.mc.displayGuiScreen(scr3);
      }

      if (par1GuiButton.id == 212) {
        this.mc.gameSettings.saveOptions();
        GuiPerformanceSettingsOF scr4 = new GuiPerformanceSettingsOF(this, this.guiGameSettings);
        this.mc.displayGuiScreen(scr4);
      }

      if (par1GuiButton.id == 222) {
        this.mc.gameSettings.saveOptions();
        GuiOtherSettingsOF scr5 = new GuiOtherSettingsOF(this, this.guiGameSettings);
        this.mc.displayGuiScreen(scr5);
      }

      if (par1GuiButton.id == GameSettings.Options.AO_LEVEL.ordinal()) {
        return;
      }
    }
  }
  protected void actionPerformed(GuiButton p_146284_1_) {
    if (p_146284_1_.enabled) {
      switch (p_146284_1_.id) {
        case 5:
          break;

        case 6:
          this.mc.displayGuiScreen(this.field_146453_a);
          break;

        case 100:
          if (p_146284_1_ instanceof GuiOptionButton) {
            this.field_146451_g.setOptionValue(((GuiOptionButton) p_146284_1_).func_146136_c(), 1);
            p_146284_1_.displayString =
                this.field_146451_g.getKeyBinding(GameSettings.Options.FORCE_UNICODE_FONT);
            ScaledResolution var2 =
                new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
            int var3 = var2.getScaledWidth();
            int var4 = var2.getScaledHeight();
            this.setWorldAndResolution(this.mc, var3, var4);
          }

          break;

        default:
          this.field_146450_f.func_148147_a(p_146284_1_);
      }
    }
  }
Example #13
0
 public void click(int mx, int my) {
   if (newLine.inBounds(mx, my) && value.isFocused()) {
     value.writeText("\n");
     checkValidInput();
   } else if (section.inBounds(mx, my) && value.isFocused()) {
     value.writeText("" + NBTStringHelper.SECTION_SIGN);
     checkValidInput();
   } else {
     key.mouseClicked(mx, my, 0);
     value.mouseClicked(mx, my, 0);
     if (save.mousePressed(mc, mx, my)) saveAndQuit();
     if (cancel.mousePressed(mc, mx, my)) parent.closeWindow();
     section.setEnabled(value.isFocused());
     newLine.setEnabled(value.isFocused());
   }
 }
Example #14
0
  /** Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */
  protected void actionPerformed(GuiButton button) throws IOException {
    if (button.enabled) {
      if (button.id < 100 && button instanceof GuiOptionButton) {
        GameSettings.Options gamesettings$options = ((GuiOptionButton) button).returnEnumOptions();
        this.field_152318_h.setOptionValue(gamesettings$options, 1);
        button.displayString =
            this.field_152318_h.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));

        if (this.mc.getTwitchStream().isBroadcasting()
            && gamesettings$options != GameSettings.Options.STREAM_CHAT_ENABLED
            && gamesettings$options != GameSettings.Options.STREAM_CHAT_USER_FILTER) {
          this.field_152315_t = true;
        }
      } else if (button instanceof GuiOptionSlider) {
        if (button.id == GameSettings.Options.STREAM_VOLUME_MIC.returnEnumOrdinal()) {
          this.mc.getTwitchStream().updateStreamVolume();
        } else if (button.id == GameSettings.Options.STREAM_VOLUME_SYSTEM.returnEnumOrdinal()) {
          this.mc.getTwitchStream().updateStreamVolume();
        } else if (this.mc.getTwitchStream().isBroadcasting()) {
          this.field_152315_t = true;
        }
      }

      if (button.id == 200) {
        this.mc.gameSettings.saveOptions();
        this.mc.displayGuiScreen(this.parentScreen);
      } else if (button.id == 201) {
        this.mc.gameSettings.saveOptions();
        this.mc.displayGuiScreen(new GuiIngestServers(this));
      }
    }
  }
  @Override
  protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
    this.drag_click.clear();

    if (btn == 1) {
      for (final Object o : this.buttonList) {
        final GuiButton guibutton = (GuiButton) o;
        if (guibutton.mousePressed(this.mc, xCoord, yCoord)) {
          super.mouseClicked(xCoord, yCoord, 0);
          return;
        }
      }
    }

    super.mouseClicked(xCoord, yCoord, btn);
  }
Example #16
0
  @Override
  protected void mouseClicked(int mouseX, int mouseY, int code) throws IOException {
    super.mouseClicked(mouseX, mouseY, code);

    if (code == 0
        && mouseX >= guiLeft
        && mouseX <= guiLeft + 20
        && mouseY >= guiTop
        && mouseY <= guiTop + 20) {
      nextButton.playPressSound(mc.getSoundHandler());

      ItemStack[] items = new ItemStack[container.craftMatrix.getSizeInventory()];

      for (int i = 0; i < items.length; ++i) {
        items[i] = container.craftMatrix.removeStackFromSlot(i);
      }

      CraftingEX.NETWORK.sendToServer(new OpenCraftingMessage(pos, items));
    } else if (code == 0
        && mouseX <= guiLeft + xSize
        && mouseX >= guiLeft + xSize - 50
        && mouseY >= guiTop
        && mouseY <= guiTop + 20
        && container.isRecipes()) {
      mc.displayGuiScreen(new GuiCraftingResult(this, container.getRecipes()));
    }
  }
  protected void actionPerformed(GuiButton p_146284_1_) {
    if (p_146284_1_.enabled) {
      if (p_146284_1_.id < 100 && p_146284_1_ instanceof GuiOptionButton) {
        GameSettings.Options options = ((GuiOptionButton) p_146284_1_).returnEnumOptions();
        this.field_152318_h.setOptionValue(options, 1);
        p_146284_1_.displayString =
            this.field_152318_h.getKeyBinding(GameSettings.Options.getEnumOptions(p_146284_1_.id));

        if (this.mc.func_152346_Z().func_152934_n()
            && options != GameSettings.Options.STREAM_CHAT_ENABLED
            && options != GameSettings.Options.STREAM_CHAT_USER_FILTER) {
          this.field_152315_t = true;
        }
      } else if (p_146284_1_ instanceof GuiOptionSlider) {
        if (p_146284_1_.id == GameSettings.Options.STREAM_VOLUME_MIC.returnEnumOrdinal()) {
          this.mc.func_152346_Z().func_152915_s();
        } else if (p_146284_1_.id
            == GameSettings.Options.STREAM_VOLUME_SYSTEM.returnEnumOrdinal()) {
          this.mc.func_152346_Z().func_152915_s();
        } else if (this.mc.func_152346_Z().func_152934_n()) {
          this.field_152315_t = true;
        }
      }

      if (p_146284_1_.id == 200) {
        this.mc.gameSettings.saveOptions();
        this.mc.displayGuiScreen(this.field_152317_g);
      } else if (p_146284_1_.id == 201) {
        this.mc.gameSettings.saveOptions();
        this.mc.displayGuiScreen(new GuiIngestServers(this));
      }
    }
  }
  @Override
  public void drawScreen(int x, int y, float par3) {
    if (!isActive) {
      super.drawScreen(x, y, par3);

      if (isPointInRegion(7, 46, 162, 18, x, y)) {
        List<String> str = new ArrayList<String>();
        str.add(
            portalModifier.upgradeHandler.hasUpgrade(new UpgradeDialDevice())
                ? Strings.UniqueIdentifier.toString()
                : Strings.Network.toString());
        str.add(
            EnumChatFormatting.GRAY
                + (portalModifier.upgradeHandler.hasUpgrade(new UpgradeDialDevice())
                    ? Strings.ClickToSetIdentifier.toString()
                    : Strings.ClickToSetNetwork.toString()));
        drawText(str, x, y);
      }
    } else {
      drawDefaultBackground();
      fontRenderer.drawString(
          Strings.ModifierActive.toString(),
          width / 2 - fontRenderer.getStringWidth(Strings.ModifierActive.toString()) / 2,
          guiTop,
          0xFFFFFF);
      okayButton.drawButton(mc, 0, 0);
    }
  }
Example #19
0
 public void drawForeground(int par1, int par2, float par3) {
   for (int k1 = 0; k1 < this.buttonList.size(); ++k1) {
     GuiButton btn = (GuiButton) this.buttonList.get(k1);
     if (btn.isMouseOver()) {
       if (btn.id >= ID_HAT_START_ID && btn.displayString.length() > 16) {
         drawTooltip(Arrays.asList(new String[] {"\u00a77" + btn.displayString}), par1, par2);
       } else if (btn.id == ID_CLOSE) {
         drawTooltip(
             Arrays.asList(
                 new String[] {StatCollector.translateToLocal("hats.gui.discardChanges")}),
             par1,
             par2);
       } else if (btn.id == ID_NONE) {
         drawTooltip(
             Arrays.asList(
                 new String[] {StatCollector.translateToLocal("hats.gui.removeHat") + " (N)"}),
             par1,
             par2);
       } else if (btn.id == ID_HAT_COLOUR_SWAP) {
         drawTooltip(
             Arrays.asList(
                 new String[] {
                   (view == VIEW_HATS
                           ? StatCollector.translateToLocal("hats.gui.personalize")
                           : StatCollector.translateToLocal("hats.gui.hatsList"))
                       + " (H)"
                 }),
             par1,
             par2);
       } else if (btn.id == ID_RANDOM) {
         drawTooltip(
             Arrays.asList(
                 new String[] {
                   (view == VIEW_HATS
                           ? StatCollector.translateToLocal("hats.gui.randomHat")
                           : isShiftKeyDown()
                               ? StatCollector.translateToLocal("hats.gui.resetColor")
                               : StatCollector.translateToLocal("hats.gui.randomColor"))
                       + " (R)"
                 }),
             par1,
             par2);
       }
     }
   }
 }
  @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) {

    }
  }
  public void func_74143_g() {
    StringTranslate var1 = StringTranslate.func_74808_a();
    this.field_73887_h.add(
        new GuiButton(
            0,
            this.field_73880_f / 2 + 4,
            this.field_73881_g - 28,
            150,
            20,
            var1.func_74805_b("gui.done")));
    this.field_73887_h.add(
        new GuiButton(
            1,
            this.field_73880_f / 2 - 154,
            this.field_73881_g - 52,
            100,
            20,
            var1.func_74805_b("stat.generalButton")));
    GuiButton var2;
    this.field_73887_h.add(
        var2 =
            new GuiButton(
                2,
                this.field_73880_f / 2 - 46,
                this.field_73881_g - 52,
                100,
                20,
                var1.func_74805_b("stat.blocksButton")));
    GuiButton var3;
    this.field_73887_h.add(
        var3 =
            new GuiButton(
                3,
                this.field_73880_f / 2 + 62,
                this.field_73881_g - 52,
                100,
                20,
                var1.func_74805_b("stat.itemsButton")));
    if (this.field_74155_n.func_77217_a() == 0) {
      var2.field_73742_g = false;
    }

    if (this.field_74157_m.func_77217_a() == 0) {
      var3.field_73742_g = false;
    }
  }
Example #22
0
  public void initGui() {
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(1, 0, 0, this.getDrawCoordsString()));
    this.buttonList.add(new GuiButton(2, 0, 0, this.getCircularModeString()));
    this.buttonList.add(new GuiButton(5, 0, 0, this.getTrailString()));
    this.buttonList.add(new GuiButton(3, 0, 0, this.getTextureSizeString()));
    this.buttonList.add(new GuiButton(4, 0, 0, this.getTextureScalingString()));
    this.buttonList.add(new GuiButton(0, 0, 0, "Done"));

    int y = Math.max(60, this.height / 4);
    int x = this.width / 2 - 100;
    for (Object o : this.buttonList) {
      GuiButton button = (GuiButton) o;
      button.xPosition = x;
      button.yPosition = y;
      y += 25;
    }
  }
 /** Draws the screen and all the components in it. */
 @Override
 public void drawScreen(int par1, int par2, float par3) {
   drawDefaultBackground();
   drawCenteredString(fontRendererObj, "Wurst Options", width / 2, 40, 0xffffff);
   drawCenteredString(
       fontRendererObj, "Settings", width / 2 - 104, height / 4 + 24 - 28, 0xcccccc);
   drawCenteredString(fontRendererObj, "Managers", width / 2, height / 4 + 24 - 28, 0xcccccc);
   drawCenteredString(fontRendererObj, "Online", width / 2 + 104, height / 4 + 24 - 28, 0xcccccc);
   super.drawScreen(par1, par2, par3);
   for (int i = 0; i < buttonList.size(); i++) {
     GuiButton button = (GuiButton) buttonList.get(i);
     if (button.isMouseOver() && !toolTips[button.id].isEmpty()) {
       ArrayList toolTip = Lists.newArrayList(toolTips[button.id].split("\n"));
       drawHoveringText(toolTip, par1, par2);
       break;
     }
   }
 }
Example #24
0
  @Override
  protected void mouseClicked(int x, int y, int i) {
    super.mouseClicked(x, y, i);

    gb.displayString = (x + "/" + y + "/" + i);
    lastClickX = x;
    lastClickY = y;
    lastButtonX = gb.xPosition;
    lastButtonY = gb.yPosition;
    lastClick = i;
  }
Example #25
0
 protected void actionPerformed(GuiButton button) {
   switch (button.id) {
     case 0:
       // done
       // reconfigure texture size
       this.mw.setTextureSize();
       this.mc.displayGuiScreen(this.parentScreen);
       break;
     case 1:
       // toggle coords
       this.mw.toggleCoords();
       button.displayString = this.getDrawCoordsString();
       break;
     case 2:
       // toggle circular
       this.mw.overlayManager.toggleRotating();
       button.displayString = this.getCircularModeString();
       break;
     case 3:
       // toggle texture size
       this.mw.configTextureSize *= 2;
       if (this.mw.configTextureSize > 4096) {
         this.mw.configTextureSize = 1024;
       }
       button.displayString = this.getTextureSizeString();
       break;
     case 4:
       // linear scaling
       this.mw.linearTextureScalingEnabled = !this.mw.linearTextureScalingEnabled;
       this.mw.mapTexture.setLinearScaling(this.mw.linearTextureScalingEnabled);
       button.displayString = this.getTextureScalingString();
       break;
     case 5:
       // player trail
       this.mw.playerTrail.enabled = !this.mw.playerTrail.enabled;
       button.displayString = this.getTrailString();
       break;
     default:
       break;
   }
 }
 @Override
 public void playPressSound(SoundHandler soundHandlerIn) {
   if (soundSelect != null && !selected) {
     SoundsExtraBitManipulation.playSound(soundSelect);
     return;
   }
   if (soundDeselect != null && selected) {
     SoundsExtraBitManipulation.playSound(soundDeselect);
     return;
   }
   super.playPressSound(soundHandlerIn);
 }
  /**
   * Opens a chapter in the booklet. Can only be done when the chapter is not null and an index
   * entry is opened in the booklet
   */
  public static void openChapter(GuiBooklet booklet, BookletChapter chapter, BookletPage page) {
    if (chapter == null || booklet.currentIndexEntry == null) {
      return;
    }

    booklet.searchField.setVisible(false);
    booklet.searchField.setFocused(false);
    booklet.searchField.setText("");

    booklet.currentChapter = chapter;
    booklet.currentPage =
        page != null && doesChapterHavePage(chapter, page) ? page : chapter.pages[0];

    booklet.buttonForward.visible = getNextPage(chapter, booklet.currentPage) != null;
    booklet.buttonBackward.visible = getPrevPage(chapter, booklet.currentPage) != null;
    booklet.buttonPreviousScreen.visible = true;

    for (GuiButton chapterButton : booklet.chapterButtons) {
      chapterButton.visible = false;
    }
  }
Example #28
0
  @Override
  public void initGui() {
    Keyboard.enableRepeatEvents(true);

    super.initGui();

    if (prevButton == null) {
      prevButton = new GuiButton(0, 0, 0, 20, 20, "<");
      prevButton.visible = false;
    }

    prevButton.xPosition = guiLeft + 107;
    prevButton.yPosition = guiTop + 60;

    if (nextButton == null) {
      nextButton = new GuiButton(1, 0, 0, prevButton.width, prevButton.height, ">");
      nextButton.visible = false;
    }

    nextButton.xPosition = prevButton.xPosition + prevButton.width + 10;
    nextButton.yPosition = prevButton.yPosition;

    buttonList.add(prevButton);
    buttonList.add(nextButton);

    if (prevHover == null) {
      prevHover = new HoverChecker(prevButton, 0);
    }

    if (nextHover == null) {
      nextHover = new HoverChecker(nextButton, 0);
    }
  }
Example #29
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;
    }
  }
 @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);
 }