mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-18 11:19:11 +00:00
Fixed forestry recipes (#11)
* Fixed forestry recipes * Adapt to change
This commit is contained in:
1 parent
20aecaa737
commit
8d26167423
1 file changed
+17
-85
@@ -2,15 +2,20 @@ package com.github.vfyjxf.nee.processor;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import forestry.factory.recipes.nei.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class ForestryRecipeProcessor implements IRecipeProcessor {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getAllOverlayIdentifier() {
|
||||
return new HashSet<>(Arrays.asList(
|
||||
"forestry.bottler", "forestry.carpenter", "forestry.centrifuge", "forestry.fabricator", "forestry.fermenter", "forestry.moistener", "forestry.squeezer", "forestry.still"
|
||||
));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeProcessorId() {
|
||||
@@ -20,94 +25,21 @@ public class ForestryRecipeProcessor implements IRecipeProcessor {
|
||||
@Nonnull
|
||||
@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);
|
||||
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
}
|
||||
return new ArrayList<>();
|
||||
return recipeInputs;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@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);
|
||||
|
||||
List<PositionedStack> recipeOutput = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeOutput.add(recipe.getResultStack(recipeIndex));
|
||||
}
|
||||
return new ArrayList<>();
|
||||
return recipeOutput;
|
||||
}
|
||||
|
||||
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 have an 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
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user