public void update(int delta) {
    // rotate quad
    rotation += 0.15f * delta;

    if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) x -= 0.35f * delta;
    if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) x += 0.35f * delta;

    if (Keyboard.isKeyDown(Keyboard.KEY_UP)) y -= 0.35f * delta;
    if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) y += 0.35f * delta;

    while (Keyboard.next()) {
      if (Keyboard.getEventKeyState()) {
        if (Keyboard.getEventKey() == Keyboard.KEY_F) {
          setDisplayMode(800, 600, !Display.isFullscreen());
        } else if (Keyboard.getEventKey() == Keyboard.KEY_V) {
          vsync = !vsync;
          Display.setVSyncEnabled(vsync);
        }
      }
    }

    // keep quad on the screen
    if (x < 0) x = 0;
    if (x > 800) x = 800;
    if (y < 0) y = 0;
    if (y > 600) y = 600;

    updateFPS(); // update FPS Counter
  }
Exemplo n.º 2
0
 /** Run the main game loop. */
 public void run() {
   while (gameRunning) {
     // reset drawCount
     mapCount = 0;
     drawCount = 0;
     // clear screen
     gameWindow.clearScreen();
     // get delta
     timer.update();
     long delta = timer.getDelta();
     // update state
     stateManager.input(delta);
     stateManager.update(delta);
     stateManager.draw();
     // draw DebugHUD
     debugHUD.draw();
     // if escape has been pressed, stop the game
     if ((Display.isCloseRequested()
         || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))) {
       gameRunning = false;
     }
     // update window contents
     gameWindow.update();
   }
 }
Exemplo n.º 3
0
 @SideOnly(Side.CLIENT)
 @Override
 public void addInformation(
     ItemStack itemStack, EntityPlayer player, List list, boolean whatIsThis) {
   super.addInformation(itemStack, player, list, whatIsThis);
   NBTTagCompound tagCompound = itemStack.getTagCompound();
   int channel = -1;
   if (tagCompound != null) {
     channel = tagCompound.getInteger("channel");
   }
   if (channel != -1) {
     list.add(EnumChatFormatting.YELLOW + "Channel: " + channel);
   } else {
     list.add(EnumChatFormatting.YELLOW + "Channel is not set!");
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
     list.add(EnumChatFormatting.WHITE + "Sneak right-click on a space chamber controller");
     list.add(EnumChatFormatting.WHITE + "to set the channel for this card.");
     list.add(EnumChatFormatting.WHITE + "Right-click in the air to show an overview of");
     list.add(EnumChatFormatting.WHITE + "the area contents.");
     list.add(EnumChatFormatting.WHITE + "Insert it in a builder to copy/move the");
     list.add(EnumChatFormatting.WHITE + "linked area");
   } else {
     list.add(EnumChatFormatting.WHITE + RFTools.SHIFT_MESSAGE);
   }
 }
Exemplo n.º 4
0
  private void sendItemWidgetClicked(final int mouseX, final int mouseY, final int mouseButton) {
    for (int index = 0; index < this.widgetCount; ++index) {
      WidgetAEItem currentWidget = this.itemWidgets.get(index);

      if (currentWidget.isMouseOverWidget(mouseX, mouseY)) {
        IAEItemStack widgetStack = currentWidget.getItemStack();

        if (widgetStack != null) {
          if (widgetStack.getStackSize() == 0) {
            if (widgetStack.isCraftable()) {
              // new PacketChiselingTerminalServer().createRequestAutoCraft( this.player,
              // widgetStack ).sendPacketToServer();
            }
          } else {
            boolean isShiftHeld =
                Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);

            new PacketChiselingTerminalServer()
                .createRequestExtract(this.entityPlayer, widgetStack, mouseButton, isShiftHeld)
                .sendPacketToServer();
          }
        }

        return;
      }
    }
  }
 public void beginStep() {
   List<KeyboardEvent> keys = Game.getKeys();
   if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && repeatTimers[2] == 0) {
     repeatTimers[2] = 0.12f;
     yesHover = !yesHover;
     AudioPlayer.playAudio("cursor2", 1, 1);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && repeatTimers[3] == 0) {
     repeatTimers[3] = 0.12f;
     yesHover = !yesHover;
     AudioPlayer.playAudio("cursor2", 1, 1);
   }
   for (KeyboardEvent ke : keys) {
     if (ke.state) {
       if (ke.key == Keyboard.KEY_RETURN || ke.key == Keyboard.KEY_Z) {
         AudioPlayer.playAudio("select", 1, 1);
         if (yesHover) confirm();
         else cancel();
         destroy();
       }
       if (ke.key == Keyboard.KEY_X) {
         AudioPlayer.playAudio("cancel", 1, 1);
         cancel();
         destroy();
       }
     }
   }
   for (int i = 0; i < repeatTimers.length; i++) {
     if (repeatTimers[i] > 0) {
       repeatTimers[i] -= Game.getDeltaSeconds();
       if (repeatTimers[i] < 0) repeatTimers[i] = 0;
     }
   }
 }
