Doout Posted June 29, 2013 Share Posted June 29, 2013 /** * @return The item that is edible to eat. * @author Baheer */ public Item getEdibleItem() { Item[] is = client.getInventory().getItems(); for (Item i : is) { if (i == null) continue; if (i.getDefinition() == null || i.getDefinition().getActions() == null || i.getDefinition().getActions()[0] == null) { continue; } if (i.getDefinition().getActions()[0].contains("Eat")) { return i; } } return null; } 1 Link to comment Share on other sites More sharing options...
SXForce Posted June 29, 2013 Share Posted June 29, 2013 Nice little snippet. Might use it some time. Link to comment Share on other sites More sharing options...
oTroll Posted June 29, 2013 Share Posted June 29, 2013 You can put continue; in if statements? I thought it was only switch statements Link to comment Share on other sites More sharing options...
Doout Posted June 29, 2013 Author Share Posted June 29, 2013 You can put continue; in if statements? I thought it was only switch statements it is for the for loop Link to comment Share on other sites More sharing options...