Exemplo n.º 1
0
  @Override
  protected void keyTyped(char key, int par2) {
    super.keyTyped(key, par2);

    if (uriField.isFocused()) {
      uriField.textboxKeyTyped(key, par2);
      uri = uriField.getText();

      if (MediaResolver.canPlayUri(MediaResolver.cleanUri(uri))) {
        uriField.setTextColor(defaultTextColor);
      } else {
        uriField.setTextColor(0xffff0000);
      }
    }

    if (Character.isDigit(key)
        || par2 == 14
        || par2 == 52
        || par2 == 199
        || par2 == 203
        || par2 == 205
        || par2 == 207
        || par2 == 211) {
      if (heightField.isFocused()) {
        heightField.textboxKeyTyped(key, par2);
        if (heightField.getText().length() != 0) {
          try {
            projectorHeight = Float.parseFloat(heightField.getText());
          } catch (NumberFormatException e) {
          }
        }
      } else if (widthField.isFocused()) {
        widthField.textboxKeyTyped(key, par2);
        if (widthField.getText().length() != 0) {
          try {
            projectorWidth = Float.parseFloat(widthField.getText());
          } catch (NumberFormatException e) {
          }
        }
      } else if (triggerRangeField.isFocused()) {
        triggerRangeField.textboxKeyTyped(key, par2);
        if (triggerRangeField.getText().length() != 0) {
          try {
            triggerRange = Float.parseFloat(triggerRangeField.getText());
          } catch (NumberFormatException e) {
          }
        }
      } else if (fadeRangeField.isFocused()) {
        fadeRangeField.textboxKeyTyped(key, par2);
        if (fadeRangeField.getText().length() != 0) {
          try {
            fadeRange = Float.parseFloat(fadeRangeField.getText());
          } catch (NumberFormatException e) {
          }
        }
      }
    }
  }
Exemplo n.º 2
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);
        }
      }
    }
  }
 @Override
 protected void keyTyped(char par1, int par2) {
   if (!textFieldAddTrustedPlayer.isFocused()) {
     super.keyTyped(par1, par2);
   } else {
     textFieldAddTrustedPlayer.textboxKeyTyped(par1, par2);
   }
 }
Exemplo n.º 4
0
 @Override
 protected void drawGuiContainerForegroundLayer(int a, int b) {
   super.drawGuiContainerForegroundLayer(a, b);
   fontRendererObj.drawString("Field Radius:", xSize / 2 - 72, 25, 4210752);
   if (!input.isFocused()) {
     fontRendererObj.drawString(
         String.format("%d", ((RangedEffect) pwr).getRange()), xSize / 2 + 6, 25, 0xffffffff);
   }
 }
Exemplo n.º 5
0
 @Override
 public void updateScreen() {
   if (!lastTickName.equals(nameBox.getText())) {
     lastTickName = nameBox.getText();
     clone.setName(lastTickName);
     clone.getSyncer().sendValueToServer(Syncer.ID_NAME);
   } else if (!nameBox.isFocused() && !nameBox.getText().equals(clone.nameUnedited)) {
     nameBox.setText(clone.nameUnedited);
   }
   nameBox.updateCursorCounter();
 }
Exemplo n.º 6
0
 @Override
 public void updateScreen() {
   searchBar.updateCursorCounter();
   if (searchBar.isFocused()) {
     searchBar.setVisible(true);
   } else {
     searchBar.setVisible(enabledSearchBar);
   }
   if (favourite > 0) {
     favourite--;
   }
 }
Exemplo n.º 7
0
 @Override
 protected void keyTyped(char par1, int par2) {
   if (par2 == 1) // Esc button
   {
     mc.thePlayer.closeScreen();
   } else if (par1 == 13) // Enter
   {
     updateHeat(0);
   } else if (textboxHeat != null
       && textboxHeat.isFocused()
       && (Character.isDigit(par1) || par1 == 0 || par1 == 8)) {
     textboxHeat.textboxKeyTyped(par1, par2);
   }
 }
Exemplo n.º 8
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.º 9
0
 public void onSearchBarInteract() {
   if (searchBar.isFocused()) {
     searchBar.setTextColor(14737632);
     if (!hasClicked
         && searchBar
             .getText()
             .equalsIgnoreCase(StatCollector.translateToLocal("hats.gui.search"))) {
       hasClicked = true;
       searchBar.setText("");
       onSearch();
     }
   } else {
     searchBar.setTextColor(0xAAAAAA);
     if (searchBar.getText().equalsIgnoreCase("")) {
       hasClicked = false;
       searchBar.setText(StatCollector.translateToLocal("hats.gui.search"));
     }
   }
 }