Search in sources :

Example 56 with IFluidTank

use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.

the class TileEntityBase01Root method drain.

public FluidStack drain(ForgeDirection aDirection, int aAmountToDrain, boolean aDoDrain) {
    if (aAmountToDrain <= 0)
        return null;
    IFluidTank tTank = getFluidTankDrainable(UT.Code.side(aDirection), null);
    if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0)
        return null;
    FluidStack rDrained = tTank.drain(aAmountToDrain, aDoDrain);
    if (rDrained != null && aDoDrain)
        updateInventory();
    return rDrained;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) IFluidTank(net.minecraftforge.fluids.IFluidTank)

Example 57 with IFluidTank

use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.

the class TileEntityBase01Root method drain.

public FluidStack drain(ForgeDirection aDirection, FluidStack aFluid, boolean aDoDrain) {
    if (aFluid == null || aFluid.amount <= 0)
        return null;
    IFluidTank tTank = getFluidTankDrainable(UT.Code.side(aDirection), aFluid);
    if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 || !tTank.getFluid().isFluidEqual(aFluid))
        return null;
    FluidStack rDrained = tTank.drain(aFluid.amount, aDoDrain);
    if (rDrained != null && aDoDrain)
        updateInventory();
    return rDrained;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) IFluidTank(net.minecraftforge.fluids.IFluidTank)

Example 58 with IFluidTank

use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.

the class TileEntityBase01Root method drain.

public FluidStack drain(MultiTileEntityMultiBlockPart aPart, byte aDirection, FluidStack aFluid, boolean aDoDrain) {
    if (aFluid == null || aFluid.amount <= 0)
        return null;
    IFluidTank tTank = getFluidTankDrainable(aPart, UT.Code.side(aDirection), aFluid);
    if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0 || !tTank.getFluid().isFluidEqual(aFluid))
        return null;
    FluidStack rDrained = tTank.drain(aFluid.amount, aDoDrain);
    if (rDrained != null && aDoDrain)
        updateInventory();
    return rDrained;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) IFluidTank(net.minecraftforge.fluids.IFluidTank)

Aggregations

IFluidTank (net.minecraftforge.fluids.IFluidTank)58 FluidStack (net.minecraftforge.fluids.FluidStack)30 IFluidHandler (net.minecraftforge.fluids.capability.IFluidHandler)10 FluidTank (net.minecraftforge.fluids.FluidTank)9 Nullable (javax.annotation.Nullable)6 Block (net.minecraft.block.Block)6 ItemStack (net.minecraft.item.ItemStack)6 TileEntity (net.minecraft.tileentity.TileEntity)5 NBTBase (net.minecraft.nbt.NBTBase)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 NBTTagList (net.minecraft.nbt.NBTTagList)4 INBTSerializable (net.minecraftforge.common.util.INBTSerializable)4 Recipe (gregtech.api.recipes.Recipe)3 ArrayList (java.util.ArrayList)3 IItemHandlerModifiable (net.minecraftforge.items.IItemHandlerModifiable)3 FluidTankTileEntity (com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity)2 FluidTankGT (gregapi.fluid.FluidTankGT)2 OreDictItemData (gregapi.oredict.OreDictItemData)2 FuelRecipe (gregtech.api.recipes.recipes.FuelRecipe)2 BlockLiquid (net.minecraft.block.BlockLiquid)2