mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-25 14:24:33 +00:00
First Commit
This commit is contained in:
1 parent
927b160fec
commit
103d6cbae3
24 files changed
+932
-2
No files matched your search
@@ -0,0 +1,37 @@
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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 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 GregTechRecipeProcessor 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 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 -> GT_Utility.getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
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 -> GT_Utility.getFluidFromDisplayStack(positionedStack.items[0]) != null);
|
||||
return recipeOutputs;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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 List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (identifier.equals(ident)) {
|
||||
return new ArrayList<>(recipe.getIngredientStacks(recipeIndex));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
|
||||
for (String ident : getAllOverlayIdentifier()) {
|
||||
if (identifier.equals(ident)) {
|
||||
List<PositionedStack> recipeOutputs = new ArrayList<>();
|
||||
recipeOutputs.add(recipe.getResultStack(recipeIndex));
|
||||
recipeOutputs.addAll(recipe.getOtherStacks(recipeIndex));
|
||||
return recipeOutputs;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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();
|
||||
}
|
||||
|
||||
List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier);
|
||||
|
||||
List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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")){
|
||||
NotEnoughEnergistics.logger.info("Found GregTech,install GregTech Support");
|
||||
recipeProcessors.add(new GregTechRecipeProcessor());
|
||||
}
|
||||
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());
|
||||
}
|
||||
NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Finished-----");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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 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