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;
}
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);
}
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;
}
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);
}
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));
}
Aggregations