Search in sources :

Example 21 with LiquidStack

use of net.minecraftforge.liquids.LiquidStack in project MineFactoryReloaded by powercrystals.

the class RanchableCow method ranch.

@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 bucketIndex = manager.findItem(new ItemStack(Item.bucketEmpty));
    if (bucketIndex >= 0) {
        drops.add(new ItemStack(Item.bucketMilk));
        rancher.decrStackSize(bucketIndex, 1);
    } else {
        LiquidStack milk = LiquidDictionary.getLiquid("milk", 1000);
        drops.add(new ItemStack(milk.itemID, 1, milk.itemMeta));
    }
    return drops;
}
Also used : LiquidStack(net.minecraftforge.liquids.LiquidStack) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList) IInventoryManager(powercrystals.core.inventory.IInventoryManager)

Example 22 with LiquidStack

use of net.minecraftforge.liquids.LiquidStack in project MineFactoryReloaded by powercrystals.

the class RanchableMooshroom method ranch.

@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;
}
Also used : LiquidStack(net.minecraftforge.liquids.LiquidStack) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList) IInventoryManager(powercrystals.core.inventory.IInventoryManager)

Aggregations

LiquidStack (net.minecraftforge.liquids.LiquidStack)22 ItemStack (net.minecraft.item.ItemStack)13 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 NBTTagList (net.minecraft.nbt.NBTTagList)4 LinkedList (java.util.LinkedList)3 ILiquidTank (net.minecraftforge.liquids.ILiquidTank)3 LiquidContainerData (net.minecraftforge.liquids.LiquidContainerData)3 PostInit (cpw.mods.fml.common.Mod.PostInit)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ITankContainer (net.minecraftforge.liquids.ITankContainer)2 IInventoryManager (powercrystals.core.inventory.IInventoryManager)2 Init (cpw.mods.fml.common.Mod.Init)1 EntityLiving (net.minecraft.entity.EntityLiving)1 ICrafting (net.minecraft.inventory.ICrafting)1 Item (net.minecraft.item.Item)1 Icon (net.minecraft.util.Icon)1 BiomeGenBase (net.minecraft.world.biome.BiomeGenBase)1 LiquidTank (net.minecraftforge.liquids.LiquidTank)1 BlockPosition (powercrystals.core.position.BlockPosition)1 IFactoryRanchable (powercrystals.minefactoryreloaded.api.IFactoryRanchable)1