@Override
  public void handleMouseInput() {
    if (Mouse.getEventButton() == -1) {
      this.mouseMovedOrUp(
          (Mouse.getEventX() * width) / mc.displayWidth,
          height - ((Mouse.getEventY() * height) / mc.displayHeight) - 1,
          -1);
    }

    super.handleMouseInput();
  }
  @Override
  protected void mouseClicked(int mouseX, int mouseY, int which) {
    super.mouseClicked(mouseX, mouseY, which);

    if (help) {
      this.closeHelpGui();
    } else {
      mousePosX = mouseX -= globalX;
      mousePosY = mouseY -= globalY;

      for (int i = 0; i < 6; i++) {
        if (this.inField(mouseX, mouseY, 8, 78 + (19 * i), 150, 96 + (19 * i))
            && ((i + scrollbarPos) < Gate.NumberGates)) {
          tileentity.changeGate(Gate.GateNames[i + scrollbarPos], direction);

          break;
        }
      }

      if (this.inField(mouseX, mouseY, 38, 7, 58, 27)
          && tileentity.canBeMovedByMouse(localToBlockDirections[0])) {
        movingPin = 0;
        movingPinOffsetX = mouseX - 38;
        movingPinOffsetY = mouseY - 7;
      } else if (this.inField(mouseX, mouseY, 38, 47, 58, 67)
          && tileentity.canBeMovedByMouse(localToBlockDirections[1])) {
        movingPin = 1;
        movingPinOffsetX = mouseX - 38;
        movingPinOffsetY = mouseY - 47;
      } else if (this.inField(mouseX, mouseY, 98, 7, 118, 27)
          && tileentity.canBeMovedByMouse(localToBlockDirections[2])) {
        movingPin = 2;
        movingPinOffsetX = mouseX - 98;
        movingPinOffsetY = mouseY - 7;
      } else if (this.inField(mouseX, mouseY, 78, 27, 98, 47)
          && tileentity.canBeMovedByMouse(localToBlockDirections[3])) {
        movingPin = 3;
        movingPinOffsetX = mouseX - 78;
        movingPinOffsetY = mouseY - 27;
      } else if (this.inField(mouseX, mouseY, 98, 47, 118, 67)
          && tileentity.canBeMovedByMouse(localToBlockDirections[4])) {
        movingPin = 4;
        movingPinOffsetX = mouseX - 98;
        movingPinOffsetY = mouseY - 47;
      } else if (this.inField(mouseX, mouseY, 118, 27, 138, 47)
          && tileentity.canBeMovedByMouse(localToBlockDirections[5])) {
        movingPin = 5;
        movingPinOffsetX = mouseX - 118;
        movingPinOffsetY = mouseY - 27;
      }

      if (this.inField(mouseX, mouseY, 168, 3, 172, 7)) {
        this.quit();

        return;
      }

      // REMOVE
      // for (byte byte0 = 0; byte0 <
      // TileEntityBlockBrainLogicBlock.numGates; byte0++) {
      // final int l = 12 * byte0;
      //
      // if (this.inField(i, j, 5, 18 + l, 75, 32 + l)) {
      // tileentity.setMode(byte0);
      // }
      // }
      //
      // if (this.inField(i, j, 76, 68, 168, 90)) {
      // tileentity.invertInvertOutput();
      // }
      //
      // if (!tileentity.isSwapable()) {
      // tileentity.setFocused(0);
      // } else if (this.inField(i, j, 124, 7, 143, 26)) {
      // focused = tileentity.getFocused();
      //
      // if (focused != 1) {
      // tileentity.setFocused(1);
      // } else {
      // tileentity.setFocused(0);
      // }
      // } else if (this.inField(i, j, 144, 27, 163, 46)) {
      // if (focused != 2) {
      // tileentity.setFocused(2);
      // } else {
      // tileentity.setFocused(0);
      // }
      // } else if (this.inField(i, j, 104, 27, 123, 46)) {
      // if (focused != 3) {
      // tileentity.setFocused(3);
      // } else {
      // tileentity.setFocused(0);
      // }
      // } else {
      // tileentity.setFocused(0);
      // }
    }
  }