package client.gui.ingame;

import java.util.List;

import client.gui.Gui;
import common.collect.Lists;
import common.dimension.Dimension;

public class GuiCreateDimension extends Gui {
	public static final GuiCreateDimension INSTANCE = new GuiCreateDimension();
	private static final List<Dimension> PRESETS = Lists.newArrayList();
	
//	private static Dimension addPreset(String display, String base, String data) {
//    	Dimension dim = UniverseRegistry.getDimension(base).makeCustomCopy();
//    	TagObject ptag;
//    	try {
//			ptag = TagObject.parse("{" + data + "}");
//		}
//		catch(IllegalArgumentException e) {
//			throw new RuntimeException(e);
//		}
//    	TagObject dtag = new TagObject();
//    	dim.toTags(dtag);
//    	if(ptag.getBool("ClearGenerator")) {
//    		ptag.remove("ClearGenerator");
//    		dtag.remove("FloorBlock");
//    		dtag.remove("CeilingBlock");
//    		dtag.remove("Layers");
//    		dtag.remove("AddBiomes");
//    		dtag.remove("FrostBiomes");
//    		dtag.remove("ColdBiomes");
//    		dtag.remove("MediumBiomes");
//    		dtag.remove("HotBiomes");
//    		dtag.remove("Ores");
//    		dtag.remove("Lakes");
//    		dtag.remove("Liquids");
//	    	dtag.setString("Generator", GeneratorType.FLAT.getName());
//	    	dtag.setString("Replacer", ReplacerType.NONE.getName());
////	    	dtag.setBoolean("MobGen", false);
////	    	dtag.setBoolean("SnowGen", false);
//	    	dtag.setBool("Caves", false);
//	    	dtag.setBool("Ravines", false);
//	    	dtag.setBool("AltCaves", false);
//	    	dtag.setBool("Strongholds", false);
//	    	dtag.setBool("Villages", false);
//	    	dtag.setBool("Mineshafts", false);
//	    	dtag.setBool("Scattered", false);
//	    	dtag.setBool("Fortresses", false);
//	    	dtag.setInt("Dungeons", 0);
//	    	dtag.setInt("BiomeSize", 0);
//	    	dtag.setInt("RiverSize", 4);
//	    	dtag.setInt("SnowRarity", 6);
//	    	dtag.setInt("SeaRarity", 50);
//	    	dtag.setInt("AddRarity", 50);
//	    	dtag.setInt("SeaLevel", 0);
////			dtag.setString("DefaultBiome", Biome.NONE.name.toLowerCase()); // TODO fix everything
//			dtag.setBool("SemiFixed", false);
////			dtag.setString("DefaultWeather", Weather.CLEAR.getName());
//			dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
//			Dimension.writeState(dtag, "FillerBlock", Blocks.air.getState());
//			Dimension.writeState(dtag, "TopBlock", Blocks.air.getState());
//			Dimension.writeState(dtag, "SurfaceBlock", Blocks.air.getState());
//			Dimension.writeState(dtag, "AltBlock1", Blocks.air.getState());
//			Dimension.writeState(dtag, "AltBlock2", Blocks.air.getState());
//			Dimension.writeState(dtag, "LiquidBlock", Blocks.air.getState());
//    		Dimension.writeState(dtag, "CaveFillBlock", Blocks.air.getState());
//    	}
//    	dtag.merge(ptag);
//    	dim.fromTags(dtag);
//    	dim.setDisplay(display);
//		PRESETS.add(dim);
//		return dim;
//    }
//	
//	private static Dimension addPreset(String display, String data) {
//		return addPreset(display, "terra", data);
//	}
	
//	private static Dimension addFlatPreset(String display, Biome biome, boolean populate, State main, Object ... layers) {
//		return addFlatPreset(display, "terra", biome, populate, main, layers);
//	}
//	
//	private static Dimension addFlatPreset(String display, String base, Biome biome, boolean populate, State main, Object ... layers) {
//		Dimension dim = addPreset("Flach - " + display, base, "ClearGenerator:1b" + (populate ? "" : ",NoPopulation:1b"));
////		dim.setBiome(biome); // TODO: populator
//		if(main != null)
//			dim.setFlatGen(main, layers);
//		return dim;
//    }

