/** Draws the screen and all the components in it. */
  @Override
  public void drawScreen(int mouseX, int mouseY, float par3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(new ResourceLocation("playblock:textures/gui/projector_bg.png"));
    int left = (width - xSize) / 2;
    int top = (height - ySize) / 2;
    drawTexturedModalRect(left, top, 0, 0, xSize, ySize);
    uriField.drawTextBox();
    heightField.drawTextBox();
    widthField.drawTextBox();
    triggerRangeField.drawTextBox();
    fadeRangeField.drawTextBox();

    fontRendererObj.drawString(
        StringUtils.translate("options.url"), left + 10, top + 20, 0xff999999);
    fontRendererObj.drawString(
        StringUtils.translate("options.screenSize"), left + 10, top + 40, 0xff999999);
    fontRendererObj.drawString("x", left + 117, top + 40, 0xff999999);
    fontRendererObj.drawString(
        StringUtils.translate("options.turnOn"), left + 10, top + 60, 0xff999999);
    fontRendererObj.drawString(
        StringUtils.translate("options.blocksAway"), left + 117, top + 60, 0xff999999);
    fontRendererObj.drawString(
        StringUtils.translate("options.turnOff"), left + 10, top + 80, 0xff999999);
    fontRendererObj.drawString(
        StringUtils.translate("options.blocksAway"), left + 117, top + 80, 0xff999999);
    fontRendererObj.drawString("TEST VERSION - skcraft.com", left + 10, top + 132, 0xffffffff);

    super.drawScreen(mouseX, mouseY, par3);
  }
 @Override
 public void updateScreen() {
   super.updateScreen();
   if (input.getText().isEmpty()) {
     return;
   }
   if (!(input.getText().matches("^[0-9 ]+$"))) {
     range = 0;
     input.deleteFromCursor(-1);
     if (pwr instanceof TileEntityForceField)
       ReikaPacketHelper.sendDataPacket(
           RotaryCraft.packetChannel, PacketRegistry.FORCE.getMinValue(), pwr, range);
     else if (pwr instanceof TileEntityContainment)
       ReikaPacketHelper.sendDataPacket(
           RotaryCraft.packetChannel, PacketRegistry.CONTAINMENT.getMinValue(), pwr, range);
     return;
   }
   range = Integer.parseInt(input.getText());
   if (range >= 0) {
     if (pwr instanceof TileEntityForceField)
       ReikaPacketHelper.sendDataPacket(
           RotaryCraft.packetChannel, PacketRegistry.FORCE.getMinValue(), pwr, range);
     else if (pwr instanceof TileEntityContainment)
       ReikaPacketHelper.sendDataPacket(
           RotaryCraft.packetChannel, PacketRegistry.CONTAINMENT.getMinValue(), pwr, range);
   }
 }
