@Override
 public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
   if (!formed) return 0;
   if (master() != null) {
     if (pos != 15 && pos != 19) return 0;
     return master().fill(from, resource, doFill);
   } else if (resource != null) {
     int fill = 0;
     if (resource.isFluidEqual(tank0.getFluid())) fill = tank0.fill(resource, doFill);
     else if (resource.isFluidEqual(tank1.getFluid())) fill = tank1.fill(resource, doFill);
     else if (tank0.getFluidAmount() <= 0 && tank1.getFluidAmount() <= 0)
       fill =
           (DieselHandler.findIncompleteRefineryRecipe(resource, null) != null
               ? tank0.fill(resource, doFill)
               : 0);
     else {
       if (tank0.getFluidAmount() > 0)
         fill =
             (DieselHandler.findIncompleteRefineryRecipe(resource, tank0.getFluid()) != null
                 ? tank1.fill(resource, doFill)
                 : 0);
       else if (tank1.getFluidAmount() > 0)
         fill =
             (DieselHandler.findIncompleteRefineryRecipe(resource, tank1.getFluid()) != null
                 ? tank0.fill(resource, doFill)
                 : 0);
     }
     markDirty();
     worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
     return fill;
   }
   return 0;
 }
 @Override
 public boolean isItemValidForSlot(int slot, ItemStack stack) {
   if (!formed) return false;
   if (master() != null) return master().isItemValidForSlot(slot, stack);
   if (slot == 1 || slot == 3 || slot == 5) return false;
   if (slot == 4)
     return (tank2.getFluidAmount() <= 0
         ? FluidContainerRegistry.isEmptyContainer(stack)
         : FluidContainerRegistry.fillFluidContainer(
                 tank2.getFluid(), Utils.copyStackWithAmount(stack, 1))
             != null);
   FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(stack);
   if (fs == null) return false;
   RefineryRecipe partialRecipe = DieselHandler.findIncompleteRefineryRecipe(fs, null);
   if (partialRecipe == null) return false;
   if (slot == 0)
     return (tank0.getFluidAmount() <= 0 || fs.isFluidEqual(tank0.getFluid()))
         && (tank1.getFluidAmount() <= 0
             || DieselHandler.findIncompleteRefineryRecipe(fs, tank1.getFluid()) != null);
   if (slot == 2)
     return (tank1.getFluidAmount() <= 0 || fs.isFluidEqual(tank1.getFluid()))
         && (tank0.getFluidAmount() <= 0
             || DieselHandler.findIncompleteRefineryRecipe(fs, tank0.getFluid()) != null);
   return false;
 }
 public RefineryRecipe getRecipe(boolean checkCapacity) {
   RefineryRecipe recipe = DieselHandler.findRefineryRecipe(tank0.getFluid(), tank1.getFluid());
   if (recipe == null) return null;
   if (tank2.getFluid() == null
       || (tank2.getFluid().isFluidEqual(recipe.output)
           && (!checkCapacity
               || tank2.getFluidAmount() + recipe.output.amount <= tank2.getCapacity())))
     return recipe;
   return null;
 }