-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updata EnderIO support and Forestry support
- Loading branch information
Showing
14 changed files
with
209 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/github/vfyjxf/nee/processor/EnderIORecipeProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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 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; | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
src/main/java/com/github/vfyjxf/nee/processor/ForestryRecipeProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
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 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 | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.