    static
    {
//    	addPreset("Standard", "");
//    	addPreset("Doppelte Höhe (128)", "BaseSize:17.0,Stretch:24.0,ScaleY:80.0,SeaLevel:127");
//    	addPreset("Große Biome", "BiomeSize:6");
//    	addPreset("Überdreht", "Amplification:2.0");
//        addPreset("Wasserwelt", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:8.0,BDepthWeight:2.0,BDepthOffset:0.5,BScaleWeight:2.0,BScaleOffset:0.375,SeaLevel:511");
//        addPreset("Inselland", "CoordScale:3000.0,HeightScale:6000.0,UpperLmtScale:250.0,Stretch:10.0");
//        addPreset("Favorit des Gräbers", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:5.0,BDepthWeight:2.0,BDepthOffset:1.0,BScaleWeight:4.0,BScaleOffset:1.0");
//        addPreset("Verrückte Berge", "CoordScale:738.41864,HeightScale:157.69133,UpperLmtScale:801.4267,LowerLmtScale:1254.1643,DepthScaleX:374.93652,DepthScaleZ:288.65228,"
//        		+ "ScaleX:1355.9908,ScaleY:745.5343,ScaleZ:1183.464,BaseSize:1.8758626,Stretch:1.7137525,BDepthWeight:1.7553768,BDepthOffset:3.4701107,BScaleOffset:2.535211");
//        addPreset("Trockenheit", "ScaleX:1000.0,ScaleY:3000.0,ScaleZ:1000.0,Stretch:10.0,SeaLevel:20");
//        addPreset("Chaotische Höhlen", "UpperLmtScale:2.0,LowerLmtScale:64.0,SeaLevel:6");
//        addPreset("Viel Glück", "LiquidBlock:lava,SeaLevel:40");
        
//        addFlatPreset("Klassisch", Biome.PLAIN, false, Blocks.dirt.getState(), Blocks.bedrock.getState(), 2, Blocks.dirt.getState(),
//        		Blocks.grass.getState()).enableVillages();
//        
//        addFlatPreset("Abbauwelt", Biome.HILLS, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 230, Blocks.stone.getState(),
//        		5, Blocks.dirt.getState(), Blocks.grass.getState()).enableStrongholds().enableMineshafts().setDungeons(8);
//        
//        addFlatPreset("Wasserwelt", Biome.SEA, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 5, Blocks.stone.getState(),
//        		52, Blocks.dirt.getState(), 5, Blocks.sand.getState(), 90, Blocks.water.getState());
//        
//        addFlatPreset("Oberfläche", Biome.PLAIN, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
//        		3, Blocks.dirt.getState(), Blocks.grass.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages().enableStrongholds().enableMineshafts().setDungeons(8)
//			.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false).addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true);
//        
//        addFlatPreset("Verschneites Königreich", Biome.ICE, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
//        		3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).enableVillages();
//        
//        addFlatPreset("Verschneites Königreich +", Biome.ICE, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
//        		3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages()
//        		.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false);
//        
//        addFlatPreset("Unendliche Grube", Biome.PLAIN, false, Blocks.dirt.getState(), 2, Blocks.cobblestone.getState(), 3, Blocks.dirt.getState(), Blocks.grass.getState())
//        	.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages();
//        
//        addFlatPreset("Wüste", Biome.DESERT, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), 52, Blocks.sandstone.getState())
//        	.enableVillages().enableScattered();
//        
//        addFlatPreset("Sandsteinwelt", Biome.DESERT, false, Blocks.sandstone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(),
//        		52, Blocks.sandstone.getState());
        
//        addPreset("Leer", "ClearGenerator:1b");
//        addPreset("Alpha 1.2", "Strongholds:0b,Villages:0b,MineShafts:0b,Scattered:0b,Generator:simple,Replacer:simple,Ravines:0b,SeaLevel:64,AltBlock2:sand");
    }
	
	private GuiCreateDimension() {
	}

	public void init(int width, int height) {
	}
	
	public String getTitle() {
		return "Neue Dimension erstellen";
	}
}
