mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-18 19:29:16 +00:00
add BuildCraft support
This commit is contained in:
1 parent
ae0e23eac5
commit
52d3059e43
8 files changed
+61
-7
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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<PositionedStack> 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<PositionedStack> 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<PositionedStack> handlerAssemblyTableRecipe(RecipeHandlerAssemblyTable recipe, int recipeIndex, boolean getInput) {
|
||||
return getInput ? recipe.getIngredientStacks(recipeIndex) : Collections.singletonList(recipe.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
private List<PositionedStack> handlerIntegrationTableRecipe(RecipeHandlerIntegrationTable recipe, int recipeIndex, boolean getInput) {
|
||||
return getInput ? recipe.getIngredientStacks(recipeIndex) : Collections.singletonList(recipe.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user