// Path: src/igwmod/IGWMod.java
// @Mod(modid = Constants.MOD_ID, name = "In-Game Wiki Mod")
// public class IGWMod{
//     @SidedProxy(clientSide = "igwmod.ClientProxy", serverSide = "igwmod.ServerProxy")
//     public static IProxy proxy;
// 
//     @Instance(Constants.MOD_ID)
//     public IGWMod instance;
// 
//     /**
//      * This method is used to reject connection when the server has server info available for IGW-mod. Unless the properties.txt explicitly says
//      * it's okay to connect without IGW-Mod, by setting "optional=true".
//      * @param installedMods
//      * @param side
//      * @return
//      */
//     @NetworkCheckHandler
//     public boolean onConnectRequest(Map<String, String> installedMods, Side side){
//         if(side == Side.SERVER || proxy == null) return true;
//         File serverFolder = new File(proxy.getSaveLocation() + File.separator + "igwmod" + File.separator);
//         if(serverFolder.exists() || new File(proxy.getSaveLocation() + File.separator + "igwmodServer" + File.separator).exists()) {//TODO remove legacy
//             String str = proxy.getSaveLocation() + File.separator + "igwmod" + File.separator + "properties.txt";
//             File file = new File(str);
//             if(!file.exists()) {
//                 file = new File(proxy.getSaveLocation() + File.separator + "igwmodServer" + File.separator + "properties.txt");//TODO remove legacy
//             }
//             if(file.exists()) {
//                 try {
//                     FileInputStream stream = new FileInputStream(file);
//                     BufferedReader br = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
//                     List<String> textList = new ArrayList<String>();
//                     String line = br.readLine();
//                     while(line != null) {
//                         textList.add(line);
//                         line = br.readLine();
//                     }
//                     br.close();
// 
//                     if(textList != null) {
//                         for(String s : textList) {
//                             String[] entry = s.split("=");
//                             if(entry[0].equals("optional")) {
//                                 if(Boolean.parseBoolean(entry[1])) return true;
//                             }
//                         }
//                     }
//                 } catch(Exception e) {
//                     e.printStackTrace();
//                 }
//             }
//             String version = installedMods.get(Constants.MOD_ID);
//             if(version.equals("${version}")) return true;
//             return version != null && version.equals(Constants.fullVersionString());
//         } else {
//             return true;
//         }
// 
//     }
// 
//     @EventHandler
//     public void preInit(FMLPreInitializationEvent event){
//         event.getModMetadata().version = Constants.fullVersionString();
//         proxy.preInit(event);
//         NetworkHandler.init();
//     }
// 
//     @EventHandler
//     public void init(FMLInitializationEvent event){
// 
//     }
// 
//     @EventHandler
//     public void postInit(FMLPostInitializationEvent event){
//         proxy.postInit();
//     }
// 
//     @EventHandler
//     public void processIMCRequests(FMLInterModComms.IMCEvent event){
//         proxy.processIMC(event);
//     }
// }
// 
// Path: src/igwmod/TessWrapper.java
// public class TessWrapper{
//     public static void startDrawingTexturedQuads(){
//         Tessellator.getInstance().getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);
//     }
// 
//     public static void addVertexWithUV(double x, double y, double z, double u, double v){
//         Tessellator.getInstance().getBuffer().pos(x, y, z).tex(u, v).endVertex();
//     }
// 
//     public static void draw(){
//         Tessellator.getInstance().draw();
//     }
// }


import igwmod.IGWMod;
import igwmod.TessWrapper;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.resources.IResource;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
package igwmod.gui;






public class LocatedTexture implements IReservedSpace, IWidget{
    public ResourceLocation texture;
    public int x, y, width, height;
    private int textureId;

