while(itemStack.stackSize > 0) {
ItemStack remainingItem = itemStack.onFoodEaten(player.worldObj, player);
remainingItem = ForgeEventFactory.onItemUseFinish(player, itemStack, 0, remainingItem);
if(remainingItem != null && remainingItem.stackSize > 0 && (remainingItem != itemStack || remainingItem.stackSize != startValue)) {
if(!player.inventory.addItemStackToInventory(remainingItem)) {
player.dropPlayerItemWithRandomChoice(remainingItem, false);
}
}
if(itemStack.stackSize == startValue) break;
}
}