public int GetFirstDogFoodStack(EntityDTDoggy entitydtdoggy) { for (int i = 0; i < 5; i++) { if (bowlcontents[i] == null) { continue; } Item item = bowlcontents[i].getItem(); if (item == null || !(item instanceof ItemFood)) { continue; } ItemStack itemstack = GetStackInSlot(i); if (entitydtdoggy.foodValue(itemstack) != 0) { return i; } } return -1; }
public ItemStack FeedDog(EntityDTDoggy entitydtdoggy, int i, int j) { if (GetStackInSlot(i) != null) { ItemStack itemstack = GetStackInSlot(i); entitydtdoggy.setWolfTummy(entitydtdoggy.getWolfTummy() + entitydtdoggy.foodValue(itemstack)); if (GetStackInSlot(i).stackSize <= j) { ItemStack itemstack1 = GetStackInSlot(i); setInventorySlotContents(i, null); return itemstack1; } ItemStack itemstack2 = GetStackInSlot(i).splitStack(j); if (GetStackInSlot(i).stackSize == 0) { setInventorySlotContents(i, null); } else { onInventoryChanged(); } return itemstack2; } else { return null; } }