コード例 #1
0
  @Override
  public void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
    super.mouseClicked(mouseX, mouseY, button);

    int xAxis = (mouseX - (width - xSize) / 2);
    int yAxis = (mouseY - (height - ySize) / 2);

    if (button == 0) {
      if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) {
        SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
        Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 10));
      }
    }
  }
コード例 #2
0
  @Override
  public void mouseClicked(int mouseX, int mouseY, int button) {
    super.mouseClicked(mouseX, mouseY, button);

    int xAxis = (mouseX - (width - xSize) / 2);
    int yAxis = (mouseY - (height - ySize) / 2);

    if (button == 0) {
      if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) {
        SoundHandler.playSound("gui.button.press");
        MekanismGenerators.packetHandler.sendToServer(
            new GeneratorsGuiMessage(Coord4D.get(tileEntity), 10));
      }
    }
  }
コード例 #3
0
  @Override
  protected void mouseClicked(int x, int y, int button) {
    super.mouseClicked(x, y, button);

    if (button == 0) {
      int xAxis = (x - (width - xSize) / 2);
      int yAxis = (y - (height - ySize) / 2);

      if (xAxis > 45 && xAxis < 63 && yAxis > 13 && yAxis < 21) {
        ArrayList data = new ArrayList();
        data.add(0);

        Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
        SoundHandler.playSound("gui.button.press");
      }
    }
  }