public static void gotoNextLevel(GameStateManager gsm){

		//save world we are currently in
		World cw = (World)gsm.getGameState(gsm.getCurrentState());
		Save.writeWorld(cw, index);
		Save.writePlayerData(cw.getPlayer());

		//get gametime to transfer to the new world and continue counting
		int time = cw.GameTime;

		//set a new world
		gsm.setState(GameStateManager.GAME);

		//increase index to indicate the new world's index
		index++;
		World nw = (World)gsm.getGameState(gsm.getCurrentState());

		//if its a new map
		if(index == maps){
			String s = newMap();
			nw.reloadMap(s);
			maps++;
			generateRandomTree(nw);
			generateRandomOre(nw, Blocks.IRON, 3);
			generateRandomOre(nw, Blocks.ROCK, 10);
			populateEntities(nw, Entity.PIG, 10);
			//set gametime to continue counting
			nw.GameTime = time;

		}else{
			nw.readFromSave(Save.getWorldData(index));
			//set gametime to continue counting
			nw.GameTime = time;
		}

		Save.writeRandomParts();

		for(int i = 0; i < nw.tileMap.getXRows(); i++)
			for(int j = 0; j < nw.tileMap.getYRows(); j++){
				if(nw.tileMap.getBlockID(i, j) == 7)
					nw.getPlayer().setPosition(i*32 + 32+16, j*32);
			}

	}