Use same skin server as ClassiCube client.

This commit is contained in:
UnknownShadow200 2015-12-05 08:00:17 +11:00
parent 36bd0dfea8
commit dae105edbd
3 changed files with 40 additions and 9 deletions

View File

@ -31,10 +31,10 @@ namespace ClassicalSharp.Generator {
// and add blended results from 4 corners of rectangle. // and add blended results from 4 corners of rectangle.
return Lerp( return Lerp(
v, v,
Lerp( u, Grad( p[AA], x, y, 0 ), Lerp( u, Grad( p[AA], x, y ),
Grad( p[BA], x - 1, y, 0 ) ), Grad( p[BA], x - 1, y ) ),
Lerp( u, Grad( p[AB], x, y - 1, 0 ), Lerp( u, Grad( p[AB], x, y - 1 ),
Grad( p[BB], x - 1, y - 1, 0 ) ) Grad( p[BB], x - 1, y - 1 ) )
); );
} }
@ -46,11 +46,11 @@ namespace ClassicalSharp.Generator {
return a + t * (b - a); return a + t * (b - a);
} }
static double Grad( int hash, double x, double y, double z ) { static double Grad( int hash, double x, double y ) {
// convert low 4 bits of hash code into 12 gradient directions. // convert low 4 bits of hash code into 12 gradient directions.
int h = hash & 15; int h = hash & 15;
double u = h < 8 ? x : y; double u = h < 8 ? x : y;
double v = h < 4 ? y : h == 12 || h == 14 ? x : z; double v = h < 4 ? y : h == 12 || h == 14 ? x : 0;
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
} }

View File

@ -11,9 +11,22 @@ namespace ClassicalSharp.Generator {
int width, height, length; int width, height, length;
int waterLevel; int waterLevel;
byte[] blocks;
short[] heightmap;
public byte[] GenerateMap( int width, int height, int length ) {
this.width = width;
this.height = height;
this.length = length;
waterLevel = height / 2;
blocks = new byte[width * height * length];
short[] CreateHeightmap() { CreateHeightmap();
CreateStrata();
return null;
}
void CreateHeightmap() {
Noise n1 = new CombinedNoise( Noise n1 = new CombinedNoise(
new OctaveNoise( 8 ), new OctaveNoise( 8 ) ); new OctaveNoise( 8 ), new OctaveNoise( 8 ) );
Noise n2 = new CombinedNoise( Noise n2 = new CombinedNoise(
@ -32,7 +45,25 @@ namespace ClassicalSharp.Generator {
map[index++] = (short)(height + waterLevel); map[index++] = (short)(height + waterLevel);
} }
} }
return map; heightmap = map;
}
void CreateStrata() {
Noise n = new OctaveNoise( 8 );
int mapIndex = 0;
for( int z = 0; z < length; z++ ) {
for( int x = 0; x < width; x++ ) {
int dirtThickness = (int)(n.Compute( x, z ) / 24 - 4);
int dirtHeight = heightmap[mapIndex];
int stoneHeight = dirtHeight + dirtThickness;
for( int y = 0; y < height; y++ ) {
}
mapIndex++;
}
}
} }
} }
} }

View File

@ -8,7 +8,7 @@ namespace Launcher2 {
public static class Client { public static class Client {
public static bool Start( ClientStartData data, bool classicubeSkins, ref bool shouldExit ) { public static bool Start( ClientStartData data, bool classicubeSkins, ref bool shouldExit ) {
string skinServer = classicubeSkins ? "http://www.classicube.net/static/skins/" : string skinServer = classicubeSkins ? "http://static.classicube.net/skins/" :
"http://s3.amazonaws.com/MinecraftSkins/"; "http://s3.amazonaws.com/MinecraftSkins/";
string args = data.Username + " " + data.Mppass + " " + string args = data.Username + " " + data.Mppass + " " +
data.Ip + " " + data.Port + " " + skinServer; data.Ip + " " + data.Port + " " + skinServer;