private int[][] generateTerrain(int s, double sea, double shore, double forest, double v, long sd){
    	int[][] terrain = new int[s][s];
    	HeightMapGenerator g = new HeightMapGenerator();
    	g.setSize(s, s);
    	g.setVariance(v);
    	g.setSeed(sd);
    	Random r = new Random();
    	r.setSeed(sd);
    	double[][] heightMap = g.generate();
    	map = new BufferedImage(s, s, BufferedImage.TYPE_INT_ARGB);
    	for(int x = 0; x < s; x++)
    		for(int y = 0; y < s; y++){
    			if(heightMap[x][y] <= sea){
    				terrain[x][y] = Static.TERRAIN_WATER;
    				map.setRGB(x, y, -16776961);
    			}
    			else if(heightMap[x][y] <= shore){
    				terrain[x][y] = Static.TERRAIN_SHORE;
    				map.setRGB(x, y, -128);
    			}
    			else if(heightMap[x][y] > shore){
    				terrain[x][y] = Static.TERRAIN_EARTH;
    				map.setRGB(x, y, -16744448);
    			}
    			if(heightMap[x][y] > forest){
    				if(r.nextDouble() > 0.95) Static.world.add(new Tree(x, y));
    			}
    		}
    	Static.ui.setMap(map);
    	return terrain;
    }