/** * Checks if the player has a certain amount (or more) of a specified food * * @param food - Specified food * @param amount - Amount to check for * @return boolean */ public boolean hasFood(Food food, int amount) { if (food.getStack() >= amount) { return true; } else { return false; } }
/** * Removes the amount of food to its stack * * @param food - Food to control * @param amount - Amount to decrease by */ public void removeFood(Food food, int amount) { food.setStack(food.getStack() - amount); Sys.print(amount + " " + food.getName() + " was removed from your inventory!"); }
/** * Adds the amount of food to its stack * * @param food - Food to control * @param amount - Amount to increase by */ public void addFood(Food food, int amount) { food.setStack(food.getStack() + amount); Sys.print(amount + " " + food.getName() + " was added to your inventory!"); }