public boolean deselectItem() {
if(inventory.isItemSelected()) {
return mouse.click(inventory.getMouseDestination(getSelectedItemSlot()));
}
return false;
}
public int getSelectedItemSlot() {
if(inventory.isItemSelected()) {
for(int slot = 0; slot < 28; slot++) {
Item it = inventory.getItemInSlot(slot);
if(it != null && it.getName().equals(inventory.getSelectedItemName())) {
InventorySlotDestination is = new InventorySlotDestination(getBot(), slot);
for(int x = is.getBoundingBox().x; x < is.getBoundingBox().x + is.getBoundingBox().width; x++) {
for(int y = is.getBoundingBox().y; y < is.getBoundingBox().y + is.getBoundingBox().height; y++) {
if(getColorPicker().isColorAt(x, y, new Color(255, 255, 255))) {
return slot;
}
}
}
}
}
}
return -1;
}