From 772bcf1ee6053c09276b7f7e6d525aa46646261c Mon Sep 17 00:00:00 2001
From: joshiejack <joshjackwildman@gmail.com>
Date: Thu, 16 Oct 2014 05:26:15 +0100
Subject: [PATCH 1/2] Add MineTweaker 3 Integration.

---
 1.7.10 Build Files/build.gradle               |   1 +
 .../AlchemicalWizardry.java                   |   6 +
 .../common/tweaker/Alchemy.java               | 131 ++++++++++++++++
 .../common/tweaker/Binding.java               | 130 ++++++++++++++++
 .../common/tweaker/BloodAltar.java            | 133 ++++++++++++++++
 .../common/tweaker/BloodOrb.java              | 146 ++++++++++++++++++
 .../common/tweaker/MTHelper.java              |  83 ++++++++++
 .../tweaker/MineTweakerIntegration.java       |  18 +++
 8 files changed, 648 insertions(+)
 create mode 100644 1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java
 create mode 100644 1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java
 create mode 100644 1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java
 create mode 100644 1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java
 create mode 100644 1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java
 create mode 100644 1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java

diff --git a/1.7.10 Build Files/build.gradle b/1.7.10 Build Files/build.gradle
index 4264e206..ad91e125 100644
--- a/1.7.10 Build Files/build.gradle	
+++ b/1.7.10 Build Files/build.gradle	
@@ -56,6 +56,7 @@ dependencies {
     compile "codechicken:CodeChickenLib:${config.minecraft_version}-${config.CCLIB_version}:dev"
     compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.ccc_version}:dev"
     compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.NEI_version}:dev"
+    compile files("libs/MineTweaker3-Dev-1.7.10-3.0.9.jar")
 }
 
 
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
index 3ecb2b2f..d24151cf 100644
--- a/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
@@ -28,6 +28,7 @@ import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW;
 import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
 import WayofTime.alchemicalWizardry.common.tileEntity.*;
 import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler;
+import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration;
 import cpw.mods.fml.common.FMLCommonHandler;
 import cpw.mods.fml.common.Loader;
 import cpw.mods.fml.common.Mod;
@@ -847,6 +848,11 @@ public class AlchemicalWizardry
             PamHarvestCompatRegistry.registerPamHandlers();
             System.out.println("Loaded Harvestcraft Handlers!");
         }
