diff --git a/src/main/java/modtweaker/mods/forestry/ForestryListAddition.java b/src/main/java/modtweaker/mods/forestry/ForestryListAddition.java index 16e769b..7a2bb2e 100644 --- a/src/main/java/modtweaker/mods/forestry/ForestryListAddition.java +++ b/src/main/java/modtweaker/mods/forestry/ForestryListAddition.java @@ -4,6 +4,7 @@ import com.blamejared.mtlib.helpers.LogHelper; import com.blamejared.mtlib.utils.BaseListAddition; import forestry.api.recipes.IForestryRecipe; import forestry.api.recipes.ICraftingProvider; +import mezz.jei.api.recipe.*; import minetweaker.MineTweakerAPI; import java.util.*; @@ -15,7 +16,7 @@ public abstract class ForestryListAddition extends Ba super(name, new ArrayList(manager.recipes())); this.manager = manager; } - + @Override protected abstract String getRecipeInfo(T recipe); @@ -25,7 +26,10 @@ public abstract class ForestryListAddition extends Ba if (recipe != null) { if (manager.addRecipe(recipe)){ successful.add(recipe); - MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(recipe); + IRecipeWrapper wrapped = wrapRecipe(recipe); + if (wrapped != null){ + MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(wrapped); + } } else { LogHelper.logError(String.format("Error adding %s Recipe for %s", name, getRecipeInfo(recipe))); } @@ -42,11 +46,16 @@ public abstract class ForestryListAddition extends Ba if (!manager.removeRecipe(recipe)) { LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe))); }else{ - MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe); + IRecipeWrapper wrapped = wrapRecipe(recipe); + if (wrapped != null){ + MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(wrapped); + } } } else { LogHelper.logError(String.format("Error removing %s Recipe: null object", name)); } } } + + public abstract IRecipeWrapper wrapRecipe(T recipe); } diff --git a/src/main/java/modtweaker/mods/forestry/ForestryListRemoval.java b/src/main/java/modtweaker/mods/forestry/ForestryListRemoval.java index 9ee26ec..d878525 100644 --- a/src/main/java/modtweaker/mods/forestry/ForestryListRemoval.java +++ b/src/main/java/modtweaker/mods/forestry/ForestryListRemoval.java @@ -4,6 +4,7 @@ import forestry.api.recipes.ICraftingProvider; import forestry.api.recipes.IForestryRecipe; import com.blamejared.mtlib.helpers.LogHelper; import com.blamejared.mtlib.utils.BaseListRemoval; +import mezz.jei.api.recipe.*; import minetweaker.MineTweakerAPI; import java.util.ArrayList; @@ -26,7 +27,10 @@ public abstract class ForestryListRemoval { @@ -84,6 +92,11 @@ public class ThermionicFabricator { public String getRecipeInfo(IFabricatorRecipe recipe) { return LogHelper.getStackDescription(recipe.getRecipeOutput()); } + + @Override + public IRecipeWrapper wrapRecipe(IFabricatorRecipe recipe){ + return new FabricatorRecipeWrapper(recipe); + } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -142,6 +155,12 @@ public class ThermionicFabricator { public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) { return LogHelper.getStackDescription(recipe.getResource()); } + + //It's not clear to me how the smelting recipes should be wrapped + @Override + public IRecipeWrapper wrapRecipe(IFabricatorSmeltingRecipe recipe){ + return null; + } } private static class RemoveCasts extends ForestryListRemoval { @@ -154,5 +173,10 @@ public class ThermionicFabricator { public String getRecipeInfo(IFabricatorRecipe recipe) { return LogHelper.getStackDescription(recipe.getRecipeOutput()); } + + @Override + public IRecipeWrapper wrapRecipe(IFabricatorRecipe recipe){ + return new FabricatorRecipeWrapper(recipe); + } } }