public static Rectangle getBounds() { Point[] arr = ColorUtil.findAllColorWithinTolerance(MENU, new Color(1, 1, 1)); try { Point left = Calc.getLeftMax(arr); Point right = Calc.getRightMax(arr); Point high = Calc.getNorthern(arr); Point low = Calc.getSouthern(arr); return new Rectangle(left.x, high.y, right.x - left.x, low.y - high.y); } catch (Exception ignored) { } return null; }
public static void clickIndex(int index) { if (!isOpen()) { return; } Point[] arr = ColorUtil.findAllColorWithinTolerance(MENU, new Color(1, 1, 1)); if (arr.length < 0) { return; } int menuY = 8; for (int x = 0; x < index; x++) { menuY += 16; } Point left = Calc.getLeftMax(arr); Point right = Calc.getRightMax(arr); Point high = Calc.getNorthern(arr); Mouse.click(left.x + (right.x - left.x) / 2, high.y + menuY, true); }