mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-18 07:53:07 +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.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
@ -159,13 +158,17 @@ public class RecipeGridHandler {
|
|||
}
|
||||
|
||||
public static boolean isRecipeAllowed(CraftingRecipe recipe, CraftingContainer inventory) {
|
||||
if (!AllConfigs.SERVER.recipes.allowBiggerFireworksInCrafter.get() && recipe instanceof FireworkRocketRecipe) {
|
||||
int numItems = IntStream.range(0, inventory.getContainerSize())
|
||||
.map(i -> inventory.getItem(i).isEmpty() ? 0 : 1)
|
||||
.sum();
|
||||
if (numItems > 9)
|
||||
if (recipe instanceof FireworkRocketRecipe) {
|
||||
int numItems = 0;
|
||||
for (int i = 0; i < inventory.getContainerSize(); i++) {
|
||||
if (!inventory.getItem(i).isEmpty()) {
|
||||
numItems++;
|
||||
}
|
||||
}
|
||||
if (numItems > AllConfigs.SERVER.recipes.maxFireworkIngredientsInCrafter.get()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (AllRecipeTypes.shouldIgnoreInAutomation(recipe))
|
||||
return false;
|
||||
return true;
|
||||
|
|
|
@ -8,8 +8,8 @@ public class CRecipes extends ConfigBase {
|
|||
public final ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
|
||||
public final ConfigBool allowRegularCraftingInCrafter =
|
||||
b(true, "allowRegularCraftingInCrafter", Comments.allowRegularCraftingInCrafter);
|
||||
public final ConfigBool allowBiggerFireworksInCrafter =
|
||||
b(false, "allowBiggerFireworksInCrafter", Comments.allowBiggerFireworksInCrafter);
|
||||
public final ConfigInt maxFireworkIngredientsInCrafter =
|
||||
i(9, 1, "maxFireworkIngredientsInCrafter", Comments.maxFireworkIngredientsInCrafter);
|
||||
public final ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
|
||||
public final ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
|
||||
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.";
|
||||
static String allowRegularCraftingInCrafter =
|
||||
"Allow any standard crafting recipes to be processed by Mechanical Crafters.";
|
||||
static String allowBiggerFireworksInCrafter =
|
||||
"Allow Firework Rockets with more than 9 ingredients to be crafted using Mechanical Crafters.";
|
||||
static String maxFireworkIngredientsInCrafter =
|
||||
"The Maximum amount of ingredients that can be used to craft Firework Rockets using Mechanical Crafters.";
|
||||
static String allowStonecuttingOnSaw =
|
||||
"Allow any stonecutting recipes to be processed by a Mechanical Saw.";
|
||||
static String allowWoodcuttingOnSaw =
|
||||
|
|
Loading…
Reference in a new issue