@Override
  public List<ItemStack> ranch(World world, EntityLiving entity, IInventory rancher) {
    List<ItemStack> drops = new LinkedList<ItemStack>();

    IInventoryManager manager = InventoryManager.create(rancher, ForgeDirection.UP);
    int bowlIndex = manager.findItem(new ItemStack(Item.bowlEmpty));
    if (bowlIndex >= 0) {
      drops.add(new ItemStack(Item.bowlSoup));
      rancher.decrStackSize(bowlIndex, 1);
    }

    int bucketIndex = manager.findItem(new ItemStack(Item.bucketEmpty));
    if (bucketIndex >= 0) {
      drops.add(new ItemStack(Item.bucketMilk));
      rancher.setInventorySlotContents(bucketIndex, null);
    } else {
      LiquidStack soup = LiquidDictionary.getLiquid("mushroomsoup", 1000);
      drops.add(new ItemStack(soup.itemID, 1, soup.itemMeta));
    }

    return drops;
  }
예제 #2
0
  @Override
  public List<RanchedItem> ranch(World world, EntityLivingBase entity, IInventory rancher) {
    List<RanchedItem> drops = new LinkedList<RanchedItem>();
    IInventoryManager manager = InventoryManager.create(rancher, ForgeDirection.UP);
    int bucketIndex = manager.findItem(new ItemStack(Item.bucketEmpty));
    if (bucketIndex >= 0) {
      drops.add(new RanchedItem(Item.bucketMilk));
      rancher.decrStackSize(bucketIndex, 1);
    } else {
      FluidStack milk = FluidRegistry.getFluidStack("milk", FluidContainerRegistry.BUCKET_VOLUME);
      drops.add(new RanchedItem(milk));
    }

    return drops;
  }