Program: 165632
Project: 165632
Buggy source:
private void checkStateServer(){
  long time=System.currentTimeMillis();
  if (lastTime == 0) {
    lastTime=time;
  }
 else   if (time > lastTime + 2000) {
    lastRfPerTickIn=(int)(50 * powerIn / (time - lastTime));
    lastRfPerTickOut=(int)(50 * powerOut / (time - lastTime));
    lastTime=time;
    powerIn=0;
    powerOut=0;
  }
  boolean redstoneSignal=powerLevel > 0;
  int[] rf=redstoneSignal ? rfOn : rfOff;
  boolean[] inputMode=redstoneSignal ? inputModeOn : inputModeOff;
  int energyStored=getEnergyStored();
  if (energyStored <= 0) {
    return;
  }
  IBlockState state=getWorld().getBlockState(getPos());
  for (  EnumFacing facing : EnumFacing.VALUES) {
    int side=OrientationTools.reorient(facing,state).ordinal();
    if (rf[side] > 0 && !inputMode[side]) {
      TileEntity te=getWorld().getTileEntity(getPos().offset(facing));
      EnumFacing opposite=facing.getOpposite();
      if (EnergyTools.isEnergyTE(te) || (te != null && te.hasCapability(CapabilityEnergy.ENERGY,opposite))) {
        int rfToGive;
        if (rf[side] <= energyStored) {
          rfToGive=rf[side];
        }
 else {
          rfToGive=energyStored;
        }
        int received;
        if (RFTools.redstoneflux && RedstoneFluxCompatibility.isEnergyConnection(te)) {
          if (RedstoneFluxCompatibility.canConnectEnergy(te,opposite)) {
            received=EnergyTools.receiveEnergy(te,opposite,rfToGive);
          }
 else {
            received=0;
          }
        }
 else {
          received=EnergyTools.receiveEnergy(te,opposite,rfToGive);
        }
        powerOut+=received;
        energyStored-=storage.extractEnergy(received,false);
        if (energyStored <= 0) {
          return;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void checkStateServer(){
  long time=System.currentTimeMillis();
  if (lastTime == 0) {
    lastTime=time;
  }
 else   if (time > lastTime + 2000) {
    lastRfPerTickIn=(int)(50 * powerIn / (time - lastTime));
    lastRfPerTickOut=(int)(50 * powerOut / (time - lastTime));
    lastTime=time;
    powerIn=0;
    powerOut=0;
  }
  boolean redstoneSignal=powerLevel > 0;
  int[] rf=redstoneSignal ? rfOn : rfOff;
  boolean[] inputMode=redstoneSignal ? inputModeOn : inputModeOff;
  int energyStored=getEnergyStored();
  if (energyStored <= 0) {
    return;
  }
  IBlockState state=getWorld().getBlockState(getPos());
  for (  EnumFacing facing : EnumFacing.VALUES) {
    int side=OrientationTools.reorient(facing,state).ordinal();
    if (rf[side] > 0 && !inputMode[side]) {
      TileEntity te=getWorld().getTileEntity(getPos().offset(facing));
      EnumFacing opposite=facing.getOpposite();
      if (EnergyTools.isEnergyTE(te) || (te != null && te.hasCapability(CapabilityEnergy.ENERGY,opposite))) {
        int rfToGive;
        if (rf[side] <= energyStored) {
          rfToGive=rf[side];
        }
 else {
          rfToGive=energyStored;
        }
        int received;
        if (RFTools.redstoneflux && RedstoneFluxCompatibility.isEnergyConnection(te)) {
          if (RedstoneFluxCompatibility.canConnectEnergy(te,opposite)) {
            received=(int)EnergyTools.receiveEnergy(te,opposite,rfToGive);
          }
 else {
            received=0;
          }
        }
 else {
          received=(int)EnergyTools.receiveEnergy(te,opposite,rfToGive);
        }
        powerOut+=received;
        energyStored-=storage.extractEnergy(received,false);
        if (energyStored <= 0) {
          return;
        }
      }
    }
  }
}