add gt++ support

This commit is contained in:
vfyjxf committed 2021-08-25 17:07:13 +08:00
1 parent 4c58ec18d3
commit dfc5185030
6 files changed
+72 -1

No files matched your search

@@ -0,0 +1,54 @@
package com.github.vfyjxf.nee.processor;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.IRecipeHandler;
import gregtech.api.util.GTPP_Recipe;
import java.util.*;
/**
* @author vfyjxf
*/
public class GTPPRecipeProcessor implements IRecipeProcessor {
@Override
public Set<String> getAllOverlayIdentifier() {
HashSet<String> identifiers = new HashSet<>(Collections.singletonList("GTPP_Decayables"));
for (GTPP_Recipe.GTPP_Recipe_Map_Internal gtppMap : GTPP_Recipe.GTPP_Recipe_Map_Internal.sMappingsEx) {
if (gtppMap.mNEIAllowed) {
identifiers.add(gtppMap.mNEIName);
}
}
return identifiers;
}
@Override
public String getRecipeProcessorId() {
return "GT++";
}
@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));
recipeInputs.removeIf(positionedStack -> GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0);
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<>(recipe.getOtherStacks(recipeIndex));
recipeOutputs.removeIf(positionedStack -> GregTech5RecipeProcessor.getFluidFromDisplayStack(positionedStack.items[0]) != null);
return recipeOutputs;
}
}
return null;
}
}
@@ -62,6 +62,11 @@ public class RecipeProcessor {
NotEnoughEnergistics.logger.info("Found BuildCraft-Compat, install BuildCraft-Compat support");
recipeProcessors.add(new BuildCraftRecipeProcessor());
}
if(Loader.isModLoaded("miscutils")){
NotEnoughEnergistics.logger.info("Found GT++, install GT++ support");
recipeProcessors.add(new GTPPRecipeProcessor());
}
if (Loader.isModLoaded("appliedenergistics2")) {
NotEnoughEnergistics.logger.info("Applied Energistics 2 will not be supported");
}