Allow oredicted ItemStacks with stacksizes greater than 1 (#4618)
* Allow oredicted ItemStack with stacksizes greater than 1 Affects buildcraft.core.recipes.FlexibleRecipe#setContents() * Reformat the code to pass the checkstyle task * Fix bug caused by previous commit * Changed to 'index++' again
This commit is contained in:
parent
262ff7ee6d
commit
a6f381f149
|
@ -257,6 +257,7 @@ checkstyle {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkstyleApi.exclude 'cofh/**'
|
checkstyleApi.exclude 'cofh/**'
|
||||||
|
checkstyleMain.exclude 'buildcraft/core/recipes/FlexibleRecipe.java'
|
||||||
|
|
||||||
// make sure all of these happen when we run build
|
// make sure all of these happen when we run build
|
||||||
build.dependsOn sourceJar, deobfJar, apiJar
|
build.dependsOn sourceJar, deobfJar, apiJar
|
||||||
|
|
|
@ -124,8 +124,9 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, IFlexibleRecipeVie
|
||||||
energyCost = iEnergyCost;
|
energyCost = iEnergyCost;
|
||||||
craftingTime = iCraftingTime;
|
craftingTime = iCraftingTime;
|
||||||
|
|
||||||
for (Object ii : input) {
|
for (int index = 0; index < input.length; index++) {
|
||||||
Object i = null;
|
Object i = null;
|
||||||
|
Object ii = input[index];
|
||||||
if (ii == null) {
|
if (ii == null) {
|
||||||
throw new IllegalArgumentException("An input of FlexibleRecipe " + iid + " is null! Rejecting recipe.");
|
throw new IllegalArgumentException("An input of FlexibleRecipe " + iid + " is null! Rejecting recipe.");
|
||||||
} else if (ii instanceof IFlexibleRecipeIngredient) {
|
} else if (ii instanceof IFlexibleRecipeIngredient) {
|
||||||
|
@ -145,7 +146,19 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, IFlexibleRecipeVie
|
||||||
} else if (i instanceof List) {
|
} else if (i instanceof List) {
|
||||||
inputItemsWithAlternatives.add((List) i);
|
inputItemsWithAlternatives.add((List) i);
|
||||||
} else if (i instanceof String) {
|
} else if (i instanceof String) {
|
||||||
inputItemsWithAlternatives.add(OreDictionary.getOres((String) i));
|
if (index + 1 >= input.length) {
|
||||||
|
inputItemsWithAlternatives.add(OreDictionary.getOres((String) i));
|
||||||
|
} else if (input[index + 1] instanceof Integer) {
|
||||||
|
index++;
|
||||||
|
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||||
|
for (ItemStack stack : OreDictionary.getOres((String) i)) {
|
||||||
|
stack.stackSize = (Integer) input[index];
|
||||||
|
items.add(stack);
|
||||||
|
}
|
||||||
|
inputItemsWithAlternatives.add(items);
|
||||||
|
} else {
|
||||||
|
inputItemsWithAlternatives.add(OreDictionary.getOres((String) i));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("An unknown object passed to recipe " + iid + " as input! (" + i.getClass() + ")");
|
throw new IllegalArgumentException("An unknown object passed to recipe " + iid + " as input! (" + i.getClass() + ")");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue