package itemrender;

import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
import itemrender.client.KeybindRenderInventoryBlock;
import itemrender.client.KeybindToggleRender;
import itemrender.client.RenderTickHandler;
import org.lwjgl.opengl.GLContext;

@Mod(modid = "@MODID@")
public class ItemRenderMod {
    @Mod.Instance("@MODID@")
    public static ItemRenderMod instance;

    public static boolean gl32_enabled = false;

    public static final int DEFAULT_TEXTURE_SIZE = 128;
    public static final int GRID_TEXTURE_SIZE = 32;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        gl32_enabled = GLContext.getCapabilities().OpenGL32;
    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent e) {
        if(gl32_enabled) {
            TickRegistry.registerTickHandler(new RenderTickHandler(), Side.CLIENT);
            KeybindRenderInventoryBlock defaultRender = new KeybindRenderInventoryBlock(DEFAULT_TEXTURE_SIZE, "");
            RenderTickHandler.keybindToRender = defaultRender;
            KeyBindingRegistry.registerKeyBinding(defaultRender);
            KeyBindingRegistry.registerKeyBinding(new KeybindRenderInventoryBlock(GRID_TEXTURE_SIZE, "_grid"));
            KeyBindingRegistry.registerKeyBinding(new KeybindToggleRender());
        }
    }

    @Mod.EventHandler
    public void postInit(FMLPostInitializationEvent e) {
    }
}


@@ -507,24 +507,72 @@
 ickHandler;%0A
+import net.minecraftforge.common.Configuration;%0A
 import org.l
@@ -797,32 +797,37 @@
 nal int DEFAULT_
+MAIN_
 TEXTURE_SIZE = 1
@@ -858,16 +858,24 @@
 nal int 
+DEFAULT_
 GRID_TEX
@@ -891,16 +891,83 @@
  = 32;%0A%0A
+    private int mainTextureSize;%0A    private int gridTextureSize;%0A%0A
     @Mod
@@ -1096,16 +1096,351 @@
 enGL32;%0A
+        Configuration config = new Configuration(e.getSuggestedConfigurationFile());%0A        mainTextureSize = config.get(Configuration.CATEGORY_GENERAL, %22mainTextureSize%22, DEFAULT_MAIN_TEXTURE_SIZE).getInt();%0A        gridTextureSize = config.get(Configuration.CATEGORY_GENERAL, %22gridTextureSize%22, DEFAULT_GRID_TEXTURE_SIZE).getInt();%0A
     %7D%0A%0A 
@@ -1712,28 +1712,23 @@
 ock(
-DEFAULT_TEXTURE_SIZE
+mainTextureSize
 , %22%22
@@ -1941,33 +1941,31 @@
 ryBlock(
-GRID_TEXTURE_SIZE
+gridTextureSize
 , %22_grid

Load texture sizes from config.