Exemple #3
0
  @Override
  public void drawScreen(int par1, int par2, float par3) {

    this.drawBackground(par1);
    super.drawScreen(par1, par2, par3);

    int posX = (this.width) / 2;
    int posY = (this.height) / 2;
    try {
      fontRendererObj.drawSplitString(
          "Press Enter to confirm", posX + 1 - 75, posY - 1, 180, 0x000000);
      fontRendererObj.drawSplitString("Press Enter to confirm", posX - 75, posY, 180, 0xffffff);

      fontRendererObj.drawSplitString(
          "What Channel do you want to connect to ? : " + channelField.getText(),
          posX + 1 - 75,
          posY - 1 - 20,
          180,
          0x000000);
      fontRendererObj.drawSplitString(
          "What Channel do you want to connect to ? : " + channelField.getText(),
          posX - 75,
          posY - 20,
          180,
          0xff0000);

    } finally {
      if (channelName != null) channelField.drawTextBox();
    }
  }
 @Override
 protected void keyTyped(char par1, int par2) {
   if (!textFieldAddTrustedPlayer.isFocused()) {
     super.keyTyped(par1, par2);
   } else {
     textFieldAddTrustedPlayer.textboxKeyTyped(par1, par2);
   }
 }
 @Override
 public void mouseClicked(int mouseX, int mouseY, int button) {
   if (!visible | !enabled | haveOpenDialog()) {
     return;
   }
   textboxUsername.mouseClicked(mouseX, mouseY, button);
   textboxPassword.mouseClicked(mouseX, mouseY, button);
   super.mouseClicked(mouseX, mouseY, button);
 }
 @Override
 protected void mouseClicked(int x, int y, int buttonClicked) {
   super.mouseClicked(x, y, buttonClicked);
   uriField.mouseClicked(x, y, buttonClicked);
   heightField.mouseClicked(x, y, buttonClicked);
   widthField.mouseClicked(x, y, buttonClicked);
   triggerRangeField.mouseClicked(x, y, buttonClicked);
   fadeRangeField.mouseClicked(x, y, buttonClicked);
 }
 @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);
 }
 @Override
 public boolean keyTyped(char c, int keycode) {
   if (!visible | !enabled | haveOpenDialog()) {
     return false;
   }
   textboxUsername.textboxKeyTyped(c, keycode);
   textboxPassword.textboxKeyTyped(c, keycode);
   return super.keyTyped(c, keycode);
 }
 @Override
 public void draw(int mouseX, int mouseY, float partialTickTime) {
   if (!visible) {
     return;
   }
   drawGradientRect(this.x, this.y, this.x + this.width, this.y + height, 0xC0101010, 0xD0101010);
   super.draw(mouseX, mouseY, partialTickTime);
   fontRenderer.drawString("Username:"******"Password:", this.x + 5, this.y + 35, 0xEEEEEE);
   textboxUsername.drawTextBox();
   textboxPassword.drawTextBox();
 }
Exemple #10
0
 @Override
 public void updateScreen() {
   searchBar.updateCursorCounter();
   if (searchBar.isFocused()) {
     searchBar.setVisible(true);
   } else {
     searchBar.setVisible(enabledSearchBar);
   }
   if (favourite > 0) {
     favourite--;
   }
 }
  @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();
    }
  }
Exemple #12
0
  @Override
  public void initGui() {
    super.initGui();

    if (stand == null) {
      mc.displayGuiScreen(null);
    } else {
      Keyboard.enableRepeatEvents(true);

      buttonList.clear();

      this.guiLeft = (this.width - this.xSize) / 2;
      this.guiTop = (this.height - this.ySize) / 2;

      buttonList.add(new GuiButton(ID_PAGE_LEFT, width / 2 - 6, height / 2 + 54, 20, 20, "<"));
      buttonList.add(new GuiButton(ID_PAGE_RIGHT, width / 2 + 62, height / 2 + 54, 20, 20, ">"));
      buttonList.add(
          new GuiButton(
              ID_DONE_SELECT, width / 2 + 16, height / 2 + 54, 44, 20, I18n.format("gui.done")));

      // 4, 5, 6, 7, 8 = taken.

      addToolButton(ID_NONE, 0);
      addToolButton(ID_HAT_COLOUR_SWAP, 1);
      addToolButton(ID_RANDOM, 2);

      buttonList.add(new GuiButton(ID_CLOSE, width - 22, 2, 20, 20, "X"));

      pageNumber = 0;

      if (!stand.hatName.equalsIgnoreCase("")) {
        for (int i = 0; i < hatsToShow.size(); i++) {
          String hatName = (String) hatsToShow.get(i);
          if (hatName.equalsIgnoreCase(stand.hatName)) {
            i -= i % 6;
            pageNumber = i / 6;
            break;
          }
        }
      }

      updateButtonList();

      searchBar =
          new GuiTextField(0, this.fontRendererObj, this.width / 2 - 65, height - 24, 150, 20);
      searchBar.setMaxStringLength(255);
      searchBar.setText(StatCollector.translateToLocal("hats.gui.search"));
      searchBar.setTextColor(0xAAAAAA);
      searchBar.setVisible(enabledSearchBar);
    }
  }
  @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);
  }
