Example usage for net.minecraftforge.fluids IFluidTank IFluidTank

List of usage examples for net.minecraftforge.fluids IFluidTank IFluidTank

Introduction

In this page you can find the example usage for net.minecraftforge.fluids IFluidTank IFluidTank.

Prototype

IFluidTank

Source Link

Usage

From source file:rheel.ac.common.tileentity.TileEntitySAPCMain.java

License:Open Source License

@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
    if (this.canFill(from, resource.getFluid())) {
        int amount = (int) Math.min(this.maxHelium - this.helium, resource.amount);

        if (doFill) {
            this.helium += amount;
            FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(new FluidStack(resource.getFluid(), amount),
                    this.worldObj, this.xCoord, this.yCoord, this.zCoord, new IFluidTank() {
                        @Override
                        public FluidTankInfo getInfo() {
                            return this.getInfo();
                        }/*from   ww  w  .jav a  2 s  .  co  m*/

                        @Override
                        public int getFluidAmount() {
                            return this.getFluidAmount();
                        }

                        @Override
                        public FluidStack getFluid() {
                            return this.getFluid();
                        }

                        @Override
                        public int getCapacity() {
                            return this.getCapacity();
                        }

                        @Override
                        public int fill(FluidStack resource, boolean doFill) {
                            return this.fill(resource, doFill);
                        }

                        @Override
                        public FluidStack drain(int maxDrain, boolean doDrain) {
                            return this.drain(maxDrain, doDrain);
                        }
                    }));
        }

        return amount;
    }

    return 0;
}