// Path: src/main/java/com/vivalux/cyb/Cybernetica.java
// @Mod(modid = CYBModInfo.MOD_ID,
//     name = CYBModInfo.MOD_NAME,
//     guiFactory = CYBModInfo.GUI_FACTORY,
//     version = CYBModInfo.MOD_VERSION)
// public class Cybernetica {
// 	@Instance(CYBModInfo.MOD_ID)
// 	public static Cybernetica instance;
// 
// 	@SidedProxy(clientSide = CYBModInfo.CLIENT_PROXY, serverSide = CYBModInfo.SERVER_PROXY)
// 	public static CYBClientProxy proxy;
// 
//     /**
//      * Run before anything else. Read your config, create blocks, items, etc
//      */
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent e) {
//         //Config should be one of the first things you do
//         FMLCommonHandler.instance().bus().register(new ConfigHandler(e.getSuggestedConfigurationFile()));
// 
//         //proxy.preInit();
// 
//         //Initialize mod-independent objects
// 		CYBBlocks.init();
// 		CYBItems.init();
//         CYBAchievements.init();
// 
//         //PacketHandler.init();
//         ChestGenHandler.init();
// 	}
// 
//     /**
//      * Build whatever data structures you care about and register handlers, tile entities, renderers, and recipes
//      */
// 	@EventHandler
// 	public void init(FMLInitializationEvent e) {
//         //Register recipes here to ensure that all mod items and blocks, including those from other mods, are added
//         CYBRecipes.init();
// 
//         proxy.init();
// 
//         //Minecraft Forge event handlers
//         MinecraftForge.EVENT_BUS.register(new PlayerEventHandler());
// 
//         //FML event handlers
//         FMLCommonHandler.instance().bus().register(new UpdateHandler());
// 
//         //Network handlers
//         NetworkRegistry.INSTANCE.registerGuiHandler(Cybernetica.instance, new GuiHandler());
// 	}
// 
//     /**
//      * Handle interaction with other mods, complete your setup based on this
//      */
// 	@EventHandler
// 	public void postInit(FMLPostInitializationEvent e) {
// 
//         //proxy.postInit();
// 
//         //Inter-mod communications
//         //Register the Waila data provider
//         /*
// 		if (Loader.isModLoaded("Waila")) {
//             FMLInterModComms.sendMessage("Waila", "register", "");
//         }
//         */
// 	}
// }
// 
// Path: src/main/java/com/vivalux/cyb/util/CYBResources.java
// public class CYBResources {
// 	public static final ResourceLocation TEXTURE_GUI_INTEG = getResourceLocation("textures/gui/integrationTable.png");
//     public static final ResourceLocation TEXTURE_GUI_LEXICA = getResourceLocation("textures/gui/lexicaGui.png");
// 
// 	private static ResourceLocation getResourceLocation(String path) {
// 		return new ResourceLocation(CYBModInfo.MOD_ID + ":" + path);
// 	}
// }


import com.vivalux.cyb.Cybernetica;
import com.vivalux.cyb.util.CYBResources;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
package com.vivalux.cyb.client.gui.lexica;



public class GuiLexica extends GuiScreen {
    private final ResourceLocation texture = CYBResources.TEXTURE_GUI_LEXICA;

    private LexicaPage currentPage;

    private int guiWidth = 176, guiHeight = 166;
    private int left = 0, top = 0;

    private double radius = 50, diameter = radius * 2;

    @Override
    public void initGui() {
        refreshDisplay();

        /*
        //TODO finish this once I have a better understanding of openGL
        String[] topics = new String[] {
            "implants", "modules", "blocks", "items"
        };

        for (String topic : topics) {
            buttonList.add(new Tag(idCount++, left, top, 50, 20, topic));
        }

        //must be after all other buttons and tags have been added
        initTags();
        */
    }

    public void refreshDisplay() {
        currentPage = new LexicaPage(Cybernetica.proxy.currentLexicaTopic);

        left = width / 2 - guiWidth / 2;
        top = height / 2 - guiHeight / 2;

        int idCount = 0;
        int offset = 11;
        int buttonHeight = 20;
        int verticalSpacing = 2;
        String[] entries = currentPage.getEntries();
        buttonList.clear();
        for (int i = 0; i < entries.length && entries.length > 1; i++) {
            int x = left + offset + 0;
            int y = top + offset + i * (buttonHeight + verticalSpacing);
            buttonList.add(new GuiButton(idCount, x, y, 50, buttonHeight, entries[i]));
            idCount++;
        }
// Path: src/main/java/com/vivalux/cyb/Cybernetica.java
// @Mod(modid = CYBModInfo.MOD_ID,
//     name = CYBModInfo.MOD_NAME,
//     guiFactory = CYBModInfo.GUI_FACTORY,
//     version = CYBModInfo.MOD_VERSION)
// public class Cybernetica {
// 	@Instance(CYBModInfo.MOD_ID)
// 	public static Cybernetica instance;
// 
// 	@SidedProxy(clientSide = CYBModInfo.CLIENT_PROXY, serverSide = CYBModInfo.SERVER_PROXY)
// 	public static CYBClientProxy proxy;
// 
//     /**
//      * Run before anything else. Read your config, create blocks, items, etc
//      */
// 	@EventHandler
// 	public void preInit(FMLPreInitializationEvent e) {
//         //Config should be one of the first things you do
//         FMLCommonHandler.instance().bus().register(new ConfigHandler(e.getSuggestedConfigurationFile()));
// 
//         //proxy.preInit();
// 
//         //Initialize mod-independent objects
// 		CYBBlocks.init();
// 		CYBItems.init();
//         CYBAchievements.init();
// 
//         //PacketHandler.init();
//         ChestGenHandler.init();
// 	}
// 
//     /**
//      * Build whatever data structures you care about and register handlers, tile entities, renderers, and recipes
//      */
// 	@EventHandler
// 	public void init(FMLInitializationEvent e) {
//         //Register recipes here to ensure that all mod items and blocks, including those from other mods, are added
//         CYBRecipes.init();
// 
//         proxy.init();
// 
//         //Minecraft Forge event handlers
//         MinecraftForge.EVENT_BUS.register(new PlayerEventHandler());
// 
//         //FML event handlers
//         FMLCommonHandler.instance().bus().register(new UpdateHandler());
// 
//         //Network handlers
//         NetworkRegistry.INSTANCE.registerGuiHandler(Cybernetica.instance, new GuiHandler());
// 	}
// 
//     /**
//      * Handle interaction with other mods, complete your setup based on this
//      */
// 	@EventHandler
// 	public void postInit(FMLPostInitializationEvent e) {
// 
//         //proxy.postInit();
// 
//         //Inter-mod communications
//         //Register the Waila data provider
//         /*
// 		if (Loader.isModLoaded("Waila")) {
//             FMLInterModComms.sendMessage("Waila", "register", "");
//         }
//         */
// 	}
// }
// 
// Path: src/main/java/com/vivalux/cyb/util/CYBResources.java
// public class CYBResources {
// 	public static final ResourceLocation TEXTURE_GUI_INTEG = getResourceLocation("textures/gui/integrationTable.png");
//     public static final ResourceLocation TEXTURE_GUI_LEXICA = getResourceLocation("textures/gui/lexicaGui.png");
// 
// 	private static ResourceLocation getResourceLocation(String path) {
// 		return new ResourceLocation(CYBModInfo.MOD_ID + ":" + path);
// 	}
// }


// Path: src/main/java/com/vivalux/cyb/client/gui/lexica/GuiLexica.java
import com.vivalux.cyb.Cybernetica;
import com.vivalux.cyb.util.CYBResources;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

package com.vivalux.cyb.client.gui.lexica;



public class GuiLexica extends GuiScreen {
    private final ResourceLocation texture = CYBResources.TEXTURE_GUI_LEXICA;

    private LexicaPage currentPage;

    private int guiWidth = 176, guiHeight = 166;
    private int left = 0, top = 0;

    private double radius = 50, diameter = radius * 2;

    @Override
    public void initGui() {
        refreshDisplay();

        /*
        //TODO finish this once I have a better understanding of openGL
        String[] topics = new String[] {
            "implants", "modules", "blocks", "items"
        };

        for (String topic : topics) {
            buttonList.add(new Tag(idCount++, left, top, 50, 20, topic));
        }

        //must be after all other buttons and tags have been added
        initTags();
        */
    }

    public void refreshDisplay() {
        currentPage = new LexicaPage(Cybernetica.proxy.currentLexicaTopic);

        left = width / 2 - guiWidth / 2;
        top = height / 2 - guiHeight / 2;

        int idCount = 0;
        int offset = 11;
        int buttonHeight = 20;
        int verticalSpacing = 2;
        String[] entries = currentPage.getEntries();
        buttonList.clear();
        for (int i = 0; i < entries.length && entries.length > 1; i++) {
            int x = left + offset + 0;
            int y = top + offset + i * (buttonHeight + verticalSpacing);
            buttonList.add(new GuiButton(idCount, x, y, 50, buttonHeight, entries[i]));
            idCount++;
        }
        if (!Cybernetica.proxy.currentLexicaTopic.equals("home")) {