mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-26 23:03:05 +00:00
update dev environment to 1.12.2
This commit is contained in:
1 parent
1b487f6e2a
commit
dc584e9d6c
34 files changed
+605
-1792
No files matched your search
@@ -1,42 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class AvaritiaRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"extreme", "extreme_compression"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "Avaritia";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (ident.equals(identifier)) {
|
||||
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (ident.equals(identifier)) {
|
||||
List<PositionedStack> recipeOutput = new ArrayList<>();
|
||||
recipeOutput.add(recipe.getResultStack(recipeIndex));
|
||||
return recipeOutput;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class BloodMagicRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"altarrecipes",
|
||||
"alchemicalwizardry.alchemy",
|
||||
"alchemicalwizardry.bindingritual"
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "BloodMagic";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (ident.equals(identifier)) {
|
||||
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
|
||||
}
|
||||
}
|
||||
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));
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import crazypants.enderio.nei.SagMillRecipeHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class EnderIORecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"EnderIOAlloySmelter", "EIOEnchanter", "EnderIOSagMill",
|
||||
"EnderIOSliceAndSplice", "EnderIOSoulBinder", "EnderIOVat"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "EnderIO";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (ident.equals(identifier)) {
|
||||
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
if(identifier!=null) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (ident.equals(identifier)) {
|
||||
List<PositionedStack> recipeOutputs = new ArrayList<>();
|
||||
recipeOutputs.add(recipe.getResultStack(recipeIndex));
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
//remove output if it's chance != 1
|
||||
if(recipe instanceof SagMillRecipeHandler){
|
||||
SagMillRecipeHandler.MillRecipe millRecipe = (SagMillRecipeHandler.MillRecipe) ((SagMillRecipeHandler) recipe).arecipes.get(recipeIndex);
|
||||
recipeOutputs.removeIf(positionedStack -> millRecipe.getChanceForOutput(positionedStack.item) != 1.0F);
|
||||
}
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import forestry.factory.recipes.nei.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ForestryRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "Forestry";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
if (recipe instanceof NEIHandlerBottler) {
|
||||
|
||||
return bottlerHandler((NEIHandlerBottler) recipe, recipeIndex, true);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerCarpenter) {
|
||||
|
||||
return carpenterHandler((NEIHandlerCarpenter) recipe, recipeIndex, true);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerCentrifuge) {
|
||||
|
||||
return centrifugeHandler((NEIHandlerCentrifuge) recipe, recipeIndex, true);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerFabricator) {
|
||||
|
||||
return fabricatorHandler((NEIHandlerFabricator) recipe, recipeIndex, true);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerMoistener) {
|
||||
|
||||
return moistenerHandler((NEIHandlerMoistener) recipe, recipeIndex, true);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerSqueezer) {
|
||||
|
||||
return squeezerHandler((NEIHandlerSqueezer) recipe, recipeIndex, true);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
if (recipe instanceof NEIHandlerBottler) {
|
||||
|
||||
return bottlerHandler((NEIHandlerBottler) recipe, recipeIndex, false);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerCarpenter) {
|
||||
|
||||
return carpenterHandler((NEIHandlerCarpenter) recipe, recipeIndex, false);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerCentrifuge) {
|
||||
|
||||
return centrifugeHandler((NEIHandlerCentrifuge) recipe, recipeIndex, false);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerFabricator) {
|
||||
|
||||
return fabricatorHandler((NEIHandlerFabricator) recipe, recipeIndex, false);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerMoistener) {
|
||||
|
||||
return moistenerHandler((NEIHandlerMoistener) recipe, recipeIndex, false);
|
||||
|
||||
} else if (recipe instanceof NEIHandlerSqueezer) {
|
||||
|
||||
return squeezerHandler((NEIHandlerSqueezer) recipe, recipeIndex, false);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<PositionedStack> bottlerHandler(NEIHandlerBottler base, int recipeIndex, boolean getInput) {
|
||||
return getInput ? base.getIngredientStacks(recipeIndex) : Collections.singletonList(base.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
private List<PositionedStack> carpenterHandler(NEIHandlerCarpenter base, int recipeIndex, boolean getInput) {
|
||||
return getInput ? base.getIngredientStacks(recipeIndex) : Collections.singletonList(base.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
private List<PositionedStack> centrifugeHandler(NEIHandlerCentrifuge base, int recipeIndex, boolean getInput) {
|
||||
return getInput ? base.getIngredientStacks(recipeIndex) : base.getOtherStacks(recipeIndex);
|
||||
}
|
||||
|
||||
private List<PositionedStack> fabricatorHandler(NEIHandlerFabricator base, int recipeIndex, boolean getInput) {
|
||||
List<PositionedStack> recipeInput = new ArrayList<>(base.getIngredientStacks(recipeIndex));
|
||||
recipeInput.addAll(base.getOtherStacks(recipeIndex));
|
||||
return getInput ? recipeInput : Collections.singletonList(base.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
//Fermenter doesn't support, because it doesn't has a item output
|
||||
|
||||
private List<PositionedStack> moistenerHandler(NEIHandlerMoistener base, int recipeIndex, boolean getInput) {
|
||||
List<PositionedStack> recipeInput = new ArrayList<>(base.getIngredientStacks(recipeIndex));
|
||||
recipeInput.addAll(base.getOtherStacks(recipeIndex));
|
||||
return getInput ? recipeInput : Collections.singletonList(base.getResultStack(recipeIndex));
|
||||
}
|
||||
|
||||
private List<PositionedStack> squeezerHandler(NEIHandlerSqueezer base, int recipeIndex, boolean getInput) {
|
||||
return getInput ? base.getIngredientStacks(recipeIndex) : Collections.singletonList(base.getResultStack(recipeIndex));
|
||||
}
|
||||
//Still doesn't need support
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.api.util.GT_Utility;
|
||||
import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
private static final Class<?> gtDefaultClz, gtAssLineClz;
|
||||
|
||||
static {
|
||||
Class<?> gtDH = null;
|
||||
Class<?> gtAL = null;
|
||||
try {
|
||||
gtDH = Class.forName("gregtech.nei.GT_NEI_DefaultHandler");
|
||||
gtAL = Class.forName("gregtech.nei.GT_NEI_AssLineHandler");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
gtDefaultClz = gtDH;
|
||||
gtAssLineClz = gtAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
|
||||
Set<String> identifiers = new HashSet<>();
|
||||
for (GT_Recipe.GT_Recipe_Map tMap : GT_Recipe.GT_Recipe_Map.sMappings) {
|
||||
if (tMap.mNEIAllowed) {
|
||||
identifiers.add(tMap.mNEIName);
|
||||
}
|
||||
}
|
||||
identifiers.add("gt.recipe.fakeAssemblylineProcess");
|
||||
return identifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "GregTech5";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
|
||||
if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
|
||||
recipeInputs.removeIf(positionedStack -> getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0);
|
||||
if (!recipeInputs.isEmpty()) {
|
||||
ItemStack specialItem = recipeInputs.get(recipeInputs.size() - 1).items[0];
|
||||
if ((specialItem.isItemEqual(ItemList.Tool_DataStick.get(1)) || specialItem.isItemEqual(ItemList.Tool_DataOrb.get(1)) && (recipe.getRecipeName().equals("gt.recipe.scanner") || recipe.getRecipeName().equals("gt.recipe.fakeAssemblylineProcess"))))
|
||||
recipeInputs.remove(recipeInputs.size() - 1);
|
||||
}
|
||||
return recipeInputs;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) {
|
||||
List<PositionedStack> recipeOutputs = new ArrayList<>(recipe.getOtherStacks(recipeIndex));
|
||||
recipeOutputs.removeIf(positionedStack -> getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
//remove output if it's chance != 10000
|
||||
recipeOutputs.removeIf(stack -> stack instanceof FixedPositionedStack && !(((FixedPositionedStack) stack).mChance == 10000 || ((FixedPositionedStack) stack).mChance <= 0));
|
||||
return recipeOutputs;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* For resolving NoSuchMethodError
|
||||
* Copied from GTNewHorizons/GT5-Unofficial.
|
||||
*/
|
||||
public static FluidStack getFluidFromDisplayStack(ItemStack aDisplayStack) {
|
||||
if (!isStackValid(aDisplayStack) ||
|
||||
aDisplayStack.getItem() != ItemList.Display_Fluid.getItem() ||
|
||||
!aDisplayStack.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
Fluid tFluid = FluidRegistry.getFluid(ItemList.Display_Fluid.getItem().getDamage(aDisplayStack));
|
||||
return new FluidStack(tFluid, (int) aDisplayStack.getTagCompound().getLong("mFluidDisplayAmount"));
|
||||
}
|
||||
public static boolean isStackValid(Object aStack) {
|
||||
return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import gregapi.NEI_RecipeMap;
|
||||
import gregapi.NEI_RecipeMap.FixedPositionedStack;
|
||||
import gregapi.data.FL;
|
||||
import gregapi.recipes.Recipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class GregTech6RecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
Set<String> identifiers = new HashSet<>();
|
||||
for (Recipe.RecipeMap tMap : Recipe.RecipeMap.RECIPE_MAPS.values()) {
|
||||
if (tMap.mNEIAllowed) {
|
||||
identifiers.add(tMap.mNameNEI);
|
||||
}
|
||||
}
|
||||
return identifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "GregTech6";
|
||||
}
|
||||
|
||||
@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));
|
||||
//remove fluid
|
||||
recipeInputs.removeIf(positionedStack -> FL.getFluid(positionedStack.item, true) != null || positionedStack.item.stackSize == 0);
|
||||
//try to remove machine
|
||||
if (recipe instanceof NEI_RecipeMap) {
|
||||
Field mRecipeMapField = ReflectionHelper.findField(NEI_RecipeMap.class, "mRecipeMap");
|
||||
Recipe.RecipeMap mRecipeMap = null;
|
||||
try {
|
||||
mRecipeMap = (Recipe.RecipeMap) mRecipeMapField.get(recipe);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (mRecipeMap != null) {
|
||||
ItemStack lastItem = (recipeInputs.get(recipeInputs.size() - 1)).items[0];
|
||||
for (ItemStack stack : mRecipeMap.mRecipeMachineList) {
|
||||
if (ItemStack.areItemStackTagsEqual(lastItem, stack)) {
|
||||
recipeInputs.remove(recipeInputs.size() - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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> recipeOutput = new ArrayList<>(recipe.getOtherStacks(recipeIndex));
|
||||
recipeOutput.removeIf(positionedStack -> FL.getFluid(positionedStack.item, true) != null || positionedStack.item.stackSize == 0);
|
||||
//try to remove item output if it's chance != 100%
|
||||
recipeOutput.removeIf(positionedStack -> positionedStack instanceof FixedPositionedStack && ((FixedPositionedStack) positionedStack).mChance > 0 && ((FixedPositionedStack) positionedStack).mChance != ((FixedPositionedStack) positionedStack).mMaxChance);
|
||||
return recipeOutput;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class ICRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"blastfurnace", "BlockCutter", "centrifuge", "compressor",
|
||||
"extractor", "fluidcanner", "macerator",
|
||||
"metalformer", "oreWashing", "solidcanner"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "IC2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (ident.equals(identifier)) {
|
||||
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
|
||||
}
|
||||
}
|
||||
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));
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketNEIPatternRecipe;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public interface IRecipeProcessor {
|
||||
|
||||
|
||||
default Set<String> getAllOverlayIdentifier(){
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
String getRecipeProcessorId();
|
||||
|
||||
List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier);
|
||||
|
||||
List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier);
|
||||
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import blusunrize.immersiveengineering.client.nei.NEICrusherHandler.CachedCrusherRecipe;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class ImmersiveEngineeringRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"ieArcFurnace", "ieBlastFurnace", "ieBlueprintCrafting",
|
||||
"ieBottlingMachine", "ieCokeOven", "ieCrusher",
|
||||
"ieFermenter", "ieHammerCrushing", "ieMetalPress",
|
||||
"ieRefinery", "ieShaderBag", "ieSqueezer"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "ImmersiveEngineering";
|
||||
}
|
||||
|
||||
@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 (!("ieArcFurnace".equals(identifier) || "ieCrusher".equals(identifier) || "ieBlastFurnace".equals(identifier))) {
|
||||
recipeInputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
}
|
||||
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 ("ieArcFurnace".equals(identifier) || "ieCrusher".equals(identifier)) {
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
}
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class MekanismRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"chemicalinfuser", "chemicalinjectionchamber",
|
||||
"chemicaloxidizer", "chemicalwasher", "combiner", "crusher", "electrolyticseparator",
|
||||
"chamber", "infuser", "compressor", "prc", "precisionsawmill", "purificationchamber",
|
||||
"rotarycondensentrator", "solarneutron", "thermalevaporation"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "Mekanism";
|
||||
}
|
||||
|
||||
@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.getOtherStacks(recipeIndex).isEmpty()) {
|
||||
recipeInputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
}
|
||||
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));
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import com.github.vfyjxf.nee.NotEnoughEnergistics;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecipeProcessor {
|
||||
public static List<IRecipeProcessor> recipeProcessors = new ArrayList<>();
|
||||
|
||||
public static void init() {
|
||||
NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Start-----");
|
||||
NotEnoughEnergistics.logger.info("Install Vanilla Support");
|
||||
recipeProcessors.add(new VanillaRecipeProcessor());
|
||||
|
||||
if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")) {
|
||||
NotEnoughEnergistics.logger.info("Found GregTech5,install GregTech5 support");
|
||||
recipeProcessors.add(new GregTech5RecipeProcessor());
|
||||
}
|
||||
if (Loader.isModLoaded("gregapi") && Loader.isModLoaded("gregapi_post")) {
|
||||
NotEnoughEnergistics.logger.info("Found GregTech6,install GregTech6 support");
|
||||
recipeProcessors.add(new GregTech6RecipeProcessor());
|
||||
}
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
NotEnoughEnergistics.logger.info("Found IC2,install IC2 Support");
|
||||
recipeProcessors.add(new ICRecipeProcessor());
|
||||
}
|
||||
if (Loader.isModLoaded("Avaritia")) {
|
||||
NotEnoughEnergistics.logger.info("Found Avaritia, install Avaritia support");
|
||||
recipeProcessors.add(new AvaritiaRecipeProcessor());
|
||||
}
|
||||
if (Loader.isModLoaded("EnderIO")) {
|
||||
NotEnoughEnergistics.logger.info("Found EnderIO, install EnderIO support");
|
||||
recipeProcessors.add(new EnderIORecipeProcessor());
|
||||
}
|
||||
if (Loader.isModLoaded("Forestry")) {
|
||||
NotEnoughEnergistics.logger.info("Found Forestry, install Forestry support");
|
||||
recipeProcessors.add(new ForestryRecipeProcessor());
|
||||
}
|
||||
if (Loader.isModLoaded("thaumcraftneiplugin")) {
|
||||
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("ImmersiveEngineering")){
|
||||
NotEnoughEnergistics.logger.info("Found ImmersiveEngineering, install ImmersiveEngineering support");
|
||||
recipeProcessors.add(new ImmersiveEngineeringRecipeProcessor());
|
||||
}
|
||||
if(Loader.isModLoaded("Mekanism")){
|
||||
NotEnoughEnergistics.logger.info("Found Mekanism, install Mekanism support");
|
||||
recipeProcessors.add(new MekanismRecipeProcessor());
|
||||
}
|
||||
if(Loader.isModLoaded("AWWayofTime")){
|
||||
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");
|
||||
}
|
||||
NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Finished-----");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import com.djgiannuzz.thaumcraftneiplugin.items.ItemAspect;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class TCNEIPluginRecipeProcessor implements IRecipeProcessor{
|
||||
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"arcaneshapedrecipes","arcaneshapelessrecipes","aspectsRecipe",
|
||||
"cruciblerecipe","infusionCrafting"
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "TCNEIPlugin";
|
||||
}
|
||||
|
||||
@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 -> positionedStack.item.getItem() instanceof ItemAspect);
|
||||
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));
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
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");
|
||||
Field secondaryOutputChanceField = ReflectionHelper.findField(NEIRecipeBase, "secondaryOutputChance");
|
||||
PositionedStack secondaryOutput = null;
|
||||
int secondaryOutputChance = 0;
|
||||
try {
|
||||
secondaryOutput = (PositionedStack) secondaryOutputField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
secondaryOutputChance = (int) secondaryOutputChanceField.get(((RecipeHandlerBase) recipe).arecipes.get(recipeIndex));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (secondaryOutput != null && secondaryOutputChance >= 100) {
|
||||
recipeOutputs.add(secondaryOutput);
|
||||
}
|
||||
}
|
||||
}
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author vfyjxf
|
||||
*/
|
||||
public class VanillaRecipeProcessor implements IRecipeProcessor {
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList("brewing", "smelting", "fuel"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
return "Vanilla";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if ("brewing".equals(identifier) || "smelting".equals(identifier) || "fuel".equals(identifier)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
recipeInputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
}
|
||||
return recipeInputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
if ("brewing".equals(identifier) || "smelting".equals(identifier) || "fuel".equals(identifier)) {
|
||||
List<PositionedStack> recipeOutput = new ArrayList<>();
|
||||
recipeOutput.add(recipe.getResultStack(recipeIndex));
|
||||
return recipeOutput;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user