Byproducts is always nonnull and nonempty

This commit is contained in:
raoulvdberge
2017-12-01 12:59:07 +01:00
parent 6221d33e50
commit 1c552532ad
2 changed files with 3 additions and 7 deletions

View File

@@ -100,10 +100,8 @@ public class CraftingStepCraft extends CraftingStep {
} }
for (ItemStack byproduct : (pattern.isOredict() ? pattern.getByproducts(took) : pattern.getByproducts())) { for (ItemStack byproduct : (pattern.isOredict() ? pattern.getByproducts(took) : pattern.getByproducts())) {
if (byproduct != null && !byproduct.isEmpty()) {
toInsertItems.add(byproduct.copy()); toInsertItems.add(byproduct.copy());
} }
}
} else { } else {
// Couldn't extract items // Couldn't extract items
startedProcessing = false; startedProcessing = false;

View File

@@ -129,7 +129,7 @@ public class CraftingTask implements ICraftingTask {
List<ICraftingStep> previousSteps = new LinkedList<>(); List<ICraftingStep> previousSteps = new LinkedList<>();
IStackList<ItemStack> byproductList = API.instance().createItemStackList(); IStackList<ItemStack> byproductList = API.instance().createItemStackList();
pattern.getByproducts().stream().filter(s -> !s.isEmpty()).forEach(byproductList::add); pattern.getByproducts().forEach(byproductList::add);
for (List<ItemStack> inputs : pattern.getOreInputs()) { for (List<ItemStack> inputs : pattern.getOreInputs()) {
if (inputs == null || inputs.isEmpty()) { if (inputs == null || inputs.isEmpty()) {
@@ -303,10 +303,8 @@ public class CraftingTask implements ICraftingTask {
} }
for (ItemStack byproduct : (!pattern.isProcessing() && pattern.isOredict() && missing.isEmpty()) ? pattern.getByproducts(took) : pattern.getByproducts()) { for (ItemStack byproduct : (!pattern.isProcessing() && pattern.isOredict() && missing.isEmpty()) ? pattern.getByproducts(took) : pattern.getByproducts()) {
if (byproduct != null && !byproduct.isEmpty()) {
toInsert.add(byproduct); toInsert.add(byproduct);
} }
}
usedPatterns.remove(pattern); usedPatterns.remove(pattern);