Skip to content

Commit a3b7978

Browse files
committed
Loosen restriction slightly on batch ingredient creation
1 parent 9615886 commit a3b7978

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/api/java/mekanism/api/recipes/ingredients/creator/IChemicalStackIngredientCreator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@ default STACK_INGREDIENT from(int amount, CHEMICAL... chemicals) {
5959
* @param chemicals Chemicals to match.
6060
*
6161
* @throws NullPointerException if the given instance is null.
62-
* @throws IllegalArgumentException if the given instance is empty or an amount smaller than one; or if no types or only a single type is passed. Call via
63-
* {@link #from(IChemicalProvider, long)} if you only have one element.
62+
* @throws IllegalArgumentException if the given instance is empty or an amount smaller than one; or if no chemicals are passed.
6463
* @since 10.6.0
6564
*/
6665
default STACK_INGREDIENT from(long amount, IChemicalProvider<CHEMICAL>... chemicals) {
67-
if (chemicals.length < 2) {
68-
throw new IllegalArgumentException("Attempted to create an ChemicalStackIngredients with less than two chemicals. At least one chemical is required, and if you only have one use from(IChemicalProvider, long) instead.");
66+
if (chemicals.length == 0) {
67+
throw new IllegalArgumentException("Attempted to create an ChemicalStackIngredients with no chemicals.");
6968
}
7069
return from(chemicalCreator().of(chemicals), amount);
7170
}

src/api/java/mekanism/api/recipes/ingredients/creator/IFluidStackIngredientCreator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ default FluidStackIngredient from(Fluid instance, int amount) {
6666
*/
6767
@Override
6868
default FluidStackIngredient from(int amount, Fluid... fluids) {
69-
if (fluids.length < 2) {
70-
throw new IllegalArgumentException("Attempted to create an FluidStackIngredient with less than two fluids. At least one fluid is required, and if you only have one use from(Fluid, int) instead.");
69+
if (fluids.length == 0) {
70+
throw new IllegalArgumentException("Attempted to create an FluidStackIngredient with no fluids.");
7171
}
7272
return from(FluidIngredient.of(fluids), amount);
7373
}

src/api/java/mekanism/api/recipes/ingredients/creator/IIngredientCreator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ public interface IIngredientCreator<TYPE, STACK, INGREDIENT extends InputIngredi
3636
/**
3737
* Creates an Ingredient that matches any of the provided types.
3838
*
39-
* @param amount Amount needed.
40-
* @param items Types to match.
39+
* @param amount Amount needed.
40+
* @param items Types to match.
4141
*
4242
* @throws NullPointerException if the given instance is null.
43-
* @throws IllegalArgumentException if the given instance is empty or an amount smaller than one; or if no types or only a single type is passed. Call via
44-
* {@link #from(Object, int)} if you only have one element.
43+
* @throws IllegalArgumentException if the given instance is empty or an amount smaller than one; or if no types are passed.
4544
* @since 10.6.0
4645
*/
4746
INGREDIENT from(int amount, TYPE... items);

src/api/java/mekanism/api/recipes/ingredients/creator/IItemStackIngredientCreator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ default ItemStackIngredient from(ItemLike item, int amount) {
9595
*
9696
* @param items Item providers that provides the items to match.
9797
*
98-
* @throws IllegalArgumentException if no items are passed, or only a single item is passed. Call via {@link #from(ItemLike)} if you only have one element.
98+
* @throws IllegalArgumentException if no items are passed.
9999
* @implNote This wraps via {@link #from(Ingredient)} so if there is any durability or default NBT it will <strong>NOT</strong> be included in the ingredient. If this
100100
* is not desired, manually create the ingredients via {@link DataComponentIngredient} and call {@link #from(Ingredient)}.
101101
* @since 10.6.0
@@ -110,14 +110,14 @@ default ItemStackIngredient from(ItemLike... items) {
110110
* @param amount Amount needed.
111111
* @param items Item providers that provides the items to match.
112112
*
113-
* @throws IllegalArgumentException if no items are passed, or only a single item is passed. Call via {@link #from(ItemLike, int)} if you only have one element.
113+
* @throws IllegalArgumentException if no items are passed.
114114
* @implNote This wraps via {@link #from(Ingredient, int)} so if there is any durability or default NBT it will <strong>NOT</strong> be included in the ingredient. If
115115
* this is not desired, manually create the ingredients via {@link DataComponentIngredient} and call {@link #from(Ingredient, int)}.
116116
* @since 10.6.0
117117
*/
118118
default ItemStackIngredient from(int amount, ItemLike... items) {
119-
if (items.length < 2) {
120-
throw new IllegalArgumentException("Attempted to create an ItemStackIngredient with less than two items. At least one item is required, and if you only have one use from(ItemLike, int) instead.");
119+
if (items.length == 0) {
120+
throw new IllegalArgumentException("Attempted to create an ItemStackIngredient with no items.");
121121
}
122122
return from(Ingredient.of(items), amount);
123123
}

0 commit comments

Comments
 (0)