public class FluidTank extends java.lang.Object implements IFluidTank
IFluidTank
. Use/extend this or implement your own.Modifier and Type | Field and Description |
---|---|
protected int |
capacity |
protected FluidStack |
fluid |
protected TileEntity |
tile |
Constructor and Description |
---|
FluidTank(Fluid fluid,
int amount,
int capacity) |
FluidTank(FluidStack stack,
int capacity) |
FluidTank(int capacity) |
Modifier and Type | Method and Description |
---|---|
FluidStack |
drain(int maxDrain,
boolean doDrain) |
int |
fill(FluidStack resource,
boolean doFill) |
int |
getCapacity() |
FluidStack |
getFluid() |
int |
getFluidAmount() |
FluidTankInfo |
getInfo()
Returns a wrapper object
FluidTankInfo containing the capacity of the tank and the
FluidStack it holds. |
FluidTank |
readFromNBT(NBTTagCompound nbt) |
void |
setCapacity(int capacity) |
void |
setFluid(FluidStack fluid) |
NBTTagCompound |
writeToNBT(NBTTagCompound nbt) |
protected FluidStack fluid
protected int capacity
protected TileEntity tile
public FluidTank(int capacity)
public FluidTank(FluidStack stack, int capacity)
public FluidTank(Fluid fluid, int amount, int capacity)
public FluidTank readFromNBT(NBTTagCompound nbt)
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
public void setFluid(FluidStack fluid)
public void setCapacity(int capacity)
public FluidStack getFluid()
getFluid
in interface IFluidTank
public int getFluidAmount()
getFluidAmount
in interface IFluidTank
public int getCapacity()
getCapacity
in interface IFluidTank
public FluidTankInfo getInfo()
IFluidTank
FluidTankInfo
containing the capacity of the tank and the
FluidStack it holds.
Should prevent manipulation of the IFluidTank. See FluidTank
.getInfo
in interface IFluidTank
public int fill(FluidStack resource, boolean doFill)
fill
in interface IFluidTank
resource
- FluidStack attempting to fill the tank.doFill
- If false, the fill will only be simulated.public FluidStack drain(int maxDrain, boolean doDrain)
drain
in interface IFluidTank
maxDrain
- Maximum amount of fluid to be removed from the container.