Exemplo n.º 6
0
  private void onKeyPressed(Player player, Keyboard key, boolean pressed, char ch) {
    final PlayerKeyEvent event =
        Spout.getEventManager().callEvent(new PlayerKeyEvent(player, key, pressed, ch));
    if (event.isCancelled()) {
      return;
    }

    if (Spout.debugMode()) {
      Spout.log("Key " + key + " was " + (pressed ? "pressed" : "released"));
    }

    // SHIFT + TAB changes the focus index
    Screen in = getInputScreen();
    if (key == FOCUS_KEY && pressed) {
      if (in != null) {
        if (org.lwjgl.input.Keyboard.isKeyDown(Keyboard.KEY_LSHIFT.getId())
            || org.lwjgl.input.Keyboard.isKeyDown(Keyboard.KEY_RSHIFT.getId())) {
          in.previousFocus(FocusReason.KEYBOARD_TAB);
        } else {
          in.nextFocus(FocusReason.KEYBOARD_TAB);
        }
      }
    }

    // send event to the focused widget
    if (in != null) {
      Widget w = in.getFocusedWidget();
      if (w != null) {
        w.onKey(event);
      }
    }

    executeBindings(getKeyBindingsFor(key), player, pressed);
  }
Exemplo n.º 7
0
 @Override
 @SideOnly(Side.CLIENT)
 public void addInformation(
     ItemStack itemStack,
     EntityPlayer entityPlayer,
     List descriptionList,
     boolean noClueWhatThisEvenDoes) {
   if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
     descriptionList.add(OUtil.colorString("&&dSteve not included.&&7"));
     switch (itemStack.getItemDamage()) {
       case 0:
         descriptionList.add(OUtil.colorString("A boat made of &&esturdy planks&&7."));
         descriptionList.add("Doubt it will last long.");
         break;
       case 1:
         descriptionList.add(OUtil.colorString("A boat made of &&fIron&&7, should"));
         descriptionList.add("last a while.");
         break;
       case 2:
         descriptionList.add(OUtil.colorString("Made of purely &&6Atlantium&&7,"));
         descriptionList.add("almost indestructable.");
     }
   } else {
     descriptionList.add(OUtil.colorString("Hold &&9SHIFT &&7for more information"));
   }
 }
  /** Creates the cell tooltip. */
  @Override
  public void addInformation(
      final ItemStack essentiaCell,
      final EntityPlayer player,
      final List displayList,
      final boolean advancedItemTooltips) {
    // Get the contents of the cell
    IMEInventoryHandler<IAEFluidStack> handler =
        AEApi.instance()
            .registries()
            .cell()
            .getCellInventory(essentiaCell, null, StorageChannel.FLUIDS);

    // Ensure we have a cell inventory handler
    if (!(handler instanceof HandlerItemEssentiaCell)) {
      return;
    }

    // Cast to cell inventory handler
    HandlerItemEssentiaCell cellHandler = (HandlerItemEssentiaCell) handler;

    // Create the bytes tooltip
    String bytesTip =
        String.format(
            ThEStrings.Tooltip_CellBytes.getLocalized(),
            cellHandler.getUsedBytes(),
            cellHandler.getTotalBytes());

    // Create the types tooltip
    String typesTip =
        String.format(
            ThEStrings.Tooltip_CellTypes.getLocalized(),
            cellHandler.getUsedTypes(),
            cellHandler.getTotalTypes());

    // Add the tooltips
    displayList.add(bytesTip);
    displayList.add(typesTip);

    // Is the cell pre-formated?
    if (cellHandler.isPartitioned()) {
      displayList.add(GuiText.Partitioned.getLocal());
    }

    // Does the cell have anything stored?
    if (cellHandler.getUsedTypes() > 0) {
      // Is shift being held?
      if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
        // Add information about the essentia types in the cell
        this.addContentsToCellDescription(cellHandler, displayList, player);
      } else {
        // Let the user know they can hold shift
        displayList.add(
            EnumChatFormatting.WHITE.toString()
                + EnumChatFormatting.ITALIC.toString()
                + ThEStrings.Tooltip_ItemStackDetails.getLocalized());
      }
    }
  }
