diff --git a/README.md b/README.md index 37c6dbd..2b4b2f9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This mod removes that functionality and allows the player to use NEI's transfer - Combine like stacks in processing patterns. - Support Processing Pattern Terminal(16 -> 4 mode). - Allow you to add item blackList and item priority list, if item in them, it will not be transferred / transfer it first.(use /nee RecipeProcessor to get RecipeProcessor and identifier in log) -- Allow you to add mod priority list,if it's the mod's item,it will be use first. +- Allow you to add mod priority list,if the mod's has this item,it will be use first. ## Compatible Modslist as followed: @@ -35,6 +35,7 @@ This mod removes that functionality and allows the player to use NEI's transfer - [x] ImmersiveEngineering - [x] Mekanism - [x] BloodMagic +- [x] BuildCraft If you want other Mod support,see [RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) and [Mod support Issue](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1) diff --git a/READNE_CN.md b/READNE_CN.md index 427518b..fa67aaf 100644 --- a/READNE_CN.md +++ b/READNE_CN.md @@ -30,6 +30,7 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min - [x] ImmersiveEngineering - [x] Mekanism - [x] BloodMagic +- [x] BuildCraft 如果你想要别的Mod的支持,请看[RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) 或者[模组支持处理区](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1) diff --git a/gradle.properties b/gradle.properties index 4173fd6..9ec5db7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.daemon=false mc_version=1.7.10 nei_version=2.1.6-GTNH ae2_version=rv3-beta-52-GTNH -mod_version=1.2.4 +mod_version=1.2.5 forge_version=10.13.4.1614 mod_group=com.github.vfyjxf.neenergistics mod_id=neenergistics diff --git a/libs/buildcraft-compat-7.1.7-dev.jar b/libs/buildcraft-compat-7.1.7-dev.jar new file mode 100644 index 0000000..57f5dd3 Binary files /dev/null and b/libs/buildcraft-compat-7.1.7-dev.jar differ diff --git a/libs/buildcraft-compat-7.1.7-sources.jar b/libs/buildcraft-compat-7.1.7-sources.jar new file mode 100644 index 0000000..b07b594 Binary files /dev/null and b/libs/buildcraft-compat-7.1.7-sources.jar differ diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java index 8949d42..3004155 100644 --- a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java @@ -73,14 +73,13 @@ public class NEECraftingHandler implements IOverlayHandler { tInputs.add(positionedStack); } } - for (PositionedStack positionedStack : tInputs) { - ItemStack currentStack = positionedStack.item; - currentStack.stackSize = positionedStack.items[0].stackSize; - + ItemStack currentStack = positionedStack.items[0]; ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); + if (preferModItem != null) { currentStack = preferModItem; + currentStack.stackSize = positionedStack.items[0].stackSize; } for (ItemStack stack : positionedStack.items) { @@ -138,7 +137,7 @@ public class NEECraftingHandler implements IOverlayHandler { } private void knowledgeInscriberHandler(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { - Class knowledgeInscriberClz = null; + Class knowledgeInscriberClz; try { knowledgeInscriberClz = Class.forName("thaumicenergistics.client.gui.GuiKnowledgeInscriber"); } catch (ClassNotFoundException e) { diff --git a/src/main/java/com/github/vfyjxf/nee/processor/BuildCraftRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/BuildCraftRecipeProcessor.java new file mode 100644 index 0000000..ff749e6 --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/processor/BuildCraftRecipeProcessor.java @@ -0,0 +1,49 @@ +package com.github.vfyjxf.nee.processor; + +import buildcraft.compat.nei.RecipeHandlerAssemblyTable; +import buildcraft.compat.nei.RecipeHandlerIntegrationTable; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.IRecipeHandler; + +import java.util.Collections; +import java.util.List; + +/** + * @author vfyjxf + */ +public class BuildCraftRecipeProcessor implements IRecipeProcessor { + + @Override + public String getRecipeProcessorId() { + return "BuildCraft"; + } + + @Override + public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { + if (recipe instanceof RecipeHandlerAssemblyTable) { + return handlerAssemblyTableRecipe((RecipeHandlerAssemblyTable) recipe, recipeIndex, true); + } else if (recipe instanceof RecipeHandlerIntegrationTable) { + return handlerIntegrationTableRecipe((RecipeHandlerIntegrationTable) recipe, recipeIndex, true); + } + return null; + } + + @Override + public List getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) { + if (recipe instanceof RecipeHandlerAssemblyTable) { + return handlerAssemblyTableRecipe((RecipeHandlerAssemblyTable) recipe, recipeIndex, false); + } else if (recipe instanceof RecipeHandlerIntegrationTable) { + return handlerIntegrationTableRecipe((RecipeHandlerIntegrationTable) recipe, recipeIndex, false); + } + return null; + } + + private List handlerAssemblyTableRecipe(RecipeHandlerAssemblyTable recipe, int recipeIndex, boolean getInput) { + return getInput ? recipe.getIngredientStacks(recipeIndex) : Collections.singletonList(recipe.getResultStack(recipeIndex)); + } + + private List handlerIntegrationTableRecipe(RecipeHandlerIntegrationTable recipe, int recipeIndex, boolean getInput) { + return getInput ? recipe.getIngredientStacks(recipeIndex) : Collections.singletonList(recipe.getResultStack(recipeIndex)); + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java index 3176a31..530216b 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java @@ -58,6 +58,10 @@ public class RecipeProcessor { NotEnoughEnergistics.logger.info("Found BloodMagic, install BloodMagic support"); recipeProcessors.add(new BloodMagicRecipeProcessor()); } + if(Loader.isModLoaded("BuildCraft|Compat")){ + NotEnoughEnergistics.logger.info("Found BuildCraft-Compat, install BuildCraft-Compat support"); + recipeProcessors.add(new BuildCraftRecipeProcessor()); + } if (Loader.isModLoaded("appliedenergistics2")) { NotEnoughEnergistics.logger.info("Applied Energistics 2 will not be supported"); }