Package net.neoforged.neoforge.fluids
Interface IFluidTank
- All Known Implementing Classes:
FluidTank
public interface IFluidTank
This interface represents a Fluid Tank. IT IS NOT REQUIRED but is provided for convenience.
You are free to handle Fluids in any way that you wish - this is simply an easy default way.
DO NOT ASSUME that these objects are used internally in all cases.
-
Method Summary
Modifier and TypeMethodDescriptiondrain
(int maxDrain, IFluidHandler.FluidAction action) drain
(FluidStack resource, IFluidHandler.FluidAction action) int
fill
(FluidStack resource, IFluidHandler.FluidAction action) int
getFluid()
int
boolean
isFluidValid
(FluidStack stack)
-
Method Details
-
getFluid
FluidStack getFluid()- Returns:
- FluidStack representing the fluid in the tank, null if the tank is empty.
-
getFluidAmount
int getFluidAmount()- Returns:
- Current amount of fluid in the tank.
-
getCapacity
int getCapacity()- Returns:
- Capacity of this fluid tank.
-
isFluidValid
- Parameters:
stack
- Fluidstack holding the Fluid to be queried.- Returns:
- If the tank can hold the fluid (EVER, not at the time of query).
-
fill
- Parameters:
resource
- FluidStack attempting to fill the tank.action
- If SIMULATE, the fill will only be simulated.- Returns:
- Amount of fluid that was accepted (or would be, if simulated) by the tank.
-
drain
- Parameters:
maxDrain
- Maximum amount of fluid to be removed from the container.action
- If SIMULATE, the drain will only be simulated.- Returns:
- Amount of fluid that was removed (or would be, if simulated) from the tank.
-
drain
- Parameters:
resource
- Maximum amount of fluid to be removed from the container.action
- If SIMULATE, the drain will only be simulated.- Returns:
- FluidStack representing fluid that was removed (or would be, if simulated) from the tank.
-