Skip to content

Commit

Permalink
SnowPopulator now uses @DDoS' fastNoise function
Browse files Browse the repository at this point in the history
  • Loading branch information
narrowtux committed Aug 15, 2012
1 parent ea3d01c commit 9cb3532
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -35,6 +35,7 @@
import org.spout.api.geo.World;
import org.spout.api.geo.cuboid.Chunk;

import org.spout.vanilla.util.VanillaWorldGeneratorUtil;
import org.spout.vanilla.world.generator.normal.object.SnowObject;
import org.spout.vanilla.world.generator.object.VanillaObjects;

Expand All @@ -55,6 +56,8 @@ public void populate(Chunk chunk, Random random) {
final int seed = (int) chunk.getWorld().getSeed();
SNOW_HEIGHT.setSeed(seed);
SNOW.setRandom(random);

double[][] heights = VanillaWorldGeneratorUtil.fastNoise(SNOW_HEIGHT, 16, 16, 4, chunk.getBlockX(), chunk.getBlockY(), chunk.getBlockZ());
if (chunk.getY() != 4) {
return;
}
Expand All @@ -66,7 +69,7 @@ public void populate(Chunk chunk, Random random) {
if (!SNOW.canPlaceObject(world, x + xx, 63, z + zz)) {
continue;
}
int count = (int) ((SNOW_HEIGHT.GetValue(x + xx + 0.001, 0.123, z + zz + 0.1) + 1.0) * 4.0);
int count = (int) ((heights[xx][zz]+1) * 4.0);
for (int i = 0; i < count; i++) {
SNOW.placeObject(world, x + xx, 0, z + zz);
}
Expand Down

0 comments on commit 9cb3532

Please sign in to comment.