Search in sources :

Example 46 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class MultiFluidTank method writeToNBT.

public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
    NBTTagList tagList = new NBTTagList();
    for (FluidStack fs : this.fluids) if (fs != null)
        tagList.appendTag(fs.writeToNBT(new NBTTagCompound()));
    nbt.setTag("fluids", tagList);
    return nbt;
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) FluidStack(net.minecraftforge.fluids.FluidStack) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 47 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class MultiFluidTank method getInfo.

@Override
public FluidTankInfo getInfo() {
    FluidStack fs = getFluid();
    int capacity = this.capacity - getFluidAmount();
    if (fs != null)
        capacity += fs.amount;
    return new FluidTankInfo(fs, capacity);
}
Also used : FluidTankInfo(net.minecraftforge.fluids.FluidTankInfo) FluidStack(net.minecraftforge.fluids.FluidStack)

Example 48 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class MultiFluidTank method fill.

@Override
public int fill(FluidStack resource, boolean doFill) {
    int space = this.capacity - getFluidAmount();
    int toFill = Math.min(resource.amount, space);
    if (!doFill)
        return toFill;
    for (FluidStack fs : this.fluids) if (fs.isFluidEqual(resource)) {
        fs.amount += toFill;
        return toFill;
    }
    this.fluids.add(Utils.copyFluidStackWithAmount(resource, toFill, true));
    return toFill;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack)

Example 49 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class RefineryRecipeCategory method setRecipe.

@Override
public void setRecipe(IRecipeLayout recipeLayout, RefineryRecipeWrapper recipeWrapper, IIngredients ingredients) {
    List<List<FluidStack>> inputs = ingredients.getInputs(FluidStack.class);
    IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
    if (inputs.size() > 0) {
        guiFluidStacks.init(0, true, 7, 10, 16, 47, 6000, false, tankOverlay);
        guiFluidStacks.set(0, inputs.get(0));
        if (inputs.size() > 1) {
            guiFluidStacks.init(1, true, 55, 10, 16, 47, 6000, false, tankOverlay);
            guiFluidStacks.set(1, inputs.get(1));
        }
    }
    guiFluidStacks.init(2, false, 103, 10, 16, 47, 6000, false, tankOverlay);
    guiFluidStacks.set(2, ingredients.getOutputs(FluidStack.class));
    guiFluidStacks.addTooltipCallback(JEIHelper.fluidTooltipCallback);
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) IGuiFluidStackGroup(mezz.jei.api.gui.IGuiFluidStackGroup) List(java.util.List)

Example 50 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class Refinery method addRecipe.

@ZenMethod
public static void addRecipe(ILiquidStack output, ILiquidStack input0, ILiquidStack input1, int energy) {
    FluidStack fOut = CraftTweakerHelper.toFluidStack(output);
    FluidStack fIn0 = CraftTweakerHelper.toFluidStack(input0);
    FluidStack fIn1 = CraftTweakerHelper.toFluidStack(input1);
    if (fOut == null || fIn0 == null || fIn1 == null)
        return;
    RefineryRecipe r = new RefineryRecipe(fOut, fIn0, fIn1, energy);
    MineTweakerAPI.apply(new Add(r));
}
Also used : RefineryRecipe(blusunrize.immersiveengineering.api.crafting.RefineryRecipe) FluidStack(net.minecraftforge.fluids.FluidStack) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Aggregations

FluidStack (net.minecraftforge.fluids.FluidStack)188 ItemStack (net.minecraft.item.ItemStack)63 TileEntity (net.minecraft.tileentity.TileEntity)30 Fluid (net.minecraftforge.fluids.Fluid)28 IFluidHandler (net.minecraftforge.fluids.IFluidHandler)25 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)19 ArrayList (java.util.ArrayList)18 IFluidHandler (net.minecraftforge.fluids.capability.IFluidHandler)16 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)12 FluidTankInfo (net.minecraftforge.fluids.FluidTankInfo)10 Item (net.minecraft.item.Item)9 BlockPos (net.minecraft.util.math.BlockPos)9 HashMap (java.util.HashMap)6 FluidIdentifier (logisticspipes.utils.FluidIdentifier)6 StandardTank (mods.railcraft.common.fluids.tanks.StandardTank)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 PipeFluidTransportLogistics (logisticspipes.transport.PipeFluidTransportLogistics)5 IBlockState (net.minecraft.block.state.IBlockState)5 EnumFacing (net.minecraft.util.EnumFacing)5