mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-17 02:45:29 +00:00
Add config to keep non-consumable NEI ingredients in ME patterns (#64)
This commit is contained in:
1 parent
3e785ca0db
commit
a6b64fdea9
5 files changed
+46
-15
No files matched your search
@@ -34,6 +34,7 @@ public class NEEConfig {
|
||||
public static boolean enableNEIDragDrop = true;
|
||||
public static boolean useStackSizeFromNEI = true;
|
||||
public static boolean keepGhostitems = true;
|
||||
public static boolean includeNonConsumableIngredients = false;
|
||||
|
||||
public static int draggedStackDefaultSize = 1;
|
||||
|
||||
@@ -85,6 +86,13 @@ public class NEEConfig {
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination").getStringList();
|
||||
|
||||
includeNonConsumableIngredients = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"includeNonConsumableIngredients",
|
||||
false,
|
||||
"If true, include non-consumable ingredients (NEI stackSize = 0) when transferring NEI recipes to ME patterns.")
|
||||
.getBoolean();
|
||||
}
|
||||
|
||||
{
|
||||
@@ -186,6 +194,13 @@ public class NEEConfig {
|
||||
"itemCombinationWhitelist",
|
||||
itemCombinationWhitelist,
|
||||
"Whitelist for item combination").getStringList();
|
||||
|
||||
includeNonConsumableIngredients = config.get(
|
||||
CATEGORY_PATTERN_TRANSFER,
|
||||
"includeNonConsumableIngredients",
|
||||
false,
|
||||
"If true, include non-consumable ingredients (NEI stackSize = 0) when transferring NEI recipes to ME patterns.")
|
||||
.getBoolean();
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import gregtech.api.enums.ItemList;
|
||||
@@ -100,7 +102,14 @@ public class GregTech5RecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (canProcessRecipe(recipe)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
recipeInputs.removeIf(positionedStack -> positionedStack.item.stackSize == 0);
|
||||
for (PositionedStack positionedStack : recipeInputs) {
|
||||
if (NEEConfig.includeNonConsumableIngredients && positionedStack.item.stackSize == 0) {
|
||||
positionedStack.item.stackSize = 1;
|
||||
}
|
||||
}
|
||||
recipeInputs.removeIf(
|
||||
positionedStack -> positionedStack.item.stackSize == 0
|
||||
&& !NEEConfig.includeNonConsumableIngredients);
|
||||
}
|
||||
|
||||
return recipeInputs;
|
||||
|
||||
@@ -10,6 +10,8 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.github.vfyjxf.nee.config.NEEConfig;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
@@ -47,10 +49,15 @@ public class GregTech6RecipeProcessor implements IRecipeProcessor {
|
||||
List<PositionedStack> recipeInputs = new ArrayList<>();
|
||||
if (this.getAllOverlayIdentifier().contains(identifier)) {
|
||||
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
|
||||
for (PositionedStack positionedStack : recipeInputs) {
|
||||
if (NEEConfig.includeNonConsumableIngredients && positionedStack.item.stackSize == 0) {
|
||||
positionedStack.item.stackSize = 1;
|
||||
}
|
||||
}
|
||||
// remove fluid
|
||||
recipeInputs.removeIf(
|
||||
positionedStack -> FL.getFluid(positionedStack.item, true) != null
|
||||
|| positionedStack.item.stackSize == 0);
|
||||
|| (positionedStack.item.stackSize == 0 && !NEEConfig.includeNonConsumableIngredients));
|
||||
// try to remove machine
|
||||
if (recipe instanceof NEI_RecipeMap) {
|
||||
Field mRecipeMapField = ReflectionHelper.findField(NEI_RecipeMap.class, "mRecipeMap");
|
||||
|
||||
Reference in new issue
Block a user