Exemplo n.º 1
0
  @Override
  protected void keyTyped(char c, int i) {
    searchBar.textboxKeyTyped(c, i);
    if (searchBar.isFocused()) {
      onSearch();
    }
    if (i == 1) {
      if (searchBar.isFocused()) {
        searchBar.setText("");
        searchBar.setFocused(false);
        onSearchBarInteract();
      } else {
        exitWithoutUpdate();

        this.mc.setIngameFocus();
      }
    }
    if (!searchBar.isFocused()) {
      GameSettings gameSettings = Minecraft.getMinecraft().gameSettings;
      if (i == Keyboard.KEY_R) {
        mc.getSoundHandler()
            .playSound(
                PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
        randomize();
      } else if (i == Keyboard.KEY_TAB || i == gameSettings.keyBindChat.getKeyCode()) {
        searchBar.setFocused(true);
        onSearchBarInteract();
      } else if (i == Keyboard.KEY_H
          && !(stand.hatName.equalsIgnoreCase("") && view == VIEW_HATS)) {
        mc.getSoundHandler()
            .playSound(
                PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
        toggleHatsColourizer();
      } else if (i == Keyboard.KEY_N && !stand.hatName.equalsIgnoreCase("")) {
        mc.getSoundHandler()
            .playSound(
                PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
        removeHat();
      }
      if (view == VIEW_HATS) {
        if ((i == gameSettings.keyBindLeft.getKeyCode() || i == Keyboard.KEY_LEFT)
            && pageNumber > 0) {
          mc.getSoundHandler()
              .playSound(
                  PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
          switchPage(true);
        } else if ((i == gameSettings.keyBindRight.getKeyCode() || i == Keyboard.KEY_RIGHT)
            && !((pageNumber + 1) * 6 >= hatsToShow.size())) {
          mc.getSoundHandler()
              .playSound(
                  PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
          switchPage(false);
        }
      }
    }
  }
Exemplo n.º 2
0
 /**
  * Prepare a text field for entry.
  *
  * @param field the field
  * @param length the maximum length of the string
  * @param text the initial text
  */
 private void initTextField(GuiTextField field, int length, String text) {
   field.setVisible(true);
   field.setMaxStringLength(length);
   field.setEnableBackgroundDrawing(true);
   field.setCanLoseFocus(true);
   field.setFocused(false);
   field.setText(text);
 }
Exemplo n.º 3
0
 @Override
 public void initGui() {
   super.initGui();
   int j = (width - xSize) / 2 + 8;
   int k = (height - ySize) / 2 - 12;
   input = new GuiTextField(fontRendererObj, j + xSize / 2 - 6, k + 33, 26, 16);
   input.setFocused(false);
   input.setMaxStringLength(3);
 }
Exemplo n.º 4
0
  @Override
  protected void keyTyped(char c, int code) {
    if (filterTextField.isFocused()) {
      if (code == Keyboard.KEY_ESCAPE) {
        filterTextField.setFocused(false);
      }

      String prev = filterTextField.getText();

      filterTextField.textboxKeyTyped(c, code);

      String text = filterTextField.getText();
      boolean changed = text != prev;

      if (Strings.isNullOrEmpty(text) && changed) {
        rankList.setFilter(null);
      } else if (instantFilter.isChecked() && changed || code == Keyboard.KEY_RETURN) {
        rankList.setFilter(text);
      }
    } else {
      if (code == Keyboard.KEY_ESCAPE) {
        mc.displayGuiScreen(parent);
      } else if (code == Keyboard.KEY_BACK) {
        rankList.selected = null;
      } else if (code == Keyboard.KEY_UP) {
        rankList.scrollUp();
      } else if (code == Keyboard.KEY_DOWN) {
        rankList.scrollDown();
      } else if (code == Keyboard.KEY_HOME) {
        rankList.scrollToTop();
      } else if (code == Keyboard.KEY_END) {
        rankList.scrollToEnd();
      } else if (code == Keyboard.KEY_SPACE) {
        rankList.scrollToSelected();
      } else if (code == Keyboard.KEY_PRIOR) {
        rankList.scrollToPrev();
      } else if (code == Keyboard.KEY_NEXT) {
        rankList.scrollToNext();
      } else if (code == Keyboard.KEY_F || code == mc.gameSettings.keyBindChat.getKeyCode()) {
        filterTextField.setFocused(true);
      }
    }
  }
Exemplo n.º 5
0
  @Override
  public void actionPerformed(GuiButton button) {
    if (button.id == applyButton.id) {
      tile.getOptions().sendUpdate(uri, projectorWidth, projectorHeight, triggerRange, fadeRange);

      this.mc.displayGuiScreen((GuiScreen) null);
      this.mc.setIngameFocus();
    } else if (button.id == clearUriButton.id) {
      uriField.setText("");
      uriField.setFocused(true);
      uri = uriField.getText();
    }
  }
Exemplo n.º 6
0
 @Override // Opened and resized
 public void initGui() {
   super.initGui(); // I see this done a ton and I don't understand why
   // buttonNext = new GuiButton(1,);
   buttons.add(new GuiButton(0, 172, 410, 124, 20, "Previous"));
   buttons.add(new GuiButton(1, 296, 410, 124, 20, "Next"));
   buttons.add(new GuiButton(2, 504, 410, 248, 20, "Go"));
   int x = 3;
   for (int i = 98; i < 393; i += 20) {
     buttons.add(new GuiButton(x, 172, i, 248, 20, "Stuff " + x));
     x++;
   }
   x = 0;
   status.setCanLoseFocus(true);
   status.setText("Status Message");
   status.setFocused(false);
 }
Exemplo n.º 7
0
  @SuppressWarnings("unchecked")
  @Override
  public void initGui() {
    super.initGui();
    buttonList.clear();
    buttonList.add(new CompactButton(0, guiLeft + 47, guiTop + 20, 22, 12, "-1"));
    buttonList.add(new CompactButton(1, guiLeft + 47, guiTop + 31, 22, 12, "-10"));
    buttonList.add(new CompactButton(2, guiLeft + 12, guiTop + 20, 36, 12, "-100"));
    buttonList.add(new CompactButton(3, guiLeft + 12, guiTop + 31, 36, 12, "-1000"));
    buttonList.add(new CompactButton(4, guiLeft + 12, guiTop + 42, 57, 12, "-10000"));

    buttonList.add(new CompactButton(5, guiLeft + 122, guiTop + 20, 22, 12, "+1"));
    buttonList.add(new CompactButton(6, guiLeft + 122, guiTop + 31, 22, 12, "+10"));
    buttonList.add(new CompactButton(7, guiLeft + 143, guiTop + 20, 36, 12, "+100"));
    buttonList.add(new CompactButton(8, guiLeft + 143, guiTop + 31, 36, 12, "+1000"));
    buttonList.add(new CompactButton(9, guiLeft + 122, guiTop + 42, 57, 12, "+10000"));

    buttonList.add(new GuiThermoInvertRedstone(10, guiLeft + 70, guiTop + 38, thermo));

    textboxHeat = new GuiTextField(fontRendererObj, 70, 21, 51, 12);
    textboxHeat.setFocused(true);
    textboxHeat.setText(thermo.getHeatLevel().toString());
  }
  @SuppressWarnings("unchecked")
  @Override
  public void initGui() {
    super.initGui();
    this.buttonList.clear();

    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;

    String mobsButton = "Attack Mobs: " + (base.isAttacksMobs() ? "\u00A72Yes" : "\u00A7cNo");
    String neutralsButton =
        "Attack Neutrals: " + (base.isAttacksNeutrals() ? "\u00A72Yes" : "\u00A7cNo");
    String playersButton =
        "Attack Players: " + (base.isAttacksPlayers() ? "\u00A72Yes" : "\u00A7cNo");

    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;

    textFieldAddTrustedPlayer = new GuiTextField(fontRenderer, 11, 99, 100, 18);
    textFieldAddTrustedPlayer.setMaxStringLength(50);
    textFieldAddTrustedPlayer.setFocused(true);

    this.buttonList.add(new GuiButton(1, x + 10, y + 20, 155, 20, mobsButton));
    this.buttonList.add(new GuiButton(2, x + 10, y + 40, 155, 20, neutralsButton));
    this.buttonList.add(new GuiButton(3, x + 10, y + 60, 155, 20, playersButton));
    this.buttonList.add(new GuiButton(4, x + 114, y + 98, 51, 20, "+"));
    this.buttonList.add(new GuiButton(5, x + 35, y + 135, 30, 20, "-"));
    this.buttonList.add(new GuiButton(6, x + 10, y + 135, 20, 20, "<<"));
    this.buttonList.add(new GuiButton(7, x + 145, y + 135, 20, 20, ">>"));

    if (this.base.getTrustedPlayers().size() > 0) {
      this.buttonList.add(
          new GuiButton(
              8,
              x + 70,
              y + 135,
              23,
              20,
              this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canOpenGUI
                  ? "\u00A72Y"
                  : "\u00A7cN"));
      this.buttonList.add(
          new GuiButton(
              9,
              x + 93,
              y + 135,
              23,
              20,
              this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canChangeTargeting
                  ? "\u00A72Y"
                  : "\u00A7cN"));
      this.buttonList.add(
          new GuiButton(
              10,
              x + 116,
              y + 135,
              23,
              20,
              this.base.getTrustedPlayers().get(base.trustedPlayerIndex).admin
                  ? "\u00A72Y"
                  : "\u00A7cN"));
    } else {
      this.buttonList.add(new GuiButton(999, x + 70, y + 135, 23, 20, "?"));
      this.buttonList.add(new GuiButton(999, x + 93, y + 135, 23, 20, "?"));
      this.buttonList.add(new GuiButton(999, x + 116, y + 135, 23, 20, "?"));
    }
  }