fix more autocrafting bugs
This commit is contained in:
@@ -25,6 +25,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CraftingManager implements ICraftingManager {
|
||||
private static final String NBT_CRAFTING_TASKS = "CraftingTasks";
|
||||
@@ -230,7 +231,7 @@ public class CraftingManager implements ICraftingManager {
|
||||
ItemStack inserted = ItemHandlerHelper.copyStackWithSize(stack, size);
|
||||
|
||||
for (ICraftingTask task : craftingTasks) {
|
||||
for (ICraftingStep processable : task.getSteps()) {
|
||||
for (ICraftingStep processable : task.getSteps().stream().filter(ICraftingStep::hasStartedProcessing).collect(Collectors.toList())) {
|
||||
if (processable.onReceiveOutput(inserted)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
outputs = ItemPattern.getOutputs(stack).stream().map(Comparer::stripTags).collect(Collectors.toList());
|
||||
outputs = ItemPattern.getOutputs(stack).stream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (oreInputs.isEmpty()) {
|
||||
@@ -194,7 +194,7 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
if (cleaned.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
outputs.add(Comparer.stripTags(cleaned.copy()));
|
||||
outputs.add(cleaned.copy());
|
||||
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,10 @@ public class CraftingStepProcess extends CraftingStep {
|
||||
IItemHandler inventory = getPattern().getContainer().getFacingInventory();
|
||||
if (insert(inventory, new ArrayDeque<>(actualInputs), true)) {
|
||||
insert(inventory, actualInputs, false);
|
||||
} else {
|
||||
// Something went wrong here, redo!
|
||||
toInsertItems.addAll(actualInputs);
|
||||
startedProcessing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user