Exemple #14
0
  @Override
  protected void keyTyped(char c, int i) {
    super.keyTyped(c, i);

    if (channelField != null) {
      channelField.textboxKeyTyped(c, i);
      channelName = channelField.getText();
    }

    if (i == Keyboard.KEY_ESCAPE) {
      te.resetTE();
      mc.thePlayer.closeScreen();
    }
  }
 @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);
   }
 }
  public void sendChangeToServerAddTrusted() {
    AddTrustedPlayerMessage message =
        new AddTrustedPlayerMessage(
            base.xCoord, base.yCoord, base.zCoord, textFieldAddTrustedPlayer.getText());

    ModularTurrets.networking.sendToServer(message);
  }
  @Override
  public void initGui() {
    Keyboard.enableRepeatEvents(true);

    buttonList.clear();
    buttonList.add(
        doneButton =
            new GuiButton(
                1,
                width / 2 - 40,
                height / 2 - 10,
                80,
                20,
                MCA.getInstance().getLanguageLoader().getString("gui.button.done")));
    buttonList.add(
        randomButton =
            new GuiButton(
                2,
                width / 2 + 105,
                height / 2 - 60,
                60,
                20,
                MCA.getInstance().getLanguageLoader().getString("gui.button.random")));

    babyNameTextField =
        new GuiTextField(fontRendererObj, width / 2 - 100, height / 2 - 60, 200, 20);
    babyNameTextField.setMaxStringLength(32);
  }
Exemple #18
0
  public void drawSearchBar() {
    if (searchBar.getVisible()) {
      searchBar.drawTextBox();
      GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
      GlStateManager.enableBlend();
      GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

      this.mc
          .getTextureManager()
          .bindTexture(us.ichun.mods.hats.client.gui.GuiHatSelection.texIcons);

      drawTexturedModalRect(this.width / 2 - 85, height - 22, 128, 0, 16, 16);

      GlStateManager.disableBlend();
    }
  }
  @Override
  protected void actionPerformed(GuiButton button) {
    if (button.enabled) {
      switch (button.id) {
        case 0:
          if (rankList.selected != null) {
            MinerRank rank = rankList.selected;

            if (rankField != null) {
              rankField.setText(Integer.toString(rank.getRank()));
            }
          }

          mc.displayGuiScreen(parent);

          rankList.selected = null;
          rankList.scrollToTop();
          break;
        case 1:
          CaveConfigGui.detailInfo = detailInfo.isChecked();
          break;
        case 2:
          CaveConfigGui.instantFilter = instantFilter.isChecked();
          break;
      }
    }
  }
  @Override
  public void drawScreen(int mouseX, int mouseY, float ticks) {
    rankList.drawScreen(mouseX, mouseY, ticks);

    drawCenteredString(
        fontRendererObj,
        I18n.format(Caveworld.CONFIG_LANG + "select.minerRank"),
        width / 2,
        15,
        0xFFFFFF);

    super.drawScreen(mouseX, mouseY, ticks);

    filterTextField.drawTextBox();

    if (detailHoverChecker.checkHover(mouseX, mouseY)) {
      func_146283_a(
          fontRendererObj.listFormattedStringToWidth(
              I18n.format(Caveworld.CONFIG_LANG + "detail.hover"), 300),
          mouseX,
          mouseY);
    } else if (instantHoverChecker.checkHover(mouseX, mouseY)) {
      func_146283_a(
          fontRendererObj.listFormattedStringToWidth(
              I18n.format(Caveworld.CONFIG_LANG + "instant.hover"), 300),
          mouseX,
          mouseY);
    }
  }
  @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) {

    }
  }
Exemple #22
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);
 }
 @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);
   }
 }
