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;
    }
  }
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    List var1 = null;
    var1 =
        this.worldObj.getEntitiesWithinAABB(
            EntityDTDoggy.class,
            AxisAlignedBB.getBoundingBox(
                    (float) this.xCoord,
                    (double) (float) this.yCoord + 0.5D,
                    (float) this.zCoord,
                    (float) (this.xCoord + 1),
                    (double) (float) this.yCoord + 0.5D + 0.05000000074505806D,
                    (float) (this.zCoord + 1))
                .expand(5, 5, 5));

    if (var1 != null && var1.size() > 0) {
      for (int j1 = 0; j1 < var1.size(); j1++) {
        EntityDTDoggy entitydtdoggy1 = (EntityDTDoggy) var1.get(j1);

        if (entitydtdoggy1.getWolfTummy() <= 60 && this.GetFirstDogFoodStack(entitydtdoggy1) >= 0) {
          this.FeedDog(entitydtdoggy1, this.GetFirstDogFoodStack(entitydtdoggy1), 1);
        }
      }
    }
  }
  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;
  }