    public LocatedTexture(ResourceLocation texture, int x, int y, int width, int height){
        this.texture = texture;
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;

        if(texture.getResourcePath().startsWith("server")) {
            try {
// Path: src/igwmod/IGWMod.java
// @Mod(modid = Constants.MOD_ID, name = "In-Game Wiki Mod")
// public class IGWMod{
//     @SidedProxy(clientSide = "igwmod.ClientProxy", serverSide = "igwmod.ServerProxy")
//     public static IProxy proxy;
// 
//     @Instance(Constants.MOD_ID)
//     public IGWMod instance;
// 
//     /**
//      * This method is used to reject connection when the server has server info available for IGW-mod. Unless the properties.txt explicitly says
//      * it's okay to connect without IGW-Mod, by setting "optional=true".
//      * @param installedMods
//      * @param side
//      * @return
//      */
//     @NetworkCheckHandler
//     public boolean onConnectRequest(Map<String, String> installedMods, Side side){
//         if(side == Side.SERVER || proxy == null) return true;
//         File serverFolder = new File(proxy.getSaveLocation() + File.separator + "igwmod" + File.separator);
//         if(serverFolder.exists() || new File(proxy.getSaveLocation() + File.separator + "igwmodServer" + File.separator).exists()) {//TODO remove legacy
//             String str = proxy.getSaveLocation() + File.separator + "igwmod" + File.separator + "properties.txt";
//             File file = new File(str);
//             if(!file.exists()) {
//                 file = new File(proxy.getSaveLocation() + File.separator + "igwmodServer" + File.separator + "properties.txt");//TODO remove legacy
//             }
//             if(file.exists()) {
//                 try {
//                     FileInputStream stream = new FileInputStream(file);
//                     BufferedReader br = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
//                     List<String> textList = new ArrayList<String>();
//                     String line = br.readLine();
//                     while(line != null) {
//                         textList.add(line);
//                         line = br.readLine();
//                     }
//                     br.close();
// 
//                     if(textList != null) {
//                         for(String s : textList) {
//                             String[] entry = s.split("=");
//                             if(entry[0].equals("optional")) {
//                                 if(Boolean.parseBoolean(entry[1])) return true;
//                             }
//                         }
//                     }
//                 } catch(Exception e) {
//                     e.printStackTrace();
//                 }
//             }
//             String version = installedMods.get(Constants.MOD_ID);
//             if(version.equals("${version}")) return true;
//             return version != null && version.equals(Constants.fullVersionString());
//         } else {
//             return true;
//         }
// 
//     }
// 
//     @EventHandler
//     public void preInit(FMLPreInitializationEvent event){
//         event.getModMetadata().version = Constants.fullVersionString();
//         proxy.preInit(event);
//         NetworkHandler.init();
//     }
// 
//     @EventHandler
//     public void init(FMLInitializationEvent event){
// 
//     }
// 
//     @EventHandler
//     public void postInit(FMLPostInitializationEvent event){
//         proxy.postInit();
//     }
// 
//     @EventHandler
//     public void processIMCRequests(FMLInterModComms.IMCEvent event){
//         proxy.processIMC(event);
//     }
// }
// 
// Path: src/igwmod/TessWrapper.java
// public class TessWrapper{
//     public static void startDrawingTexturedQuads(){
//         Tessellator.getInstance().getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);
//     }
// 
//     public static void addVertexWithUV(double x, double y, double z, double u, double v){
//         Tessellator.getInstance().getBuffer().pos(x, y, z).tex(u, v).endVertex();
//     }
// 
//     public static void draw(){
//         Tessellator.getInstance().draw();
//     }
// }


// Path: src/igwmod/gui/LocatedTexture.java
import igwmod.IGWMod;
import igwmod.TessWrapper;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.resources.IResource;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

package igwmod.gui;






public class LocatedTexture implements IReservedSpace, IWidget{
    public ResourceLocation texture;
    public int x, y, width, height;
    private int textureId;

    public LocatedTexture(ResourceLocation texture, int x, int y, int width, int height){
        this.texture = texture;
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;

        if(texture.getResourcePath().startsWith("server")) {
            try {
                BufferedImage image = ImageIO.read(new FileInputStream(new File(IGWMod.proxy.getSaveLocation() + File.separator + "igwmod" + File.separator + texture.getResourcePath().substring(7))));