Exemplo n.º 9
0
 public void handleInput() {
   if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
     System.out.println("PAUSE");
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
     Display.destroy();
   }
 }
Exemplo n.º 10
0
 private void input() {
   if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
     bat.setDY(-.2);
   } else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
     bat.setDY(.2);
   } else {
     bat.setDY(0);
   }
 }
Exemplo n.º 11
0
  public static void loop() {

    while (CSGame.state == States.ThreeDeeTest) {
      // Clear the screen of its filthy contents
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

      // Push the screen inwards at the amount of speed
      glTranslatef(0, 0, speed);

      // Begin drawing points
      glBegin(GL_POINTS);
      // Iterate of every point

      for (Point p : points) {
        // Draw the point at its coordinates
        glColor3f(0.0f, 1f, 0f);
        glVertex3f(p.x, p.y, p.z);
      }
      // Stop drawing points
      glEnd();

      // If we're pressing the "up" key increase our speed
      if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
        speed += 0.01f;
      }
      // If we're pressing the "down" key decrease our speed
      if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
        speed -= 0.01f;
      }
      // Iterate over keyboard input events
      while (Keyboard.next()) {
        // If we're pressing the "space-bar" key reset our speed to zero
        if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
          speed = 0f;
        }
        // If we're pressing the "c" key reset our speed to zero and reset our position
        if (Keyboard.isKeyDown(Keyboard.KEY_C)) {
          speed = 0;
          glLoadIdentity();
        }
      }

      if (Display.isCloseRequested()) {
        CSGame.state = States.Closing;
        break;
      }

      Debug.debugLoop();
      // Update the display
      Display.update();
      // Wait until the frame-rate is 60fps
      Display.sync(60);
    }
  }
