public void generate() {
        map = new HeightMap(CHUNK_SIZE*4);
        
        map.simplexF = 0.4f;
        map.simplexF2 = 0.4f;

        map.perturbF = 0.0f;
        map.perturbD = 0.0f;
        map.erodeLayers = 20;
        map.erodeF = 0.05f;
        map.smoothenLayers = 5;
        
        map.generate(x,z);
  
        for (int y = 0; y < YMAX; y++) {
            for (int x = 0; x < CHUNK_SIZE; x += 1) {
                for (int z = 0; z < CHUNK_SIZE; z += 1) {
                    
                    float[] points = new float[4];
                    points[0] = (map.heights[x][z]);
                    points[1] = (map.heights[x+1][z]);
                    points[2] = (map.heights[x][z+1]);
                    points[3] = (map.heights[x+1][z+1]);
                    
                    int height = (int)points[0];
                    if (y <= height || y == 0) {
                        int absWater = Math.abs(y - WATER_LEVEL);

                        BlockType type;
                        if (y < 3) {
                            type = BlockType.getType("Bedrock");
                        } else if (absWater <= 5) {
                            type = BlockType.getType("Sand");
                        } else if (absWater <= 7) {
                           type = BlockType.getType("dirt");
                        } else if (absWater <= 15) {
                            type = BlockType.getType("dirt");
                        } else {
                            type = BlockType.getType("stone");
                        }

    
                        
                        Block b = new Block(x,y,z, points, type);
                        b.shape = Block.BlockShape.BOX;
                        blocks.put(new BlockCoord(x,y,z),b);
                    }
                }
            }
        }

//        /* 
//         * Determine which blocks should be slope blocks
//         * and set them as such here.
//         */
//        BlockCoord bcoord = new BlockCoord(0,0,0);
//        for (Block b : blocks.values()) {
//            BlockCoord next;
//            Block nextBlock;
//            bcoord.x = b.x; bcoord.y = b.y; bcoord.z = b.z;
//            
//            next = BlockCoord.getAdjacentBlockCoord(bcoord, Block.BlockSide.TOP);
//            nextBlock = blocks.get(next);
//            
//            if (nextBlock != null && !nextBlock.isAir()) {
//                b.shape = Block.BlockShape.BOX;
//                continue;
//            }
//            
//            if (checkForSlope(bcoord, BlockSide.NORTH)) {
//                b.shape = Block.BlockShape.SLOPE_NORTH;
//                continue;
//            }
//            
//            if (checkForSlope(bcoord, BlockSide.SOUTH)) {
//                b.shape = Block.BlockShape.SLOPE_SOUTH;
//                continue;
//            }
//                        
//            if (checkForSlope(bcoord, BlockSide.EAST)) {
//                b.shape = Block.BlockShape.SLOPE_EAST;
//                continue;
//            }
//            
//            if (checkForSlope(bcoord, BlockSide.WEST)) {
//                b.shape = Block.BlockShape.SLOPE_WEST;
//                continue;
//            }
//            
//            b.shape = Block.BlockShape.BOX;
//        }
        
        
 
    }