Add ThermalExpansion support

This commit is contained in:
vfyjxf committed 2021-08-13 02:48:44 +08:00
1 parent a66fed83ed
commit 571204f2d2
7 files changed
+97 -4

No files matched your search

+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
Binary file not shown.
@@ -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();
@@ -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");
}
@@ -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<String> 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<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
for (String ident : getAllOverlayIdentifier()) {
if (ident.equals(identifier)) {
List<PositionedStack> 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<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
for (String ident : getAllOverlayIdentifier()) {
if (ident.equals(identifier)) {
List<PositionedStack> 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;
}
}