Exemplo n.º 12
0
 private void frameFunction() {
   if (Keyboard.isKeyDown(Keyboard.KEY_F)) {
     try {
       physEngine.update(16);
     } catch (Exception e) {
       physEngine.stepBack();
     }
   } else if (Keyboard.isKeyDown(Keyboard.KEY_R)) {
     physEngine.stepBack();
   }
 }
  @Override
  public void addInformation(
      ItemStack essentiaCell, EntityPlayer player, List displayList, boolean advancedItemTooltips) {
    // TODO: Save provider??
    // Get the contents of the cell
    IMEInventoryHandler<IAEFluidStack> handler =
        AEApi.instance()
            .registries()
            .cell()
            .getCellInventory(essentiaCell, null, StorageChannel.FLUIDS);

    // Ensure we have a cell inventory handler
    if (!(handler instanceof HandlerItemEssentiaCell)) {
      return;
    }

    // Cast to cell inventory handler
    HandlerItemEssentiaCell cellHandler = (HandlerItemEssentiaCell) handler;

    // Create the bytes tooltip
    String bytesTip =
        String.format(
            StatCollector.translateToLocal(
                ThaumicEnergistics.MOD_ID + ".tooltip.essentia.cell.bytes"),
            new Object[] {
              cellHandler.usedBytes() / ItemEssentiaCell.CONVERSION_SIZE,
              cellHandler.totalBytes() / ItemEssentiaCell.CONVERSION_SIZE
            });

    // Create the types tooltip
    String typesTip =
        String.format(
            StatCollector.translateToLocal(
                ThaumicEnergistics.MOD_ID + ".tooltip.essentia.cell.types"),
            new Object[] {cellHandler.usedTypes(), cellHandler.totalTypes()});

    // Add the tooltips
    displayList.add(bytesTip);
    displayList.add(typesTip);

    // Is the cell pre-formated?
    if (cellHandler.isPreformatted()) {
      displayList.add(
          StatCollector.translateToLocal("Appeng.GuiITooltip.Partitioned")
              + " - "
              + StatCollector.translateToLocal("Appeng.GuiITooltip.Precise"));
    }

    // Is shift being held?
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
      // Add information about the essentia types in the cell
      this.addContentsToCellDescription(cellHandler, displayList, player);
    }
  }
Exemplo n.º 14
0
 public void getInput() {
   if (Keyboard.isKeyDown(Keyboard.KEY_Z)) {
     if (!pressed) {
       robot.path();
       pressed = true;
     }
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_P)) {
     pressed = false;
   }
   player.getInput();
 }
Exemplo n.º 15
0
 @Override
 @SideOnly(Side.CLIENT)
 public void addInformation(
     ItemStack itemStack, EntityPlayer player, List list, boolean whatIsThis) {
   super.addInformation(itemStack, player, list, whatIsThis);
   if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
     list.add("This machine smelts resonating ore and produces liquid");
     list.add("crystal in a tank placed on top of this.");
     list.add("Below the smelter place a tank about half-filled with lava");
   } else {
     list.add(EnumChatFormatting.WHITE + ClientHandler.getShiftMessage());
   }
 }
Exemplo n.º 16
0
  @SideOnly(Side.CLIENT)
  @Override
  public void addInformation(
      ItemStack itemStack, EntityPlayer player, List list, boolean whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);

    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
      list.add(EnumChatFormatting.WHITE + "Make storage modules remotely available.");
      list.add(EnumChatFormatting.WHITE + "Requires energy to do this.");
      list.add(EnumChatFormatting.YELLOW + "Infusing bonus: reduced power consumption");
    } else {
      list.add(EnumChatFormatting.WHITE + RFTools.SHIFT_MESSAGE);
    }
  }
Exemplo n.º 17
0
 public void getInputCheats() {
   if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && !player.isBot) {
     player.x += -1;
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && !player.isBot) {
     player.x += 1;
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_UP) && !player.isBot) {
     player.collisionWithPrism();
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && !player.isBot) {
     player.collisionWithObstacle();
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
     level++;
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
     level--;
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_I)) {
     player.immortal = true;
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_U)) {
     player.immortal = false;
   }
 }
 private static void checkInput() {
   timer.update();
   camera.processMouse(1, 80, -80);
   camera.processKeyboard(16, 1, 1, 1);
   if (Mouse.isButtonDown(0)) Mouse.setGrabbed(true);
   else if (Mouse.isButtonDown(1)) Mouse.setGrabbed(false);
   while (Keyboard.next()) {
     if (Keyboard.isKeyDown(Keyboard.KEY_P)) {
       currentShaderProgram = perPixelShaderProgram;
     } else if (Keyboard.isKeyDown(Keyboard.KEY_V)) {
       currentShaderProgram = perVertexShaderProgram;
     }
   }
 }
