Fixed world generator not saving generated values.

This commit is contained in:
Harrison Deng 2020-04-24 22:10:59 -05:00
parent c5e3c08546
commit d0facd268a

View File

@ -51,24 +51,25 @@ public class IslandWorldGenerator {
//Sets the biome.
Biome currentBiome = biomeGenerator.GenerateBiome(chunkX, chunkZ, localX, localZ);
if (currentBiome == null) throw new IllegalStateException("Biome generated was null!");
for (int y = 0; y < maxHeight; y++) {
biomeGrid.setBiome(localX, y, localZ, currentBiome);
}
//get height shader.
int height;
int height = 0;
try {
height = heightShader.getAltitude(worldX, worldZ, currentBiome);
} catch (InvalidAlgorithmParameterException e) {
e.printStackTrace();
height = maxHeight;
}
if (height == 0) throw new IllegalStateException("Height generated was null!");
//set general shape
chunk.setRegion(localX, 0, localZ, localX, height, localZ, Material.STONE);
chunk.setRegion(localX, 0, localZ, localX + 1, height, localZ + 1, Material.STONE);
//set bedrock last
chunk.setRegion(localX, 0, localZ, localX, bedrockHeight, localZ, Material.BEDROCK);
chunk.setRegion(localX, 0, localZ, localX + 1, bedrockHeight, localZ + 1, Material.BEDROCK);
}
}