mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 02:33:43 +01:00
Allow configuring max amount of firework ingredients
- Replace boolean allowBiggerFireworksInCrafter config with int maxFireworkIngredientsInCrafter config
This commit is contained in:
parent
1b602c00d5
commit
6ed8d31af0
2 changed files with 13 additions and 10 deletions
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
@ -159,13 +158,17 @@ public class RecipeGridHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRecipeAllowed(CraftingRecipe recipe, CraftingContainer inventory) {
|
public static boolean isRecipeAllowed(CraftingRecipe recipe, CraftingContainer inventory) {
|
||||||
if (!AllConfigs.SERVER.recipes.allowBiggerFireworksInCrafter.get() && recipe instanceof FireworkRocketRecipe) {
|
if (recipe instanceof FireworkRocketRecipe) {
|
||||||
int numItems = IntStream.range(0, inventory.getContainerSize())
|
int numItems = 0;
|
||||||
.map(i -> inventory.getItem(i).isEmpty() ? 0 : 1)
|
for (int i = 0; i < inventory.getContainerSize(); i++) {
|
||||||
.sum();
|
if (!inventory.getItem(i).isEmpty()) {
|
||||||
if (numItems > 9)
|
numItems++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (numItems > AllConfigs.SERVER.recipes.maxFireworkIngredientsInCrafter.get()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (AllRecipeTypes.shouldIgnoreInAutomation(recipe))
|
if (AllRecipeTypes.shouldIgnoreInAutomation(recipe))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -8,8 +8,8 @@ public class CRecipes extends ConfigBase {
|
||||||
public final ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
|
public final ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
|
||||||
public final ConfigBool allowRegularCraftingInCrafter =
|
public final ConfigBool allowRegularCraftingInCrafter =
|
||||||
b(true, "allowRegularCraftingInCrafter", Comments.allowRegularCraftingInCrafter);
|
b(true, "allowRegularCraftingInCrafter", Comments.allowRegularCraftingInCrafter);
|
||||||
public final ConfigBool allowBiggerFireworksInCrafter =
|
public final ConfigInt maxFireworkIngredientsInCrafter =
|
||||||
b(false, "allowBiggerFireworksInCrafter", Comments.allowBiggerFireworksInCrafter);
|
i(9, 1, "maxFireworkIngredientsInCrafter", Comments.maxFireworkIngredientsInCrafter);
|
||||||
public final ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
|
public final ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
|
||||||
public final ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
|
public final ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
|
||||||
public final ConfigBool allowCastingBySpout = b(true, "allowCastingBySpout", Comments.allowCastingBySpout);
|
public final ConfigBool allowCastingBySpout = b(true, "allowCastingBySpout", Comments.allowCastingBySpout);
|
||||||
|
@ -34,8 +34,8 @@ public class CRecipes extends ConfigBase {
|
||||||
"Allow any single-ingredient 2x2 or 3x3 crafting recipes to be processed by a Mechanical Press + Basin.";
|
"Allow any single-ingredient 2x2 or 3x3 crafting recipes to be processed by a Mechanical Press + Basin.";
|
||||||
static String allowRegularCraftingInCrafter =
|
static String allowRegularCraftingInCrafter =
|
||||||
"Allow any standard crafting recipes to be processed by Mechanical Crafters.";
|
"Allow any standard crafting recipes to be processed by Mechanical Crafters.";
|
||||||
static String allowBiggerFireworksInCrafter =
|
static String maxFireworkIngredientsInCrafter =
|
||||||
"Allow Firework Rockets with more than 9 ingredients to be crafted using Mechanical Crafters.";
|
"The Maximum amount of ingredients that can be used to craft Firework Rockets using Mechanical Crafters.";
|
||||||
static String allowStonecuttingOnSaw =
|
static String allowStonecuttingOnSaw =
|
||||||
"Allow any stonecutting recipes to be processed by a Mechanical Saw.";
|
"Allow any stonecutting recipes to be processed by a Mechanical Saw.";
|
||||||
static String allowWoodcuttingOnSaw =
|
static String allowWoodcuttingOnSaw =
|
||||||
|
|
Loading…
Reference in a new issue