I used the code below. (I only used the top half of the texture). Hope it helps!
BTW horizColor means horizon colour.
import com.threed.jpct.*;
import com.threed.jpct.util.*;
public class SkyTextureEffect implements ITextureEffect
{
public int timeOfDay=0;
boolean isDaylight;
boolean isNight;
public SkyTextureEffect()
{
}
public void init(Texture texture)
{
}
public void apply(int[] dest, int[] src)
{
int seaColor=0x223545;
int skyColorDay=0x5B7590;
int horizColorDay=0x929EA6;
int skyColorDawn=0x344453;
int horizColorDawn=0xD0906D;
int skyColorNight=0x0D1316;
int horizColorNight=0x374657;
int skyColor=0;
int horizColor=0;
if (timeOfDay>=0 && timeOfDay<40)
{
// just after dawn
int percentDaylight=(timeOfDay*100)/40;
skyColor=interpolateColor(skyColorDawn,skyColorDay,percentDaylight);
horizColor=interpolateColor(horizColorDawn,horizColorDay,percentDaylight);
}
else if (timeOfDay>=40 && timeOfDay<2660)
{
// daylight
if (isDaylight) return;
skyColor=skyColorDay;
horizColor=horizColorDay;
isDaylight=true;
isNight=false;
}
else if (timeOfDay>=2660 && timeOfDay<2700)
{
// dusk begins
int percentDaylight=((timeOfDay-2660)*100)/40;
skyColor=interpolateColor(skyColorDay,skyColorDawn,percentDaylight);
horizColor=interpolateColor(horizColorDay,horizColorDawn,percentDaylight);
}
else if (timeOfDay>=2700 && timeOfDay<2740)
{
// dusk ends
int percentDaylight=((timeOfDay-2700)*100)/40;
skyColor=interpolateColor(skyColorDawn,skyColorNight,percentDaylight);
horizColor=interpolateColor(horizColorDawn,horizColorNight,percentDaylight);
}
else if (timeOfDay>=2740 && timeOfDay<3560)
{
// nighttime
if (isNight) return;
skyColor=skyColorNight;
horizColor=horizColorNight;
isNight=true;
isDaylight=false;
}
else if (timeOfDay>=3560)
{
// dawn begins
int percentDaylight=((timeOfDay-3560)*100)/40;
skyColor=interpolateColor(skyColorNight,skyColorDawn,percentDaylight);
horizColor=interpolateColor(horizColorNight,horizColorDawn,percentDaylight);
}
for (int y=0;y<128;y++)
{
int color=skyColor;
if (y>124)
{
color=seaColor;//interpolateColor(horizColor,seaColor,((y-124)*100)/4);
}
else if (y>64)
{
color=interpolateColor(skyColor,horizColor,((y-64)*100)/64);
}
for (int x=0;x<72;x++)
{
dest[y*256+x]=color;
}
}
}
private int interpolateColor(int col1, int col2, int percentage)
{
int r=(col1>>16)&0xff;
int g=(col1>>8)&0xff;
int b=col1&0xff;
r+=((((col2>>16)&0xff)-r)*percentage)/100;
g+=((((col2>>8)&0xff)-g)*percentage)/100;
b+=(((col2&0xff)-b)*percentage)/100;
return (r<<16)|(g<<8)|b;
}
public boolean containsAlpha()
{
return false;
}
}