Пример #1
0
 public boolean onBlockActivated(
     World world,
     int x,
     int y,
     int z,
     EntityPlayer player,
     int side,
     float hitX,
     float hitY,
     float hitZ) {
   if (!world.isRemote) {
     DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(x, y, z));
     if (player.isSneaking()) {
       player.openGui(PECore.instance, Constants.PEDESTAL_GUI, world, x, y, z);
     } else {
       if (tile.getItemStack() != null && tile.getItemStack().getItem() instanceof IPedestalItem) {
         tile.setActive(!tile.getActive());
       }
       PELogger.logDebug("Pedestal: " + (tile.getActive() ? "ON" : "OFF"));
     }
     PacketHandler.sendToAllAround(
         new ClientSyncPedestalPKT(tile),
         new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32));
   }
   return true;
 }
Пример #2
0
 @SubscribeEvent
 public static void keyPress(KeyInputEvent event) {
   for (KeyBinding k : ClientKeyHelper.mcToPe.keySet()) {
     if (k.isPressed()) {
       PacketHandler.sendToServer(new KeyPressPKT(ClientKeyHelper.mcToPe.get(k)));
     }
   }
 }
Пример #3
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();
  }
Пример #4
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);
  }
Пример #5
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();
    }
  }