diff --git a/README.md b/README.md index a9de036..1affbb5 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This mod removes that functionality and allows the player to use NEI's transfer - [x] Forestry(Doesn't support Fermenter and Still,because they don't have an item output) - [x] Thaumcraft NEI Plugin - [x] Thaumic Energistics(Allows you to transfer ArcaneRecipe from NEI to Knowledge Inscriber, it requires Thaumcraft NEI Plugin) - +- [x] ThermalExpansion 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) ## TODO diff --git a/READNE_CN.md b/READNE_CN.md index dbd9891..8d100e1 100644 --- a/READNE_CN.md +++ b/READNE_CN.md @@ -24,7 +24,7 @@ NotEnoughEnergistics 是[Just Enough Energistics](https://www.curseforge.com/min - [x] Forestry(不支持发酵机和蒸馏器,因为它们没有物品输出) - [x] Thaumcraft NEI Plugin - [x] Thaumic Energistics(允许你从NEI转移奥术合成台配方到知识记录仪,需要Thaumcraft NEI Plugin) - +- [x] ThermalExpansion 如果你想要别的Mod的支持,请看[RecipeProcessor](./src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java) 或者[模组支持处理区](https://github.com/vfyjxf/NotEnoughEnergistics/issues/1) ## TODO diff --git a/gradle.properties b/gradle.properties index dc2fd3a..be0e868 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.1 +mod_version=1.2.2 forge_version=10.13.4.1614 mod_group=com.github.vfyjxf.neenergistics mod_id=neenergistics diff --git a/libs/ThermalExpansion-[1.7.10]4.1.5-248-dev.jar b/libs/ThermalExpansion-[1.7.10]4.1.5-248-dev.jar new file mode 100644 index 0000000..0d0ae72 Binary files /dev/null and b/libs/ThermalExpansion-[1.7.10]4.1.5-248-dev.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 cb88ca9..420d989 100644 --- a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java @@ -75,7 +75,7 @@ public class NEECraftingHandler implements IOverlayHandler { } for (PositionedStack positionedStack : tInputs) { - ItemStack currentStack = positionedStack.items[0]; + ItemStack currentStack = positionedStack.item; for (ItemStack stack : positionedStack.items) { if (Platform.isRecipePrioritized(stack) || ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) { currentStack = stack.copy(); 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 5e41001..c79b60c 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java @@ -42,6 +42,10 @@ public class RecipeProcessor { NotEnoughEnergistics.logger.info("Found TCNEIPlugin, install TCNEIPlugin support"); recipeProcessors.add(new TCNEIPluginRecipeProcessor()); } + if (Loader.isModLoaded("ThermalExpansion")) { + NotEnoughEnergistics.logger.info("Found ThermalExpansion, install ThermalExpansion support"); + recipeProcessors.add(new ThermalExpansionRecipeProcessor()); + } if (Loader.isModLoaded("appliedenergistics2")) { NotEnoughEnergistics.logger.info("Applied Energistics 2 will not be supported"); } diff --git a/src/main/java/com/github/vfyjxf/nee/processor/ThermalExpansionRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/ThermalExpansionRecipeProcessor.java new file mode 100644 index 0000000..4592c6b --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/processor/ThermalExpansionRecipeProcessor.java @@ -0,0 +1,89 @@ +package com.github.vfyjxf.nee.processor; + +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.IRecipeHandler; +import cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase; +import cpw.mods.fml.relauncher.ReflectionHelper; + +import java.lang.reflect.Field; +import java.util.*; + + +public class ThermalExpansionRecipeProcessor implements IRecipeProcessor { + @Override + public Set getAllOverlayIdentifier() { + return new HashSet<>(Arrays.asList( + "thermalexpansion.charger", "thermalexpansion.crucible", "thermalexpansion.furnace", "thermalexpansion.insolator", + "thermalexpansion.pulverizer", "thermalexpansion.sawmill", "thermalexpansion.smelter", "thermalexpansion.transposer" + )); + } + + @Override + public String getRecipeProcessorId() { + return "ThermalExpansion"; + } + + @Override + public List getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) { + for (String ident : getAllOverlayIdentifier()) { + if (ident.equals(identifier)) { + List recipeInputs = new ArrayList<>(recipe.getIngredientStacks(recipeIndex)); + if (recipe instanceof RecipeHandlerBase) { + Class NEIRecipeBase = null; + try { + NEIRecipeBase = Class.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + if (NEIRecipeBase != null) { + Field secondaryInputField = ReflectionHelper.findField(NEIRecipeBase, "secondaryInput"); + PositionedStack secondaryInput = null; + try { + secondaryInput = (PositionedStack) secondaryInputField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex)); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + if (secondaryInput != null) { + recipeInputs.add(secondaryInput); + } + } + } + return recipeInputs; + } + } + + return null; + } + + @Override + public List getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) { + for (String ident : getAllOverlayIdentifier()) { + if (ident.equals(identifier)) { + List recipeOutputs = new ArrayList<>(); + recipeOutputs.add(recipe.getResultStack(recipeIndex)); + if (recipe instanceof RecipeHandlerBase) { + Class NEIRecipeBase = null; + try { + NEIRecipeBase = Class.forName("cofh.thermalexpansion.plugins.nei.handlers.RecipeHandlerBase$NEIRecipeBase"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + if (NEIRecipeBase != null) { + Field secondaryOutputField = ReflectionHelper.findField(NEIRecipeBase, "secondaryOutput"); + PositionedStack secondaryOutput = null; + try { + secondaryOutput = (PositionedStack) secondaryOutputField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex)); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + if (secondaryOutput != null) { + recipeOutputs.add(secondaryOutput); + } + } + } + return recipeOutputs; + } + } + return null; + } +}