Program: 95746
Project: 95746
Buggy source:
@Override public void updateEntity(){
  if (!this.worldObj.isRemote) {
    ArrayList<TileEntityCustomWood> neighbours=new ArrayList<TileEntityCustomWood>();
    if (this.hasNeighbour('x',1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord + 1,this.yCoord,this.zCoord));
    }
    if (this.hasNeighbour('x',-1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord - 1,this.yCoord,this.zCoord));
    }
    if (this.hasNeighbour('z',1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord,this.yCoord,this.zCoord + 1));
    }
    if (this.hasNeighbour('z',-1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord,this.yCoord,this.zCoord - 1));
    }
    int totalLvl=0;
    int nr=1;
    int updatedLevel=this.getFluidLevel();
    for (    TileEntityCustomWood te : neighbours) {
      if (te instanceof TileEntityChannel) {
        if (!(te instanceof TileEntityValve && ((TileEntityValve)te).isPowered())) {
          totalLvl=totalLvl + ((TileEntityChannel)te).lvl;
          nr++;
        }
      }
 else {
        TileEntityTank tank=(TileEntityTank)te;
        int Y=tank.getYPosition();
        float y_c=16 * Y + getDiscreteScaledFluidHeight();
        float y_t=tank.getFluidY();
        float y1=(float)5 + 16 * Y;
        float y2=(float)12 + 16 * Y;
        int V_tot=tank.getFluidLevel() + this.lvl;
        if (y_c != y_t) {
          if (tank.getFluidY(V_tot) <= y1) {
            updatedLevel=0;
            tank.setFluidLevel(V_tot);
          }
 else           if (tank.getFluidY(V_tot - 500) >= y2) {
            updatedLevel=500;
            tank.setFluidLevel(V_tot - 500);
          }
 else {
            int tankYSize=tank.getYSize();
            int C=tank.getTotalCapacity();
            float enumerator=((float)V_tot) + ((500 * y1) / (y2 - y1) + ((float)2 * C) / ((float)(16 * tankYSize - 2)));
            float denominator=(((float)500) / (y2 - y1) + ((float)C) / ((float)(16 * tankYSize - 2)));
            float y=enumerator / denominator;
            int channelVolume=(int)Math.floor(500 * (y - y1) / (y2 - y1));
            int tankVolume=(int)Math.ceil(C * (y - 2) / (16 * tankYSize - 2));
            updatedLevel=channelVolume;
            tank.setFluidLevel(tankVolume);
          }
        }
      }
    }
    totalLvl=totalLvl + updatedLevel;
    int rest=totalLvl % nr;
    int newLvl=totalLvl / nr;
    if (nr > 1) {
      for (      TileEntityCustomWood te : neighbours) {
        if (te instanceof TileEntityChannel) {
          if (!(te instanceof TileEntityValve && ((TileEntityValve)te).isPowered())) {
            int lvl=rest == 0 ? newLvl : newLvl + 1;
            rest=rest == 0 ? 0 : rest - 1;
            ((TileEntityChannel)te).setFluidLevel(lvl);
          }
        }
      }
    }
    this.setFluidLevel(newLvl + rest);
    this.syncToClient(false);
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  if (!this.worldObj.isRemote) {
    ArrayList<TileEntityCustomWood> neighbours=new ArrayList<TileEntityCustomWood>();
    if (this.hasNeighbour('x',1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord + 1,this.yCoord,this.zCoord));
    }
    if (this.hasNeighbour('x',-1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord - 1,this.yCoord,this.zCoord));
    }
    if (this.hasNeighbour('z',1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord,this.yCoord,this.zCoord + 1));
    }
    if (this.hasNeighbour('z',-1)) {
      neighbours.add((TileEntityCustomWood)this.worldObj.getTileEntity(this.xCoord,this.yCoord,this.zCoord - 1));
    }
    int totalLvl=0;
    int nr=1;
    int updatedLevel=this.getFluidLevel();
    for (    TileEntityCustomWood te : neighbours) {
      if (te instanceof TileEntityChannel) {
        if (!(te instanceof TileEntityValve && ((TileEntityValve)te).isPowered())) {
          totalLvl=totalLvl + ((TileEntityChannel)te).lvl;
          nr++;
        }
      }
 else {
        TileEntityTank tank=(TileEntityTank)te;
        int Y=tank.getYPosition();
        float y_c=16 * Y + getDiscreteScaledFluidHeight();
        float y_t=tank.getFluidY();
        float y1=(float)5 + 16 * Y;
        float y2=(float)12 + 16 * Y;
        int V_tot=tank.getFluidLevel() + this.lvl;
        if (y_c != y_t) {
          if (tank.getFluidY(V_tot) <= y1) {
            updatedLevel=0;
            tank.setFluidLevel(V_tot);
          }
 else           if (tank.getFluidY(V_tot - 500) >= y2) {
            updatedLevel=500;
            tank.setFluidLevel(V_tot - 500);
          }
 else {
            int tankYSize=tank.getYSize();
            int C=tank.getTotalCapacity();
            float enumerator=((float)V_tot) + ((500 * y1) / (y2 - y1) + ((float)2 * C) / ((float)(16 * tankYSize - 2)));
            float denominator=(((float)500) / (y2 - y1) + ((float)C) / ((float)(16 * tankYSize - 2)));
            float y=enumerator / denominator;
            int channelVolume=(int)Math.floor(500 * (y - y1) / (y2 - y1));
            int tankVolume=(int)Math.ceil(C * (y - 2) / (16 * tankYSize - 2));
            updatedLevel=channelVolume;
            tank.setFluidLevel(tankVolume);
          }
        }
      }
    }
    totalLvl=totalLvl + updatedLevel;
    int rest=totalLvl % nr;
    int newLvl=totalLvl / nr;
    if (nr > 1) {
      for (      TileEntityCustomWood te : neighbours) {
        if (te instanceof TileEntityChannel) {
          if (!(te instanceof TileEntityValve && ((TileEntityValve)te).isPowered())) {
            int lvl=rest == 0 ? newLvl : newLvl + 1;
            rest=rest == 0 ? 0 : rest - 1;
            ((TileEntityChannel)te).setFluidLevel(lvl);
          }
        }
      }
    }
    this.setFluidLevel(newLvl + rest);
  }
}