Exemplo n.º 19
0
 /** Fonction qui définit les évênements clavier et souris. */
 public final void input() {
   if (Keyboard.isKeyDown(Keyboard.KEY_Z)) { // move forward
     camera.walkForward(movementSpeed * dt);
     setLastInput(0.0f);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_S)) { // move backwards
     camera.walkBackwards(movementSpeed * dt);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_Q)) { // strafe left
     camera.strafeLeft(movementSpeed * dt);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_D)) { // strafe right
     camera.strafeRight(movementSpeed * dt);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { // strafe left
     camera.up(movementSpeed * dt);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { // strafe right
     camera.down(movementSpeed * dt);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_A)) { // strafe right
     camera.pitch(-movementSpeed * dt);
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_E)) { // strafe right
     camera.pitch(movementSpeed * dt);
   }
   if (Mouse.isButtonDown(0)) {
     // distance in mouse movement from the last getDX() call.
     dx = Mouse.getDX();
     // distance in mouse movement from the last getDY() call.
     dy = Mouse.getDY();
     camera.yaw(dx * mouseSensitivity);
     camera.pitch(dy * mouseSensitivity);
   }
 }
  @Override
  public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean flag) {
    super.addInformation(itemStack, player, list, flag);

    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
      String[] tooltipLines =
          StatCollector.translateToLocal(getUnlocalizedName(itemStack) + ".tooltip").split("\\\\n");
      for (String s : tooltipLines) {
        list.add("\u00a73" + s);
      }
    } else {
      list.add("\u00a76" + StatCollector.translateToLocal(Strings.TOOLTIP_SHIFT));
    }
  }
 @Override
 public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean b) {
   if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
     list.add(StatCollector.translateToLocal(Strings.RELOCATOR_MODULE));
     String[] tooltipLines =
         StatCollector.translateToLocal(Strings.RELOCATOR_MODULE_INFO + itemStack.getItemDamage())
             .split("\\\\n");
     for (String s : tooltipLines) {
       list.add("\u00a73" + s);
     }
   } else {
     list.add("\u00a76" + StatCollector.translateToLocal(Strings.TOOLTIP_SHIFT));
   }
 }
Exemplo n.º 22
0
  private boolean clickHandler_Widgets(final int mouseX, final int mouseY, final int mouseButton) {
    if (Helper.isPointInGuiRegion(
        ME_ITEM_POS_Y,
        ME_ITEM_POS_X,
        this.rows * GUI_MIDDLE_HEIGHT,
        ME_GRID_WIDTH,
        mouseX,
        mouseY,
        this.guiLeft,
        this.guiTop)) {
      boolean doExtract = (this.entityPlayer.inventory.getItemStack() == null);

      doExtract |= (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && (mouseButton == 1));

      if (doExtract) {
        this.sendItemWidgetClicked(mouseX, mouseY, mouseButton);
      } else {
        // Inform the server the user would like to deposit the currently held item into the ME
        // network.
        new PacketChiselingTerminalServer()
            .createRequestDeposit(this.entityPlayer, mouseButton)
            .sendPacketToServer();
      }

      // Do not pass to super
      return true;
    }

    return false;
  }