+        
+        if(Loader.isModLoaded("MineTweaker3")) {
+            MineTweakerIntegration.register();
+            System.out.println("Loaded MineTweaker 3 Integration");
+        }
 
         BloodMagicConfiguration.loadBlacklist();
     }
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java
new file mode 100644
index 00000000..68ae82e1
--- /dev/null
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Alchemy.java
@@ -0,0 +1,131 @@
+package WayofTime.alchemicalWizardry.common.tweaker;
+
+import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack;
+import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStacks;
+import minetweaker.IUndoableAction;
+import minetweaker.MineTweakerAPI;
+import minetweaker.api.item.IItemStack;
+import net.minecraft.item.ItemStack;
+import stanhebben.zenscript.annotations.ZenClass;
+import stanhebben.zenscript.annotations.ZenMethod;
+import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
+import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
+
+/**
+ * MineTweaker3 Alchemy Recipe Handler by joshie *
+ */
+@ZenClass("mods.bloodmagic.Alchemy")
+public class Alchemy 
+{
+    @ZenMethod
+    public static void addRecipe(IItemStack output, IItemStack[] input, int tier, int lp) {
+        MineTweakerAPI.apply(new Add(new AlchemyRecipe(toStack(output), (int) (((double) lp) / 100), toStacks(input), tier)));
+    }
+
+    private static class Add implements IUndoableAction 
+    {
+        private final AlchemyRecipe recipe;
+        
+        public Add(AlchemyRecipe recipe) 
+        {
+            this.recipe = recipe;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            AlchemyRecipeRegistry.recipes.add(recipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return AlchemyRecipeRegistry.recipes != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            AlchemyRecipeRegistry.recipes.remove(recipe);
+        }
+
+        @Override
+        public String describe() 
+        {
+            return "Adding Alchemy Recipe for " + ((AlchemyRecipe) recipe).getResult().getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Removing Alchemy Recipe for " + ((AlchemyRecipe) recipe).getResult().getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+
+    @ZenMethod
+    public static void removeRecipe(IItemStack output) {
+        MineTweakerAPI.apply(new Remove(toStack(output)));
+    }
+
+    private static class Remove implements IUndoableAction 
+    {
+        private final ItemStack output;
+        private AlchemyRecipe recipe;
+        
+        public Remove(ItemStack output) 
+        {
+            this.output = output;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            for (AlchemyRecipe r : AlchemyRecipeRegistry.recipes) 
+            {
+                if (r.getResult() != null && r.getResult().isItemEqual(output)) 
+                {
+                    recipe = r;
+                    break;
+                }
+            }
+
+            AlchemyRecipeRegistry.recipes.remove(recipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return AlchemyRecipeRegistry.recipes != null && recipe != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            AlchemyRecipeRegistry.recipes.add(recipe);
+        }
+
+        @Override
+        public String describe() 
+        {
+            return "Removing Alchemy Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Restoring Alchemy Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+}
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java
new file mode 100644
index 00000000..5f5eac4f
--- /dev/null
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/Binding.java
@@ -0,0 +1,130 @@
+package WayofTime.alchemicalWizardry.common.tweaker;
+
+import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack;
+import minetweaker.IUndoableAction;
+import minetweaker.MineTweakerAPI;
+import minetweaker.api.item.IItemStack;
+import net.minecraft.item.ItemStack;
+import stanhebben.zenscript.annotations.ZenClass;
+import stanhebben.zenscript.annotations.ZenMethod;
+import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
+import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
+
+/**
+ * MineTweaker3 Binding Recipe Handler by joshie *
+ */
+@ZenClass("mods.bloodmagic.Binding")
+public class Binding 
+{
+    @ZenMethod
+    public static void addRecipe(IItemStack input, IItemStack output) {
+        MineTweakerAPI.apply(new Add(new BindingRecipe(toStack(output), toStack(input))));
+    }
+
+    private static class Add implements IUndoableAction 
+    {
+        private final BindingRecipe recipe;
+        
+        public Add(BindingRecipe recipe) 
+        {
+            this.recipe = recipe;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            BindingRegistry.bindingRecipes.add(recipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return BindingRegistry.bindingRecipes != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            BindingRegistry.bindingRecipes.remove(recipe);
+        }
+
+        @Override
+        public String describe() 
+        {
+            return "Adding Binding Recipe for " + ((BindingRecipe) recipe).getResult().getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Removing Binding Recipe for " + ((BindingRecipe) recipe).getResult().getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+
+    @ZenMethod
+    public static void removeRecipe(IItemStack output) {
+        MineTweakerAPI.apply(new Remove(toStack(output)));
+    }
+
+    private static class Remove implements IUndoableAction 
+    {
+        private final ItemStack output;
+        private BindingRecipe recipe;
+        
+        public Remove(ItemStack output) 
+        {
+            this.output = output;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            for (BindingRecipe r : BindingRegistry.bindingRecipes) 
+            {
+                if (r.getResult() != null && r.getResult().isItemEqual(output)) 
+                {
+                    recipe = r;
+                    break;
+                }
+            }
+
+            BindingRegistry.bindingRecipes.remove(recipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return BindingRegistry.bindingRecipes != null && recipe != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            BindingRegistry.bindingRecipes.add(recipe);
+        }
+
+        @Override
+        public String describe() 
+        {
+            return "Removing Binding Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Restoring Binding Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+}
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java
new file mode 100644
index 00000000..e1b7d3f7
--- /dev/null
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodAltar.java
@@ -0,0 +1,133 @@
+package WayofTime.alchemicalWizardry.common.tweaker;
+
+import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack;
+import minetweaker.IUndoableAction;
+import minetweaker.MineTweakerAPI;
+import minetweaker.api.item.IItemStack;
+import net.minecraft.item.ItemStack;
+import stanhebben.zenscript.annotations.Optional;
+import stanhebben.zenscript.annotations.ZenClass;
+import stanhebben.zenscript.annotations.ZenMethod;
+import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipe;
+import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
+
+/**
+ * MineTweaker3 Blood Altar Recipe Handler by joshie *
+ */
+@ZenClass("mods.bloodmagic.Altar")
+public class BloodAltar 
+{
+    @ZenMethod
+    public static void addRecipe(IItemStack output, IItemStack input, int tier, int lp, @Optional int consume, @Optional int drain) {
+        consume = consume > 0 ? consume : 20;
+        drain = drain > 0 ? drain : 20;
+        MineTweakerAPI.apply(new Add(new AltarRecipe(toStack(output), toStack(input), tier, lp, consume, drain, false)));
+    }
+
+    private static class Add implements IUndoableAction 
+    {
+        private final AltarRecipe recipe;
+        
+        public Add(AltarRecipe recipe) 
+        {
+            this.recipe = recipe;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            AltarRecipeRegistry.altarRecipes.add(recipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return AltarRecipeRegistry.altarRecipes != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            AltarRecipeRegistry.altarRecipes.remove(recipe);
+        }
+
+        @Override
+        public String describe() 
+        {
+            return "Adding Blood Altar Recipe for " + ((AltarRecipe) recipe).getResult().getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Removing Blood Altar Recipe for " + ((AltarRecipe) recipe).getResult().getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+
+    @ZenMethod
+    public static void removeRecipe(IItemStack output) {
+        MineTweakerAPI.apply(new Remove(toStack(output)));
+    }
+
+    private static class Remove implements IUndoableAction 
+    {
+        private final ItemStack output;
+        private AltarRecipe recipe;
+        
+        public Remove(ItemStack output) 
+        {
+            this.output = output;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            for (AltarRecipe r : AltarRecipeRegistry.altarRecipes) 
+            {
+                if (r.getResult() != null && r.getResult().isItemEqual(output)) 
+                {
+                    recipe = r;
+                    break;
+                }
+            }
+
+            AltarRecipeRegistry.altarRecipes.remove(recipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return AltarRecipeRegistry.altarRecipes != null && recipe != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            AltarRecipeRegistry.altarRecipes.add(recipe);
+        }
+
+        @Override
+        public String describe() 
+        {
+            return "Removing Blood Altar Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Restoring Blood Altar Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+}
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java
new file mode 100644
index 00000000..7ae8586d
--- /dev/null
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/BloodOrb.java
@@ -0,0 +1,146 @@
+package WayofTime.alchemicalWizardry.common.tweaker;
+
+import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toObjects;
+import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toShapedObjects;
+import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack;
+
+import java.util.List;
+
+import minetweaker.IUndoableAction;
+import minetweaker.MineTweakerAPI;
+import minetweaker.api.item.IIngredient;
+import minetweaker.api.item.IItemStack;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
+import net.minecraft.item.crafting.IRecipe;
+import stanhebben.zenscript.annotations.ZenClass;
+import stanhebben.zenscript.annotations.ZenMethod;
+import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
+
+/**
+ * MineTweaker3 Blood Orb Recipe Handler by joshie *
+ */
+@ZenClass("mods.bloodmagic.BloodOrb")
+public class BloodOrb 
+{
+    @ZenMethod
+    public static void addShaped(IItemStack output, IIngredient[][] ingredients) 
+    {
+        MineTweakerAPI.apply(new Add(false, toStack(output), toShapedObjects(ingredients)));
+    }
+
+    @ZenMethod
+    public static void addShapeless(IItemStack output, IIngredient[] ingredients) 
+    {
+        MineTweakerAPI.apply(new Add(true, toStack(output), toObjects(ingredients)));
+    }
+
+    private static class Add implements IUndoableAction {
+        private IRecipe iRecipe;
+        private final boolean isShapeless;
+        private final ItemStack output;
+        private final Object[] recipe;
+        
+        public Add(boolean isShapeless, ItemStack output, Object... recipe) 
+        {
+            this.isShapeless = isShapeless;
+            this.output = output;
+            this.recipe = recipe;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            if (isShapeless) iRecipe = new ShapedBloodOrbRecipe(output, recipe);
+            else iRecipe = new ShapedBloodOrbRecipe(output, recipe);
+            CraftingManager.getInstance().getRecipeList().add(iRecipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return CraftingManager.getInstance().getRecipeList() != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            CraftingManager.getInstance().getRecipeList().remove(iRecipe);
+        }
+
+        @Override
+        public String describe() {
+            return "Adding Blood Orb Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Removing Blood Orb Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+
+    @ZenMethod
+    public static void removeRecipe(IItemStack output) {
+        MineTweakerAPI.apply(new Remove(toStack(output)));
+    }
+
+    private static class Remove implements IUndoableAction {
+        private final ItemStack output;
+        private IRecipe iRecipe;
+        
+        public Remove(ItemStack output) 
+        {
+            this.output = output;
+        }
+        
+        @Override
+        public void apply() 
+        {
+            for (IRecipe r : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) 
+            {
+                if(r.getRecipeOutput() != null && r.getRecipeOutput().isItemEqual(output)) {
+                    iRecipe = r;
+                    break;
+                }
+            }
+            
+            CraftingManager.getInstance().getRecipeList().remove(iRecipe);
+        }
+
+        @Override
+        public boolean canUndo() 
+        {
+            return CraftingManager.getInstance().getRecipeList() != null && iRecipe != null;
+        }
+
+        @Override
+        public void undo() 
+        {
+            CraftingManager.getInstance().getRecipeList().add(iRecipe);
+        }
+
+        @Override
+        public String describe() {
+            return "Removing Blood Orb Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public String describeUndo() 
+        {
+            return "Restoring Blood Orb Recipe for " + output.getDisplayName();
+        }
+
+        @Override
+        public Object getOverrideKey() 
+        {
+            return null;
+        }
+    }
+}
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java
new file mode 100644
index 00000000..0b49a0cb
--- /dev/null
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MTHelper.java
@@ -0,0 +1,83 @@
+package WayofTime.alchemicalWizardry.common.tweaker;
+
+import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
+
+import java.util.ArrayList;
+
+import stanhebben.zenscript.annotations.ZenClass;
+import minetweaker.api.item.IIngredient;
+import minetweaker.api.item.IItemStack;
+import minetweaker.api.oredict.IOreDictEntry;
+import net.minecraft.item.ItemStack;
+
+/**
+ * MineTweaker3 Helper by joshie *
+ */
+public class MTHelper {
+    public static ItemStack toStack(IItemStack iStack) {
+        return getItemStack(iStack);
+    }
+
+    public static ItemStack[] toStacks(IItemStack[] iStack) {
+        if (iStack == null) return null;
+        else {
+            ItemStack[] output = new ItemStack[iStack.length];
+            for (int i = 0; i < iStack.length; i++) {
+                output[i] = toStack(iStack[i]);
+            }
+
+            return output;
+        }
+    }
+
+    public static Object toObject(IIngredient iStack) {
+        if (iStack == null) return null;
+        else {
+            if (iStack instanceof IOreDictEntry) {
+                return toString((IOreDictEntry) iStack);
+            } else if (iStack instanceof IItemStack) {
+                return getItemStack((IItemStack) iStack);
+            } else return null;
+        }
+    }
+
+    public static Object[] toObjects(IIngredient[] ingredient) {
+        if (ingredient == null) return null;
+        else {
+            Object[] output = new Object[ingredient.length];
+            for (int i = 0; i < ingredient.length; i++) {
+                if (ingredient[i] != null) {
+                    output[i] = toObject(ingredient[i]);
+                } else output[i] = "";
+            }
+
+            return output;
+        }
+    }
+
+    public static Object[] toShapedObjects(IIngredient[][] ingredients) {
+        if (ingredients == null) return null;
+        else {
+            ArrayList prep = new ArrayList();
+            prep.add("abc");
+            prep.add("def");
+            prep.add("ghi");
+            char[][] map = new char[][] { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
+            for (int x = 0; x < ingredients.length; x++) {
+                if (ingredients[x] != null) {
+                    for (int y = 0; y < ingredients[x].length; y++) {
+                        if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
+                            prep.add(map[x][y]);
+                            prep.add(toObject(ingredients[x][y]));
+                        }
+                    }
+                }
+            }
+            return prep.toArray();
+        }
+    }
+
+    public static String toString(IOreDictEntry entry) {
+        return ((IOreDictEntry) entry).getName();
+    }
+}
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java
new file mode 100644
index 00000000..7fb72766
--- /dev/null
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tweaker/MineTweakerIntegration.java
@@ -0,0 +1,18 @@
+package WayofTime.alchemicalWizardry.common.tweaker;
+
+import stanhebben.zenscript.annotations.ZenClass;
+import minetweaker.MineTweakerAPI;
+
+/**
+ * MineTweaker3 Integration by joshie *
+ */
+public class MineTweakerIntegration 
+{
+    public static void register() 
+    {
+        MineTweakerAPI.registerClass(Alchemy.class);
+        MineTweakerAPI.registerClass(Binding.class);
+        MineTweakerAPI.registerClass(BloodAltar.class);
+        MineTweakerAPI.registerClass(BloodOrb.class);
+    }
+}

From d0e974ddefa03ca1a78bd325c4a0aa6a33093674 Mon Sep 17 00:00:00 2001
From: joshiejack <joshjackwildman@gmail.com>
Date: Thu, 16 Oct 2014 05:27:37 +0100
Subject: [PATCH 2/2] Fix @WayofTime using the shaped/shapeless in the joshie
 folder, when he should be using the ones in the api folder. Repackage the NEI
 stuff to the main folder, I was being egotistical. Also Includes @Tonius
 changes for adding a recipe button to the alchemical chemistry set for the
 nei handler. And adds some checks, to the recipes, as sometimes they crash
 when adding/removing any.

---
 .../AlchemicalWizardry.java                   |   4 +-
 .../client/nei/NEIAlchemyRecipeHandler.java   | 179 ++++++++++++++
 .../client}/nei/NEIAltarRecipeHandler.java    |  15 +-
 .../client}/nei/NEIBloodOrbShapedHandler.java |  14 +-
 .../nei/NEIBloodOrbShapelessHandler.java      |  16 +-
 .../client}/nei/NEIConfig.java                |   4 +-
 .../ShapedBloodOrbRecipe.java                 | 227 ------------------
 .../ShapelessBloodOrbRecipe.java              | 140 -----------
 .../nei/NEIAlchemyRecipeHandler.java          | 154 ------------
 9 files changed, 208 insertions(+), 545 deletions(-)
 create mode 100644 1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java
 rename 1.7.10/main/java/{joshie/alchemicalWizardy => WayofTime/alchemicalWizardry/client}/nei/NEIAltarRecipeHandler.java (91%)
 rename 1.7.10/main/java/{joshie/alchemicalWizardy => WayofTime/alchemicalWizardry/client}/nei/NEIBloodOrbShapedHandler.java (92%)
 rename 1.7.10/main/java/{joshie/alchemicalWizardy => WayofTime/alchemicalWizardry/client}/nei/NEIBloodOrbShapelessHandler.java (90%)
 rename 1.7.10/main/java/{joshie/alchemicalWizardy => WayofTime/alchemicalWizardry/client}/nei/NEIConfig.java (93%)
 delete mode 100644 1.7.10/main/java/joshie/alchemicalWizardy/ShapedBloodOrbRecipe.java
 delete mode 100644 1.7.10/main/java/joshie/alchemicalWizardy/ShapelessBloodOrbRecipe.java
 delete mode 100644 1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIAlchemyRecipeHandler.java

diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
index d24151cf..abff05cc 100644
--- a/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java
@@ -6,6 +6,8 @@ import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
 import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
 import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
 import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry;
+import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
+import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
 import WayofTime.alchemicalWizardry.api.rituals.Rituals;
 import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
 import WayofTime.alchemicalWizardry.common.*;
@@ -41,8 +43,6 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
 import cpw.mods.fml.common.network.NetworkRegistry;
 import cpw.mods.fml.common.registry.EntityRegistry;
 import cpw.mods.fml.common.registry.GameRegistry;
-import joshie.alchemicalWizardy.ShapedBloodOrbRecipe;
-import joshie.alchemicalWizardy.ShapelessBloodOrbRecipe;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.init.Blocks;
 import net.minecraft.init.Items;
diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java
new file mode 100644
index 00000000..72dd1b8a
--- /dev/null
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAlchemyRecipeHandler.java
@@ -0,0 +1,179 @@
+package WayofTime.alchemicalWizardry.client.nei;
+
+import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
+
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
+import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
+import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
+import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiWritingTable;
+import codechicken.nei.ItemList;
+import codechicken.nei.NEIServerUtils;
+import codechicken.nei.PositionedStack;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+
+/**
+ * NEI Alchemy Recipe Handler by joshie *
+ */
+public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
+    public class CachedAlchemyRecipe extends CachedRecipe {
+        public class BloodOrbs {
+            public PositionedStack stack;
+
+            public BloodOrbs(ItemStack orb) {
+                this.stack = new PositionedStack(orb, 136, 47, false);
+            }
+        }
+
+        ArrayList<BloodOrbs> orbs;
+        PositionedStack output;
+        List<PositionedStack> inputs;
+        int lp;
+
+        public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
+            this(recipe);
+            this.orbs = new ArrayList<BloodOrbs>();
+            orbs.add(new BloodOrbs(orb));
+        }
+
+        public CachedAlchemyRecipe(AlchemyRecipe recipe) {
+            List<PositionedStack> inputs = new ArrayList<PositionedStack>();
+            ItemStack[] stacks = recipe.getRecipe();
+            if (stacks.length > 0) inputs.add(new PositionedStack(stacks[0], 76, 3));
+            if (stacks.length > 1) inputs.add(new PositionedStack(stacks[1], 51, 19));
+            if (stacks.length > 2) inputs.add(new PositionedStack(stacks[2], 101, 19));
+            if (stacks.length > 3) inputs.add(new PositionedStack(stacks[3], 64, 47));
+            if (stacks.length > 4) inputs.add(new PositionedStack(stacks[4], 88, 47));
+            this.inputs = inputs;
+            this.output = new PositionedStack(recipe.getResult(), 76, 25);
+            this.lp = recipe.getAmountNeeded() * 100;
+            this.orbs = new ArrayList<BloodOrbs>();
+            for (Item orb : bloodOrbs) {
+                if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
+                    orbs.add(new BloodOrbs(new ItemStack(orb)));
+                }
+            }
+        }
+
+        @Override
+        public List<PositionedStack> getIngredients() {
+            return inputs;
+        }
+
+        @Override
+        public PositionedStack getResult() {
+            return output;
+        }
+
+        @Override
+        public PositionedStack getOtherStack() {
+            if (orbs == null || orbs.size() <= 0) return null;
+            return orbs.get((cycleticks / 48) % orbs.size()).stack;
+        }
+    }
+
+    @Override
+    public TemplateRecipeHandler newInstance() {
+        for (ItemStack item : ItemList.items) {
+            if (item != null && item.getItem() instanceof IBloodOrb) {
+                bloodOrbs.add(item.getItem());
+            }
+        }
+
+        return super.newInstance();
+    }
+
+    @Override
+    public String getOverlayIdentifier() {
+        return "alchemicalwizardry.alchemy";
+    }
+
+    @Override
+    public void loadTransferRects() {
+        transferRects.add(new RecipeTransferRect(new Rectangle(134, 22, 16, 24), "alchemicalwizardry.alchemy"));
+    }
+
+    @Override
+    public Class<? extends GuiContainer> getGuiClass() {
+        return GuiWritingTable.class;
+    }
+
+    @Override
+    public void loadCraftingRecipes(String outputId, Object... results) {
+        if (outputId.equals("alchemicalwizardry.alchemy") && getClass() == NEIAlchemyRecipeHandler.class) {
+            for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
+                if (recipe.getResult() != null) arecipes.add(new CachedAlchemyRecipe(recipe));
+            }
+        } else {
+            super.loadCraftingRecipes(outputId, results);
+        }
+    }
+
+    @Override
+    public void loadCraftingRecipes(ItemStack result) {
+        for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
+            if (recipe == null) continue;
+            ItemStack output = recipe.getResult();
+            if (NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) {
+                arecipes.add(new CachedAlchemyRecipe(recipe));
+            }
+        }
+    }
+
+    @Override
+    public void loadUsageRecipes(ItemStack ingredient) {
+        if (ingredient.getItem() instanceof IBloodOrb) {
+            for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
+                if (recipe == null) continue;
+                if (((IBloodOrb) ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
+                    arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
+                }
+            }
+        } else {
+            for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
+                if (recipe == null) continue;
+                ItemStack[] stacks = recipe.getRecipe();
+                for (ItemStack stack : stacks) {
+                    if (NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
+                        arecipes.add(new CachedAlchemyRecipe(recipe));
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void drawExtras(int id) {
+        CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
+        Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
+    }
+
+    public int getLPX(int lp) {
+        if (lp < 10) return 122;
+        else if (lp < 100) return 122;
+        else if (lp < 1000) return 130;
+        else if (lp < 10000) return 127;
+        else if (lp < 100000) return 124;
+        return 122;
+    }
+
+    @Override
+    public String getRecipeName() {
+        return StatCollector.translateToLocal("tile.blockWritingTable.name");
+    }
+
+    @Override
+    public String getGuiTexture() {
+        return new ResourceLocation("alchemicalwizardry", "gui/nei/alchemy.png").toString();
+    }
+}
diff --git a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIAltarRecipeHandler.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAltarRecipeHandler.java
similarity index 91%
rename from 1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIAltarRecipeHandler.java
rename to 1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAltarRecipeHandler.java
index 38b97903..372d8ad1 100644
--- a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIAltarRecipeHandler.java
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIAltarRecipeHandler.java
@@ -1,4 +1,4 @@
-package joshie.alchemicalWizardy.nei;
+package WayofTime.alchemicalWizardry.client.nei;
 
 import java.awt.Dimension;
 import java.awt.Point;
@@ -21,6 +21,9 @@ import codechicken.nei.PositionedStack;
 import codechicken.nei.recipe.GuiRecipe;
 import codechicken.nei.recipe.TemplateRecipeHandler;
 
+/**
+ * NEI Altar Recipe Handler by joshie *
+ */
 public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
 	public class CachedAltarRecipe extends CachedRecipe {
 		PositionedStack input;
@@ -49,9 +52,9 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
 	
 	@Override
 	public void loadCraftingRecipes(String outputId, Object... results) {
-		if (outputId.equals("altarrecipes") && getClass() == NEIAltarRecipeHandler.class) {
+		if (outputId.equals("alchemicalwizardry.altar") && getClass() == NEIAltarRecipeHandler.class) {
 			for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
-				if(recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
+				if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
 			}
 		} else {
 			super.loadCraftingRecipes(outputId, results);
@@ -62,7 +65,7 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
 	public void loadCraftingRecipes(ItemStack result) {
 		for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
 			if(NEIServerUtils.areStacksSameTypeCrafting(recipe.result, result)) {
-				if(recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
+				if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
 			}
 		}
 	}
@@ -71,7 +74,7 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
     public void loadUsageRecipes(ItemStack ingredient)  {
 		for(AltarRecipe recipe: AltarRecipeRegistry.altarRecipes) {
 			if(NEIServerUtils.areStacksSameTypeCrafting(recipe.requiredItem, ingredient)) {
-				if(recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
+				if(recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
 			}
 		}
     }
@@ -150,7 +153,7 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
 	
 	@Override
 	public void loadTransferRects() {
-		transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "altarrecipes"));
+		transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.altar"));
 	}
 	
 	@Override
diff --git a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIBloodOrbShapedHandler.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapedHandler.java
similarity index 92%
rename from 1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIBloodOrbShapedHandler.java
rename to 1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapedHandler.java
index fafac295..4f89f30d 100644
--- a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIBloodOrbShapedHandler.java
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapedHandler.java
@@ -1,21 +1,23 @@
-package joshie.alchemicalWizardy.nei;
+package WayofTime.alchemicalWizardry.client.nei;
 
 import java.awt.Rectangle;
 import java.util.ArrayList;
 import java.util.List;
 
-import joshie.alchemicalWizardy.ShapedBloodOrbRecipe;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.crafting.CraftingManager;
 import net.minecraft.item.crafting.IRecipe;
 import net.minecraft.util.StatCollector;
+import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
 import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
 import codechicken.nei.NEIServerUtils;
 import codechicken.nei.PositionedStack;
 import codechicken.nei.recipe.ShapedRecipeHandler;
 
-/** Extended from the default recipe handler **/
+/**
+ * NEI Blood Orb Shaped Recipe Handler by joshie *
+ */
 public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
 	public class CachedBloodOrbRecipe extends CachedShapedRecipe {
 		public CachedBloodOrbRecipe(int width, int height, Object[] items, ItemStack out) {
@@ -53,7 +55,7 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
 
 	@Override
 	public void loadCraftingRecipes(String outputId, Object... results) {
-		if (outputId.equals("orbCrafting") && getClass() == NEIBloodOrbShapedHandler.class) {
+		if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
 			for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
 				if (irecipe instanceof ShapedBloodOrbRecipe) {
 					CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
@@ -124,12 +126,12 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
 	
 	@Override
     public void loadTransferRects() {
-        transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "orbCrafting"));
+        transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
     }
 
 	@Override
 	public String getOverlayIdentifier() {
-		return "orbCrafting";
+		return "crafting";
 	}
 
 	@Override
diff --git a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIBloodOrbShapelessHandler.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapelessHandler.java
similarity index 90%
rename from 1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIBloodOrbShapelessHandler.java
rename to 1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapelessHandler.java
index a82a6b35..ea773e7a 100644
--- a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIBloodOrbShapelessHandler.java
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIBloodOrbShapelessHandler.java
@@ -1,23 +1,23 @@
-package joshie.alchemicalWizardy.nei;
+package WayofTime.alchemicalWizardry.client.nei;
 
 import java.awt.Rectangle;
 import java.util.ArrayList;
 import java.util.List;
 
-import joshie.alchemicalWizardy.ShapelessBloodOrbRecipe;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.item.crafting.CraftingManager;
 import net.minecraft.item.crafting.IRecipe;
-import net.minecraft.item.crafting.ShapelessRecipes;
 import net.minecraft.util.StatCollector;
-import net.minecraftforge.oredict.ShapelessOreRecipe;
+import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
 import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
 import codechicken.nei.NEIServerUtils;
 import codechicken.nei.PositionedStack;
 import codechicken.nei.recipe.ShapelessRecipeHandler;
-import codechicken.nei.recipe.ShapelessRecipeHandler.CachedShapelessRecipe;
 
+/**
+ * NEI Blood Orb Shapeless Recipe Handler by joshie *
+ */
 public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
 	public class CachedBloodOrbRecipe extends CachedShapelessRecipe {
 		public CachedBloodOrbRecipe(ArrayList<Object> items, ItemStack recipeOutput) {
@@ -51,7 +51,7 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
 	
 	@Override
     public void loadCraftingRecipes(String outputId, Object... results) {
-        if (outputId.equals("orbCrafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
+        if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
             List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
             for (IRecipe irecipe : allrecipes) {
             	CachedBloodOrbRecipe recipe = null;
@@ -115,12 +115,12 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
 	
 	@Override
     public void loadTransferRects() {
-        transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "orbCrafting"));
+        transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
     }
 
 	@Override
 	public String getOverlayIdentifier() {
-		return "orbCrafting";
+		return "crafting";
 	}
 
 	@Override
diff --git a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIConfig.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIConfig.java
similarity index 93%
rename from 1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIConfig.java
rename to 1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIConfig.java
index 90703207..5e1e4d55 100644
--- a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIConfig.java
+++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/nei/NEIConfig.java
@@ -1,4 +1,4 @@
-package joshie.alchemicalWizardy.nei;
+package WayofTime.alchemicalWizardry.client.nei;
 
 import java.util.ArrayList;
 
@@ -28,6 +28,6 @@ public class NEIConfig implements IConfigureNEI {
 
 	@Override
 	public String getVersion() {
-		return "1.2";
+		return "1.3";
 	}
 }
diff --git a/1.7.10/main/java/joshie/alchemicalWizardy/ShapedBloodOrbRecipe.java b/1.7.10/main/java/joshie/alchemicalWizardy/ShapedBloodOrbRecipe.java
deleted file mode 100644
index f508fe6a..00000000
--- a/1.7.10/main/java/joshie/alchemicalWizardy/ShapedBloodOrbRecipe.java
+++ /dev/null
@@ -1,227 +0,0 @@
-package joshie.alchemicalWizardy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import net.minecraft.block.Block;
-import net.minecraft.inventory.InventoryCrafting;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.IRecipe;
-import net.minecraft.item.crafting.ShapedRecipes;
-import net.minecraft.world.World;
-import net.minecraftforge.oredict.OreDictionary;
-import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
-
-/** Shaped Blood Orb Recipe Handler by joshie **/
-public class ShapedBloodOrbRecipe implements IRecipe {		
-	private static final int MAX_CRAFT_GRID_WIDTH = 3;
-	private static final int MAX_CRAFT_GRID_HEIGHT = 3;
-
-	private ItemStack output = null;
-	private Object[] input = null;
-	public int width = 0;
-	public int height = 0;
-	private boolean mirrored = true;
-
-	public ShapedBloodOrbRecipe(Block result, Object... recipe) {
-		this(new ItemStack(result), recipe);
-	}
-
-	public ShapedBloodOrbRecipe(Item result, Object... recipe) {
-		this(new ItemStack(result), recipe);
-	}
-
-	public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) {
-		output = result.copy();
-
-		String shape = "";
-		int idx = 0;
-
-		if (recipe[idx] instanceof Boolean) {
-			mirrored = (Boolean) recipe[idx];
-			if (recipe[idx + 1] instanceof Object[]) {
-				recipe = (Object[]) recipe[idx + 1];
-			} else {
-				idx = 1;
-			}
-		}
-
-		if (recipe[idx] instanceof String[]) {
-			String[] parts = ((String[]) recipe[idx++]);
-
-			for (String s : parts) {
-				width = s.length();
-				shape += s;
-			}
-
-			height = parts.length;
-		} else {
-			while (recipe[idx] instanceof String) {
-				String s = (String) recipe[idx++];
-				shape += s;
-				width = s.length();
-				height++;
-			}
-		}
-
-		if (width * height != shape.length()) {
-			String ret = "Invalid shaped ore recipe: ";
-			for (Object tmp : recipe) {
-				ret += tmp + ", ";
-			}
-			ret += output;
-			throw new RuntimeException(ret);
-		}
-
-		HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
-
-		for (; idx < recipe.length; idx += 2) {
-			Character chr = (Character) recipe[idx];
-			Object in = recipe[idx + 1];
-
-			if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack)in).getItem() instanceof IBloodOrb)) { //If the item is an instanceof IBloodOrb then save the level of the orb
-				if(in instanceof ItemStack) itemMap.put(chr, (Integer)(((IBloodOrb)((ItemStack)in).getItem()).getOrbLevel()));
-				else itemMap.put(chr, (Integer)(((IBloodOrb)in).getOrbLevel()));
-			} else if (in instanceof ItemStack) {
-				itemMap.put(chr, ((ItemStack) in).copy());
-			} else if (in instanceof Item) {
-				itemMap.put(chr, new ItemStack((Item) in));
-			} else if (in instanceof Block) {
-				itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
-			} else if (in instanceof String) {
-				itemMap.put(chr, OreDictionary.getOres((String) in));
-			} else {
-				String ret = "Invalid shaped ore recipe: ";
-				for (Object tmp : recipe) {
-					ret += tmp + ", ";
-				}
-				ret += output;
-				throw new RuntimeException(ret);
-			}
-		}
-
-		input = new Object[width * height];
-		int x = 0;
-		for (char chr : shape.toCharArray()) {
-			input[x++] = itemMap.get(chr);
-		}
-	}
-
-	ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements) {
-		output = recipe.getRecipeOutput();
-		width = recipe.recipeWidth;
-		height = recipe.recipeHeight;
-
-		input = new Object[recipe.recipeItems.length];
-
-		for (int i = 0; i < input.length; i++) {
-			ItemStack ingred = recipe.recipeItems[i];
-
-			if (ingred == null)
-				continue;
-
-			input[i] = recipe.recipeItems[i];
-
-			for (Entry<ItemStack, String> replace : replacements.entrySet()) {
-				if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) {
-					input[i] = OreDictionary.getOres(replace.getValue());
-					break;
-				}
-			}
-		}
-	}
-
-	@Override
-	public ItemStack getCraftingResult(InventoryCrafting var1) {
-		return output.copy();
-	}
-
-	@Override
-	public int getRecipeSize() {
-		return input.length;
-	}
-
-	@Override
-	public ItemStack getRecipeOutput() {
-		return output;
-	}
-
-	@Override
-	public boolean matches(InventoryCrafting inv, World world) {
-		for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) {
-			for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) {
-				if (checkMatch(inv, x, y, false)) {
-					return true;
-				}
-
-				if (mirrored && checkMatch(inv, x, y, true)) {
-					return true;
-				}
-			}
-		}
-
-		return false;
-	}
-
-	@SuppressWarnings("unchecked")
-	private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) {
-		for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
-			for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
-				int subX = x - startX;
-				int subY = y - startY;
-				Object target = null;
-
-				if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
-					if (mirror) {
-						target = input[width - subX - 1 + subY * width];
-					} else {
-						target = input[subX + subY * width];
-					}
-				}
-				
-				ItemStack slot = inv.getStackInRowAndColumn(x, y);
-				//If target is integer, then we should be check the blood orb value of the item instead
-				if(target instanceof Integer) {
-					if(slot != null && slot.getItem() instanceof IBloodOrb) {
-						IBloodOrb orb = (IBloodOrb) slot.getItem();
-						if(orb.getOrbLevel() < (Integer)target) {
-							return false;
-						}
-					} else return false;
-				} else if (target instanceof ItemStack) {
-					if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) {
-						return false;
-					}
-				} else if (target instanceof ArrayList) {
-					boolean matched = false;
-
-					Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
-					while (itr.hasNext() && !matched) {
-						matched = OreDictionary.itemMatches(itr.next(), slot, false);
-					}
-
-					if (!matched) {
-						return false;
-					}
-				} else if (target == null && slot != null) {
-					return false;
-				}
-			}
-		}
-
-		return true;
-	}
-
-	public ShapedBloodOrbRecipe setMirrored(boolean mirror) {
-		mirrored = mirror;
-		return this;
-	}
-
-	public Object[] getInput() {
-		return this.input;
-	}
-}
\ No newline at end of file
diff --git a/1.7.10/main/java/joshie/alchemicalWizardy/ShapelessBloodOrbRecipe.java b/1.7.10/main/java/joshie/alchemicalWizardy/ShapelessBloodOrbRecipe.java
deleted file mode 100644
index f33f9158..00000000
--- a/1.7.10/main/java/joshie/alchemicalWizardy/ShapelessBloodOrbRecipe.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package joshie.alchemicalWizardy;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import net.minecraft.block.Block;
-import net.minecraft.inventory.InventoryCrafting;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.IRecipe;
-import net.minecraft.item.crafting.ShapelessRecipes;
-import net.minecraft.world.World;
-import net.minecraftforge.oredict.OreDictionary;
-import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
-
-/** Shapeless Blood Orb Recipe Handler by joshie **/
-public class ShapelessBloodOrbRecipe implements IRecipe {
-	private ItemStack output = null;
-	private ArrayList<Object> input = new ArrayList<Object>();
-
-	public ShapelessBloodOrbRecipe(Block result, Object... recipe) {
-		this(new ItemStack(result), recipe);
-	}
-
-	public ShapelessBloodOrbRecipe(Item result, Object... recipe) {
-		this(new ItemStack(result), recipe);
-	}
-
-	public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) {
-		output = result.copy();
-		for (Object in : recipe) {
-			if (in instanceof ItemStack) {
-				input.add(((ItemStack) in).copy());
-			} else if (in instanceof IBloodOrb) { //If the item is an instanceof IBloodOrb then save the level of the orb
-				input.add((Integer)(((IBloodOrb)in).getOrbLevel()));
-			} else if (in instanceof Item) {
-				input.add(new ItemStack((Item) in));
-			} else if (in instanceof Block) {
-				input.add(new ItemStack((Block) in));
-			} else if (in instanceof String) {
-				input.add(OreDictionary.getOres((String) in));
-			} else {
-				String ret = "Invalid shapeless ore recipe: ";
-				for (Object tmp : recipe) {
-					ret += tmp + ", ";
-				}
-				ret += output;
-				throw new RuntimeException(ret);
-			}
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements) {
-		output = recipe.getRecipeOutput();
-
-		for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems)) {
-			Object finalObj = ingred;
-			for (Entry<ItemStack, String> replace : replacements.entrySet()) {
-				if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) {
-					finalObj = OreDictionary.getOres(replace.getValue());
-					break;
-				}
-			}
-			input.add(finalObj);
-		}
-	}
-
-	@Override
-	public int getRecipeSize() {
-		return input.size();
-	}
-
-	@Override
-	public ItemStack getRecipeOutput() {
-		return output;
-	}
-
-	@Override
-	public ItemStack getCraftingResult(InventoryCrafting var1) {
-		return output.copy();
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public boolean matches(InventoryCrafting var1, World world) {
-		ArrayList<Object> required = new ArrayList<Object>(input);
-
-		for (int x = 0; x < var1.getSizeInventory(); x++) {
-			ItemStack slot = var1.getStackInSlot(x);
-
-			if (slot != null) {
-				boolean inRecipe = false;
-				Iterator<Object> req = required.iterator();
-
-				while (req.hasNext()) {
-					boolean match = false;
-
-					Object next = req.next();
-
-					//If target is integer, then we should be check the blood orb value of the item instead
-					if(next instanceof Integer) {
-						if(slot != null && slot.getItem() instanceof IBloodOrb) {
-							IBloodOrb orb = (IBloodOrb) slot.getItem();
-							if(orb.getOrbLevel() < (Integer)next) {
-								return false;
-							}
-						} else return false;
-					} else if (next instanceof ItemStack) {
-						match = OreDictionary.itemMatches((ItemStack) next, slot, false);
-					} else if (next instanceof ArrayList) {
-						Iterator<ItemStack> itr = ((ArrayList<ItemStack>) next).iterator();
-						while (itr.hasNext() && !match) {
-							match = OreDictionary.itemMatches(itr.next(), slot, false);
-						}
-					}
-
-					if (match) {
-						inRecipe = true;
-						required.remove(next);
-						break;
-					}
-				}
-
-				if (!inRecipe) {
-					return false;
-				}
-			}
-		}
-
-		return required.isEmpty();
-	}
-
-	public ArrayList<Object> getInput() {
-		return this.input;
-	}
-}
\ No newline at end of file
diff --git a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIAlchemyRecipeHandler.java b/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIAlchemyRecipeHandler.java
deleted file mode 100644
index 64ce0980..00000000
--- a/1.7.10/main/java/joshie/alchemicalWizardy/nei/NEIAlchemyRecipeHandler.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package joshie.alchemicalWizardy.nei;
-
-import static joshie.alchemicalWizardy.nei.NEIConfig.bloodOrbs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.StatCollector;
-import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipe;
-import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
-import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
-import codechicken.nei.ItemList;
-import codechicken.nei.NEIServerUtils;
-import codechicken.nei.PositionedStack;
-import codechicken.nei.recipe.TemplateRecipeHandler;
-import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe;
-
-public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
-	public class CachedAlchemyRecipe extends CachedRecipe {
-		public class BloodOrbs {
-			public PositionedStack stack;
-	        public BloodOrbs(ItemStack orb) {
-	            this.stack = new PositionedStack(orb, 136, 47, false);
-	        }
-	    }
-		
-		ArrayList<BloodOrbs> orbs;
-		PositionedStack output;
-		List<PositionedStack> inputs;
-		int lp;
-		
-		public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
-			this(recipe);
-			this.orbs = new ArrayList<BloodOrbs>();
-			orbs.add(new BloodOrbs(orb));
-		}
-		
-		public CachedAlchemyRecipe(AlchemyRecipe recipe) {
-			List<PositionedStack> inputs = new ArrayList<PositionedStack>();
-			ItemStack[] stacks = recipe.getRecipe();
-			if(stacks.length > 0)
-				inputs.add(new PositionedStack(stacks[0], 76, 3));
-			if(stacks.length > 1)
-				inputs.add(new PositionedStack(stacks[1], 51, 19));
-			if(stacks.length > 2)
-				inputs.add(new PositionedStack(stacks[2], 101, 19));
-			if(stacks.length > 3)
-				inputs.add(new PositionedStack(stacks[3], 64, 47));
-			if(stacks.length > 4)
-				inputs.add(new PositionedStack(stacks[4], 88, 47));
-			this.inputs = inputs;
-			this.output = new PositionedStack(recipe.getResult(), 76, 25);
-			this.lp = recipe.getAmountNeeded() * 100;
-			this.orbs = new ArrayList<BloodOrbs>();
-			for(Item orb: bloodOrbs) {
-				if(((IBloodOrb)orb).getOrbLevel() >= recipe.getOrbLevel()) {
-					orbs.add(new BloodOrbs(new ItemStack(orb)));
-				}
-			}
-		}
-		
-		@Override
-		public List<PositionedStack> getIngredients() {
-			return inputs;
-        }
-		
-		@Override
-		public PositionedStack getResult() {
-			return output;
-		}
-		
-		@Override
-		public PositionedStack getOtherStack() {
-			if(orbs == null || orbs.size() <= 0) return null;
-            return orbs.get((cycleticks/48) % orbs.size()).stack;
-        }
-	}
-	
-	@Override
-    public TemplateRecipeHandler newInstance() {
-		for(ItemStack item : ItemList.items)  {
-			if(item != null && item.getItem() instanceof IBloodOrb) {
-				bloodOrbs.add(item.getItem());
-			}
-		}
-		
-        return super.newInstance();
-    }
-	
-	@Override
-	public void loadCraftingRecipes(ItemStack result) {
-		for(AlchemyRecipe recipe: AlchemyRecipeRegistry.recipes) {
-			ItemStack output = recipe.getResult();
-			if(NEIServerUtils.areStacksSameTypeCrafting(result, recipe.getResult())) {
-				arecipes.add(new CachedAlchemyRecipe(recipe));
-			}
-		}
-	}
-	
-	@Override
-    public void loadUsageRecipes(ItemStack ingredient)  {
-		if(ingredient.getItem() instanceof IBloodOrb) {
-			for(AlchemyRecipe recipe: AlchemyRecipeRegistry.recipes) {
-				if(((IBloodOrb)ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
-					arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
-				}
-			}
-		} else {
-			for(AlchemyRecipe recipe: AlchemyRecipeRegistry.recipes) {
-				ItemStack[] stacks = recipe.getRecipe();
-				for(ItemStack stack: stacks) {
-					if(NEIServerUtils.areStacksSameTypeCrafting(stack, ingredient)) {
-						arecipes.add(new CachedAlchemyRecipe(recipe));
-						break;
-					}
-				}
-			}
-		}
-    }
-	
-	@Override
-	public void drawExtras(int id) {
-		CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
-		Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
-	}
-	
-	public int getLPX(int lp) {
-		if(lp < 10)
-			return 122;
-		else if (lp < 100)
-			return 122;
-		else if (lp < 1000)
-			return 130;
-		else if (lp < 10000)
-			return 127;
-		else if (lp < 100000)
-			return 124;
-		return 122;
-	}
-	
-	@Override
-	public String getRecipeName() {
-		return StatCollector.translateToLocal("tile.blockWritingTable.name");
-	}
-
-	@Override
-	public String getGuiTexture() {
-		return new ResourceLocation("alchemicalwizardry", "gui/nei/alchemy.png").toString();
-	}
-}