/* * Minecraft Forge * Copyright (c) 2016. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.minecraftforge.fluids.capability; import javax.annotation.Nullable; import net.minecraftforge.fluids.*; /** * Implement this interface as a capability which should handle fluids, generally storing them in * one or more internal {@link IFluidTank} objects. * <p/> * A reference implementation is provided {@link TileFluidHandler}. */ public interface IFluidHandler { /** * Returns an array of objects which represent the internal tanks. * These objects cannot be used to manipulate the internal tanks. * * @return Properties for the relevant internal tanks. */ IFluidTankProperties[] getTankProperties(); /** * Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler. * * @param resource FluidStack representing the Fluid and maximum amount of fluid to be filled. * @param doFill If false, fill will only be simulated. * @return Amount of resource that was (or would have been, if simulated) filled. */ int fill(FluidStack resource, boolean doFill); /** * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. * * @param resource FluidStack representing the Fluid and maximum amount of fluid to be drained. * @param doDrain If false, drain will only be simulated. * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ @Nullable FluidStack drain(FluidStack resource, boolean doDrain); /** * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. * <p/> * This method is not Fluid-sensitive. * * @param maxDrain Maximum amount of fluid to drain. * @param doDrain If false, drain will only be simulated. * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ @Nullable FluidStack drain(int maxDrain, boolean doDrain); }