public void Generate(int seed, int cx, Random random) {
this.seed = seed;
for (int y = 0; y < TerrainHeight; y++) {
// XReihe Durchgehen
for (int x = 0; x < TerrainWidth; x++) {
blocks[y][x] = new Air();
if (y == TerrainHeight)
blocks[y][x] = new Bedrock();
}
}
// for (int y = 0; y < TerrainHeight; y++) {
// XReihe Durchgehen
for (int x = 0; x < TerrainWidth; x++) {
// Sys.alert("Pos", "X:"+x+" Y: "+y +
// " BLocks: "+blocks.length);
/*
* if (y > TerrainHeight - 10+(5*Math.sin(x/seed))) { blocks[y][x] =
* new Dirt(); } if (y == (int)(TerrainHeight
* -10+(5*Math.sin(x/seed)))) {
*
* }
*/
for (int y = TerrainHeight - 2; y > GetTerrainHeight(x + (cx * 16)); y--) {
blocks[y][x] = new Dirt();
}
for (int y = TerrainHeight - 2; y > GetTerrainHeight(x + (cx * 16))
+ 4 + random.nextInt(2); y--) {
if (y >= 0)
blocks[y][x] = new Stone();
}
for (int y = TerrainHeight - 2; y > TerrainHeight - 15; y--) {
if (y >= 0)
if (blocks[y][x].ID() == (new Air()).ID())
blocks[y][x] = new Water();
}
blocks[GetTerrainHeight(x + (cx * 16))][x] = new Gras();
}