Exemplo n.º 23
0
 public static boolean showExtraInformation() {
   if ((FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
       && (Keyboard.isKeyDown(42))) {
     return true;
   }
   return false;
 }
Exemplo n.º 24
0
  private boolean onTick() {

    tickNumber++;

    // Not calling "cfgManager.makeSureConfigurationIsLoaded()" for performance reasons
    InvTweaksConfig config = cfgManager.getConfig();
    if (config == null) {
      return false;
    }

    // Clone the hotbar to be able to monitor changes on it
    if (itemPickupPending) {
      onItemPickup();
    }
    aue currentScreen = getCurrentScreen();
    if (currentScreen == null || isGuiInventory(currentScreen)) {
      cloneHotbar();
    }

    // Handle sort key
    if (Keyboard.isKeyDown(config.getSortKeyCode())) {
      if (!sortKeyDown) {
        sortKeyDown = true;
        onSortingKeyPressed();
      }
    } else {
      sortKeyDown = false;
    }

    // Handle config switch
    handleConfigSwitch();

    return true;
  }
 public void drawScreen(int par1, int par2, float par3) {
   super.drawScreen(par1, par2, par3);
   boolean op = false; // TODO: Check if player is OP
   if (Keyboard.isKeyDown(Keyboard.KEY_O) && op) {
     player.openGui(ModUncrafting.instance, 1, worldObj, x, y, z);
   }
 }
Exemplo n.º 26
0
 private void keyboardHandler() {
   while (Keyboard.next()) {
     if (Keyboard.isKeyDown(Keyboard.KEY_RETURN)) {
       openConsole();
     }
   }
 }
Exemplo n.º 27
0
 @SideOnly(Side.CLIENT)
 @Override
 public void addInformation(ItemStack is, EntityPlayer ep, List li, boolean verbose) {
   int i = is.getItemDamage();
   if (i < MaterialRegistry.matList.length) {
     if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
       MaterialRegistry mat = MaterialRegistry.matList[i];
       double torque = mat.getMaxShaftTorque();
       double speed = mat.getMaxShaftSpeed();
       li.add(
           String.format(
               "Max Speed: %.3f %srad/s",
               ReikaMathLibrary.getThousandBase(speed), ReikaEngLibrary.getSIPrefix(speed)));
       li.add(
           String.format(
               "Max Torque: %.3f %sNm",
               ReikaMathLibrary.getThousandBase(torque), ReikaEngLibrary.getSIPrefix(torque)));
     } else {
       StringBuilder sb = new StringBuilder();
       sb.append("Hold ");
       sb.append(EnumChatFormatting.GREEN.toString());
       sb.append("Shift");
       sb.append(EnumChatFormatting.GRAY.toString());
       sb.append(" for load data");
       li.add(sb.toString());
     }
   }
 }
Exemplo n.º 28
0
  @Override
  public void mouseClicked(int xAxis, int yAxis, int button) {
    if (xAxis >= xLocation + 1
        && xAxis <= xLocation + width - 1
        && yAxis >= yLocation + 1
        && yAxis <= yLocation + height - 1) {
      ItemStack stack = mc.thePlayer.inventory.getItemStack();

      if (guiObj instanceof GuiMekanism
          && stack != null
          && stack.getItem() instanceof ItemGaugeDropper) {
        TileEntity tile = ((GuiMekanism) guiObj).getTileEntity();

        if (tile instanceof ITankManager) {
          int index =
              Arrays.asList(((ITankManager) tile).getTanks()).indexOf(infoHandler.getTank());

          if (index != -1) {
            if (button == 0 && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
              button = 2;
            }

            Mekanism.packetHandler.sendToServer(
                new DropperUseMessage(Coord4D.get(tile), button, index));
          }
        }
      }
    }
  }
Exemplo n.º 29
0
  private void checkInput() {
    if (Mouse.isButtonDown(0)) {
      leftHold(Mouse.getX(), Mouse.getY());
    }
    while (Mouse.next()) {
      if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
        leftClick(Mouse.getX(), Mouse.getY());
      }

      if (Mouse.getEventButtonState() && Mouse.getEventButton() == 1) {
        rightClick();
      }
    }
    while (Keyboard.next()) {
      if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
        System.exit(0);
      }

      if (Keyboard.getEventKey() == Keyboard.KEY_SPACE) {
        if (drawVector) {
          drawVector = false;
        } else {
          drawVector = true;
        }
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
      if (vecSlider.y < 85) {
        vecSlider.y++;
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
      if (vecSlider.x > -90) {
        vecSlider.x--;
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
      if (vecSlider.y > -85) {
        vecSlider.y--;
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
      if (vecSlider.x < 85) {
        vecSlider.x++;
      }
    }
  }
Exemplo n.º 30
0
 private boolean isSortingShortcutDown() {
   int keyCode = getKeyCode(SORT_KEY_BINDING);
   if (keyCode > 0) {
     return Keyboard.isKeyDown(keyCode);
   } else {
     return Mouse.isButtonDown(100 + keyCode);
   }
 }