예제 #1
0
  @Override
  public void putStack(ItemStack stack) {
    if (stack == null) {
      return;
    }

    super.putStack(stack);

    if (stack.getItem() == ObjHandler.kleinStars) {
      int remainingEmc =
          EMCHelper.getKleinStarMaxEmc(stack) - (int) Math.ceil(ItemPE.getEmc(stack));

      if (inv.emc >= remainingEmc) {
        ItemPE.addEmc(stack, remainingEmc);
        inv.removeEmc(remainingEmc);
      } else {
        ItemPE.addEmc(stack, inv.emc);
        inv.emc = 0;
      }
    }

    if (stack.getItem() != ObjHandler.tome) {
      inv.handleKnowledge(stack.copy());
    } else {
      inv.updateOutputs();
    }
  }
예제 #2
0
  @Override
  protected void actionPerformed(GuiButton button) {
    String srch = this.textBoxFilter.getText().toLowerCase();

    if (button.id == 1) {
      if (inv.searchpage != 0) {
        inv.searchpage--;
      }
    } else if (button.id == 2) {
      if (!(inv.knowledge.size() <= 12)) {
        inv.searchpage++;
      }
    }
    PacketHandler.sendToServer(new SearchUpdatePKT(srch, inv.searchpage));
    inv.filter = srch;
    inv.updateOutputs();
  }
예제 #3
0
  @Override
  protected void mouseClicked(int x, int y, int mouseButton) {
    super.mouseClicked(x, y, mouseButton);

    int minX = textBoxFilter.xPosition;
    int minY = textBoxFilter.yPosition;
    int maxX = minX + textBoxFilter.width;
    int maxY = minY + textBoxFilter.height;

    if (mouseButton == 1 && x >= minX && x <= maxX && y <= maxY) {
      PacketHandler.sendToServer(new SearchUpdatePKT("", 0));
      inv.filter = "";
      inv.searchpage = 0;
      inv.updateOutputs();
      this.textBoxFilter.setText("");
    }

    this.textBoxFilter.mouseClicked(x, y, mouseButton);
  }
예제 #4
0
  @Override
  protected void keyTyped(char par1, int par2) {
    if (this.textBoxFilter.isFocused()) {
      this.textBoxFilter.textboxKeyTyped(par1, par2);

      String srch = this.textBoxFilter.getText().toLowerCase();

      if (!inv.filter.equals(srch)) {
        PacketHandler.sendToServer(new SearchUpdatePKT(srch, 0));
        inv.filter = srch;
        inv.searchpage = 0;
        inv.updateOutputs();
      }
    }

    if (par2 == 1
        || par2 == this.mc.gameSettings.keyBindInventory.getKeyCode()
            && !this.textBoxFilter.isFocused()) {
      this.mc.thePlayer.closeScreen();
    }
  }