Package buildcraft.core.inventory

Source Code of buildcraft.core.inventory.FluidHandlerCopy

/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.inventory;

import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;

public class FluidHandlerCopy implements IFluidHandler {

  private IFluidHandler orignal;
  private FluidTankInfo[] contents;

  public FluidHandlerCopy(IFluidHandler orignal) {
    this.orignal = orignal;

    FluidTankInfo[] originalInfo = orignal.getTankInfo(ForgeDirection.UNKNOWN);

    contents = new FluidTankInfo[originalInfo.length];

    for (int i = 0; i < contents.length; i++) {
      if (originalInfo[i] != null) {
        if (originalInfo[i].fluid != null) {
          contents[i] = new FluidTankInfo(originalInfo[i].fluid.copy(), originalInfo[i].capacity);
        } else {
          contents[i] = new FluidTankInfo(null, originalInfo[i].capacity);
        }
      }
    }
  }

  @Override
  public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
    return 0;
  }

  @Override
  public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
    return null;
  }

  @Override
  public boolean canFill(ForgeDirection from, Fluid fluid) {
    return orignal.canFill(from, fluid);
  }

  @Override
  public boolean canDrain(ForgeDirection from, Fluid fluid) {
    return orignal.canDrain(from, fluid);
  }

  @Override
  public FluidTankInfo[] getTankInfo(ForgeDirection from) {
    return contents;
  }
}
TOP

Related Classes of buildcraft.core.inventory.FluidHandlerCopy

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.