Exemple #1
0
  /* ITANKCONTAINER */
  @Override
  public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
    if (resource == null) {
      return 0;
    }

    resource = resource.copy();
    int totalUsed = 0;
    TileTank tankToFill = getBottomTank();

    FluidStack liquid = tankToFill.tank.getFluid();
    if (liquid != null && liquid.amount > 0 && !liquid.isFluidEqual(resource)) {
      return 0;
    }

    while (tankToFill != null && resource.amount > 0) {
      int used = tankToFill.tank.fill(resource, doFill);
      resource.amount -= used;
      if (used > 0) {
        tankToFill.hasUpdate = true;
      }

      totalUsed += used;
      tankToFill = getTankAbove(tankToFill);
    }
    return totalUsed;
  }
Exemple #2
0
  public void moveFluidBelow() {
    TileTank below = getTankBelow(this);
    if (below == null) {
      return;
    }

    int used = below.tank.fill(tank.getFluid(), true);
    if (used > 0) {
      hasUpdate = true; // not redundant because tank.drain operates on an IFluidTank, not a tile
      below.hasUpdate = true; // redundant because below.fill sets hasUpdate

      tank.drain(used, true);
    }
  }
Exemple #3
0
 @Override
 public FluidStack drain(ForgeDirection from, int maxEmpty, boolean doDrain) {
   TileTank bottom = getBottomTank();
   bottom.hasUpdate = true;
   return bottom.tank.drain(maxEmpty, doDrain);
 }