private void doExtract() { BlockCoord loc = getLocation(); if (!hasConnectionMode(ConnectionMode.INPUT)) { return; } // assume failure, reset to 0 if we do extract ticksSinceFailedExtract++; if (ticksSinceFailedExtract > 9 && ticksSinceFailedExtract % 10 != 0) { // after 10 ticks of failing, only check every 10 ticks return; } Fluid f = tank.getFluid() == null ? null : tank.getFluid().getFluid(); int token = network == null ? -1 : network.getNextPushToken(); for (ForgeDirection dir : externalConnections) { if (autoExtractForDir(dir)) { IFluidHandler extTank = getTankContainer(getLocation().getLocation(dir)); if (extTank != null) { boolean foundFluid = false; FluidTankInfo[] info = extTank.getTankInfo(dir.getOpposite()); if (info != null) { for (FluidTankInfo inf : info) { if (inf != null && inf.fluid != null && inf.fluid.amount > 0) { foundFluid = true; } } } if (!foundFluid) { return; } FluidStack couldDrain = extTank.drain(dir.getOpposite(), MAX_EXTRACT_PER_TICK, false); if (couldDrain != null && couldDrain.amount > 0 && canFill(dir, couldDrain.getFluid())) { int used = pushLiquid( dir, couldDrain, true, network == null ? -1 : network.getNextPushToken()); extTank.drain(dir.getOpposite(), used, true); if (used > 0 && network != null && network.getFluidType() == null) { network.setFluidType(couldDrain); } if (used > 0) { ticksSinceFailedExtract = 0; } } } } } }