Call cycle on possible fluid inputs.

This commit is contained in:
raoulvdberge
2020-07-11 15:54:59 +02:00
parent 9e19adc80e
commit a5e0060a56

View File

@@ -324,7 +324,6 @@ public class CraftingTask implements ICraftingTask {
} }
// Return false if we're exhausted. // Return false if we're exhausted.
// TODO: never called?
boolean cycle() { boolean cycle() {
if (pos + 1 >= possibilities.size()) { if (pos + 1 >= possibilities.size()) {
pos = 0; pos = 0;
@@ -560,11 +559,22 @@ public class CraftingTask implements ICraftingTask {
// fromSelf contains the amount crafted after the loop. // fromSelf contains the amount crafted after the loop.
this.toCraftFluids.add(fromSelf.copy()); this.toCraftFluids.add(fromSelf.copy());
} else { } else {
if (!possibleInputs.cycle()) {
// Give up.
possibleInput = possibleInputs.get(); // Revert back to 0.
this.missingFluids.add(possibleInput, remaining); this.missingFluids.add(possibleInput, remaining);
fluidsToExtract.add(possibleInput, remaining); fluidsToExtract.add(possibleInput, remaining);
remaining = 0; remaining = 0;
} else {
// Retry with new input...
possibleInput = possibleInputs.get();
fromSelf = fluidResults.get(possibleInput);
fromNetwork = mutatedFluidStorage.get(possibleInput);
}
} }
} }
} }