// Path: src/main/java/com/creativemd/igcm/IGCMGuiManager.java
// public class IGCMGuiManager extends CustomGuiHandler {
// 	
// 	public static void openConfigGui(EntityPlayer player) {
// 		openConfigGui(player, "root");
// 	}
// 	
// 	public static void openConfigGui(EntityPlayer player, String path) {
// 		NBTTagCompound nbt = new NBTTagCompound();
// 		nbt.setInteger("gui", 0);
// 		nbt.setString("path", path);
// 		GuiHandler.openGui(IGCM.guiID, nbt, player);
// 	}
// 	
// 	public static void openProfileGui(EntityPlayer player) {
// 		NBTTagCompound nbt = new NBTTagCompound();
// 		nbt.setInteger("gui", 1);
// 		nbt.setInteger("index", 0);
// 		GuiHandler.openGui(IGCM.guiID, nbt, player);
// 	}
// 	
// 	@Override
// 	public SubContainer getContainer(EntityPlayer player, NBTTagCompound nbt) {
// 		int gui = nbt.getInteger("gui");
// 		String name = nbt.getString("path");
// 		switch (gui) {
// 		case 0:
// 			return new SubContainerConfigSegment(player, ConfigTab.getSegmentByPath(name));
// 		case 1:
// 			return new SubContainerProfile(player);
// 		case 2:
// 			return new SubContainerAdvancedWorkbench(player);
// 		}
// 		return null;
// 	}
// 	
// 	@Override
// 	@SideOnly(Side.CLIENT)
// 	public SubGui getGui(EntityPlayer player, NBTTagCompound nbt) {
// 		int gui = nbt.getInteger("gui");
// 		String name = nbt.getString("path");
// 		switch (gui) {
// 		case 0:
// 			return new SubGuiConfigSegement(ConfigTab.getSegmentByPath(name));
// 		case 1:
// 			return new SubGuiProfile();
// 		case 2:
// 			return new SubGuiAdvancedWorkbench();
// 		}
// 		return null;
// 	}
// 	
// }


import java.util.ArrayList;
import java.util.List;
import com.creativemd.creativecore.common.gui.container.SubGui;
import com.creativemd.creativecore.common.gui.controls.gui.GuiButton;
import com.creativemd.creativecore.common.gui.controls.gui.GuiComboBox;
import com.creativemd.creativecore.common.gui.controls.gui.GuiLabel;
import com.creativemd.creativecore.common.gui.controls.gui.GuiTextfield;
import com.creativemd.igcm.IGCMGuiManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
		profiles = new ArrayList<>();
		for (int i = 0; i < list.tagCount(); i++) {
			profiles.add(list.getStringTagAt(i));
		}
		this.current = nbt.getString("profile");
		
		controls.clear();
		
		GuiComboBox box = new GuiComboBox("profiles", 5, 5, 100, profiles);
		box.caption = current;
		controls.add(box);
		controls.add(new GuiButton("Remove", 120, 5, 40) {
			@Override
			public void onClicked(int x, int y, int button) {
				GuiComboBox combobox = (GuiComboBox) get("profiles");
				if (combobox.lines.size() > 1) {
					
					combobox.lines.remove(combobox.caption);
					combobox.caption = combobox.lines.get(0);
				}
			}
		});
		controls.add(new GuiTextfield("Name", "", 5, 40, 100, 16));
		controls.add(new GuiButton("Add", 120, 40, 40) {
			@Override
			public void onClicked(int x, int y, int button) {
				GuiTextfield field = (GuiTextfield) get("name");
				if (!field.text.equals("")) {
					GuiComboBox combobox = (GuiComboBox) get("profiles");
					if (!combobox.lines.contains(field.text))
// Path: src/main/java/com/creativemd/igcm/IGCMGuiManager.java
// public class IGCMGuiManager extends CustomGuiHandler {
// 	
// 	public static void openConfigGui(EntityPlayer player) {
// 		openConfigGui(player, "root");
// 	}
// 	
// 	public static void openConfigGui(EntityPlayer player, String path) {
// 		NBTTagCompound nbt = new NBTTagCompound();
// 		nbt.setInteger("gui", 0);
// 		nbt.setString("path", path);
// 		GuiHandler.openGui(IGCM.guiID, nbt, player);
// 	}
// 	
// 	public static void openProfileGui(EntityPlayer player) {
// 		NBTTagCompound nbt = new NBTTagCompound();
// 		nbt.setInteger("gui", 1);
// 		nbt.setInteger("index", 0);
// 		GuiHandler.openGui(IGCM.guiID, nbt, player);
// 	}
// 	
// 	@Override
// 	public SubContainer getContainer(EntityPlayer player, NBTTagCompound nbt) {
// 		int gui = nbt.getInteger("gui");
// 		String name = nbt.getString("path");
// 		switch (gui) {
// 		case 0:
// 			return new SubContainerConfigSegment(player, ConfigTab.getSegmentByPath(name));
// 		case 1:
// 			return new SubContainerProfile(player);
// 		case 2:
// 			return new SubContainerAdvancedWorkbench(player);
// 		}
// 		return null;
// 	}
// 	
// 	@Override
// 	@SideOnly(Side.CLIENT)
// 	public SubGui getGui(EntityPlayer player, NBTTagCompound nbt) {
// 		int gui = nbt.getInteger("gui");
// 		String name = nbt.getString("path");
// 		switch (gui) {
// 		case 0:
// 			return new SubGuiConfigSegement(ConfigTab.getSegmentByPath(name));
// 		case 1:
// 			return new SubGuiProfile();
// 		case 2:
// 			return new SubGuiAdvancedWorkbench();
// 		}
// 		return null;
// 	}
// 	
// }


// Path: src/main/java/com/creativemd/igcm/client/gui/SubGuiProfile.java
import java.util.ArrayList;
import java.util.List;
import com.creativemd.creativecore.common.gui.container.SubGui;
import com.creativemd.creativecore.common.gui.controls.gui.GuiButton;
import com.creativemd.creativecore.common.gui.controls.gui.GuiComboBox;
import com.creativemd.creativecore.common.gui.controls.gui.GuiLabel;
import com.creativemd.creativecore.common.gui.controls.gui.GuiTextfield;
import com.creativemd.igcm.IGCMGuiManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;

		profiles = new ArrayList<>();
		for (int i = 0; i < list.tagCount(); i++) {
			profiles.add(list.getStringTagAt(i));
		}
		this.current = nbt.getString("profile");
		
		controls.clear();
		
		GuiComboBox box = new GuiComboBox("profiles", 5, 5, 100, profiles);
		box.caption = current;
		controls.add(box);
		controls.add(new GuiButton("Remove", 120, 5, 40) {
			@Override
			public void onClicked(int x, int y, int button) {
				GuiComboBox combobox = (GuiComboBox) get("profiles");
				if (combobox.lines.size() > 1) {
					
					combobox.lines.remove(combobox.caption);
					combobox.caption = combobox.lines.get(0);
				}
			}
		});
		controls.add(new GuiTextfield("Name", "", 5, 40, 100, 16));
		controls.add(new GuiButton("Add", 120, 40, 40) {
			@Override
			public void onClicked(int x, int y, int button) {
				GuiTextfield field = (GuiTextfield) get("name");
				if (!field.text.equals("")) {
					GuiComboBox combobox = (GuiComboBox) get("profiles");
					if (!combobox.lines.contains(field.text))
						combobox.lines.add(field.text);