[WGEN] Different heights problem

Discussion in 'Plugin Development' started by sgt frankieboy, Feb 28, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    sgt frankieboy

    I'm trying to generate a entire world out of sand. But I want to have it to have different heights in some biomes. But now I'm getting this:
    [​IMG]
    [​IMG]

    Is there a way to smooth it?
    Code:
    public byte[] generate(World world, Random random, int chunkX, int chunkZ) {
            byte[] b = new byte[16*16*128];
            Random seed = new Random(world.getSeed());
            SimplexOctaveGenerator gen =  new SimplexOctaveGenerator(seed, 8);
            gen.setScale(1/40.0);
     
           
            for (int x=0; x<16; x++){
                        for (int z=0; z<16; z++){
                            int multiplier = 10;
                            if(world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.DESERT ||
                                    world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.DESERT_HILLS ||
                                    world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.EXTREME_HILLS ||
                                    world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.FOREST_HILLS ||
                                    world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.ICE_MOUNTAINS)
                                multiplier = 16;
                            if(world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.PLAINS ||
                                    world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.ICE_PLAINS ||
                                    world.getBiome(x+chunkX*16, z+chunkZ*16) == Biome.TUNDRA)
                                multiplier = 6;
                           
                            double noise = gen.noise(x+chunkX*16, z+chunkZ*16, 0.5, 0.5)*multiplier;
                            for(int y=0; y<32+noise; y++){
                                if(b[xyzToByte(x,y,z)] ==0)
                                    if(y == 0)
                                        b[xyzToByte(x,y,z)] = (byte)  (Material.BEDROCK).getId();
                                    else
                                        b[xyzToByte(x,y,z)] = (byte)  (Material.SAND).getId();
                            }
                            for(int y=0; y<20; y++)
                            {
                                if(b[xyzToByte(x,y,z)] ==0)
                                    b[xyzToByte(x,y,z)] = (byte)  (Material.STATIONARY_WATER).getId();
                            }
                           
                            b[xyzToByte(x,0,z)] = (byte)  (Material.BEDROCK).getId();
                        }
                    }
     
            return b;
            }
     
  2. You can using direct the biome temparaturs and rainfall
     
Thread Status:
Not open for further replies.

Share This Page