rendered paste body /** * By Miss Silabsoft * * @param invSlot * A inventory slot 1-28; * @return Number of items in the stack */ public int getInventoryStackSize(int invSlot) { if (itemExist(invSlot)) { Rectangle stackSlot = Info.getInventoryStackRectangle(invSlot); String ocr = getTextInBounds(getColorArray2d(), stackSlot, new RGB(255, 255, 0), "CharsTrade", 1, 1, 1); try { if (ocr.length() > 0) { int size = Integer.parseInt(ocr); if (size > 0) { return size; } } } catch (Exception e) { exception(e); } return 1; } return 0; }