Exemple #24
0
  @Override
  protected void mouseClicked(int par1, int par2, int par3) throws IOException {
    super.mouseClicked(par1, par2, par3);
    boolean flag =
        par1 >= (this.width / 2 - 65)
            && par1 < (this.width / 2 - 65) + this.width
            && par2 >= (height - 24)
            && par2 < (height - 24) + this.height;
    if (enabledSearchBar) {
      searchBar.mouseClicked(par1, par2, par3);

      if (par3 == 1 && flag) {
        searchBar.setText("");
        onSearch();
      }
      onSearchBarInteract();
    }
  }
 private void updateHeat(int delta) {
   if (textboxHeat != null) {
     int heat = 0;
     try {
       String value = textboxHeat.getText();
       if (!"".equals(value)) heat = Integer.parseInt(value);
     } catch (NumberFormatException e) {
       // do nothing
     }
     heat += delta;
     if (heat < 0) heat = 0;
     if (heat >= 1000000) heat = 1000000;
     if (thermo.getHeatLevel().intValue() != heat) {
       thermo.setHeatLevel(heat);
       ((NetworkManager) IC2.network.get()).initiateClientTileEntityEvent(thermo, heat);
     }
     textboxHeat.setText(new Integer(heat).toString());
   }
 }
  @Override
  public void initGui() {
    initGuiComponents();

    nameBox =
        new GuiTextField(mc.fontRenderer, spacing, 80 + spacing, width - spacing * 2, buttonHeight);
    nameBox.setText(clone.getFullEditedName());
    lastTickName = clone.getFullEditedName();
    Keyboard.enableRepeatEvents(true);
  }
Exemple #27
0
  @Override
  public void initGui() {

    // used to offset buttons
    int offSetX = 150;
    int offSetY = 250;

    int posX = (this.width) / 2;
    int posY = (this.height) / 2;
    this.buttonList.clear();

    System.out.println("The channel for this telepad is : " + te.TELEPORTCHANNEL);

    channelField = new GuiTextField(fontRendererObj, posX - 50, posY - 130, 150, 20);

    if (channelField != null) {
      channelField.setText(channelName);
      channelField.setMaxStringLength(50);
    }

    ArrayList<int[]> allCoords =
        TelepadWorldData.get(thePlayer.worldObj).getCoordsForChannel(te.TELEPORTCHANNEL);
    int c = allCoords.size();

    if (c < 1) {
      return;
    }

    for (int i = 0; i < c; i++) {
      String name = TelepadWorldData.get(thePlayer.worldObj).getPadName(allCoords.get(i));
      this.buttonList.add(
          new GuiButton(
              i, /*x*/
              posX - 200 + (i / 10 > 0 && i % 10 >= 0 ? 120 * (i / 10) : 0), /*y*/
              posY + ((i * 25)) - (i / 10 > 0 && i % 10 >= 0 ? (250 * (i / 10)) + 100 : 100),
              /*size*/ 100,
              20, /**/
              name));
    }

    this.buttonList.add(new GuiButton(EXIT_BUTTON, posX - 200, posY - 120, 20, 20, "X"));
  }
  @Override
  protected void keyTyped(char c, int i) {
    babyNameTextField.textboxKeyTyped(c, i);
    String text = babyNameTextField.getText().trim();

    if (text.contains("/")
        || text.contains("?")
        || text.contains("<")
        || text.contains(">")
        || text.contains("\\")
        || text.contains(":")
        || text.contains("*")
        || text.contains("|")
        || text.contains("\"")) {
      containsInvalidCharacters = true;
      ((GuiButton) buttonList.get(0)).enabled = false;
    } else {
      containsInvalidCharacters = false;
    }
  }
 @Override
 protected void keyTyped(char par1, int par2) {
   if (par2 == 1) {
     mc.displayGuiScreen(parent);
     if (parent == null) {
       mc.setIngameFocus();
     }
   } else {
     nameBox.textboxKeyTyped(par1, par2);
   }
 }
Exemple #30
0
  public void toggleHatsColourizer() {
    view = view > VIEW_HATS ? VIEW_HATS : VIEW_COLOURIZER;

    hatsToShow = new ArrayList<String>(availableHats);
    Collections.sort(hatsToShow);

    searchBar.setText("");
    onSearchBarInteract();

    updateButtonList();
  }