package crazypants.enderio.machine.enchanter;

import java.awt.Color;

import org.lwjgl.opengl.GL11;

import crazypants.enderio.EnderIO;
import crazypants.enderio.gui.IconEIO;
import crazypants.enderio.machine.vacuum.ContainerVacuumChest;
import crazypants.render.ColorUtil;
import crazypants.render.RenderUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;

public class GuiEnchanter extends GuiContainer {

  private TileEnchanter te;
  private ContainerEnchanter container;
  
  public GuiEnchanter(EntityPlayer player, InventoryPlayer inventory, TileEnchanter te) {
    super(new ContainerEnchanter(player, inventory, te));
    container = (ContainerEnchanter)inventorySlots;
    this.te = te;
  }
  
  @Override
  protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderUtil.bindTexture("enderio:textures/gui/enchanter.png");
    int sx = (width - xSize) / 2;
    int sy = (height - ySize) / 2;
    drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);
    
    if(EnderIO.proxy.isNeiInstalled()) {
      IconEIO.RECIPE.renderIcon(sx + 155, sy + 8, 16, 16, 0, true);
    }
    
    int curCost = te.getCurrentEnchantmentCost();    
    if(curCost > 0) {
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      
      int col;
      if(container.playerHasEnoughLevels(Minecraft.getMinecraft().thePlayer)) {
        col = 8453920; //all good
      } else {
        col  = 16736352; //not enough levels
        RenderUtil.bindTexture("enderio:textures/gui/enchanter.png");
        drawTexturedModalRect(sx + 99, sy + 33, 176, 0, 28, 21);
      }            
      String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(curCost)});
      drawCenteredString(Minecraft.getMinecraft().fontRenderer, s, sx + xSize/2, sy + 57, col);
    }
  }

}

@@ -51,191 +51,250 @@
 ort 
-java.awt.Color;%0A%0Aimport org.lwjgl.opengl.GL11;%0A%0Aimport crazypants.enderio.EnderIO;%0Aimport crazypants.enderio.gui.IconEIO;%0Aimport crazypants.enderio.machine.vacuum.ContainerVacuumChest
+net.minecraft.client.Minecraft;%0Aimport net.minecraft.client.resources.I18n;%0Aimport net.minecraft.entity.player.EntityPlayer;%0Aimport net.minecraft.entity.player.InventoryPlayer;%0A%0Aimport org.lwjgl.opengl.GL11;%0A%0Aimport crazypants.enderio.EnderIO
 ;%0Aim
@@ -313,24 +313,33 @@
 nts.
-r
 ender
-.ColorUtil
+io.gui.IconButtonEIO
 ;%0Aim
@@ -358,108 +358,51 @@
 nts.
-r
 ender
-.RenderUtil;%0Aimport net.minecraft.client.Minecraft;%0Aimport net.minecraft.clie
+io.gui.IconEIO;%0Aimport crazypa
 nt
+s
 .gui.
-inventory.
 GuiC
@@ -413,153 +413,49 @@
 iner
-;%0Aimport net.minecraft.client.resources.I18n;%0Aimport net.minecraft.entity.player.EntityPlayer;%0Aimport net.minecraft.entity.player.InventoryPlayer
+Base;%0Aimport crazypants.render.RenderUtil
 ;%0A%0Ap
@@ -499,16 +499,20 @@
 ontainer
+Base
  %7B%0A%0A  pr
@@ -575,16 +575,54 @@
 tainer;%0A
+  private IconButtonEIO recipeButton;%0A
   %0A  pub
@@ -834,16 +834,321 @@
 e = te;%0A
+    %0A    recipeButton = new IconButtonEIO(this, 100, 154, 8, IconEIO.RECIPE);%0A    recipeButton.visible = false;%0A    recipeButton.setIconMargin(3, 3);%0A  %7D%0A  %0A  @Override%0A  public void initGui() %7B%0A    super.initGui();%0A    recipeButton.onGuiInit();%0A    recipeButton.visible = EnderIO.proxy.isNeiInstalled();%0A
   %7D%0A  %0A 
@@ -1494,128 +1494,8 @@
    %0A
-    if(EnderIO.proxy.isNeiInstalled()) %7B%0A      IconEIO.RECIPE.renderIcon(sx + 155, sy + 8, 16, 16, 0, true);%0A    %7D%0A    %0A
     
@@ -2165,11 +2165,10 @@
   %7D%0A  %7D%0A
-%0A
 %7D%0A

Fix enchanter GUI