fix more autocrafting bugs

This commit is contained in:
way2muchnoise
2017-01-03 15:23:16 +01:00
parent 947c7f0ae0
commit 722c5b64d8
3 changed files with 8 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
public class CraftingManager implements ICraftingManager { public class CraftingManager implements ICraftingManager {
private static final String NBT_CRAFTING_TASKS = "CraftingTasks"; private static final String NBT_CRAFTING_TASKS = "CraftingTasks";
@@ -230,7 +231,7 @@ public class CraftingManager implements ICraftingManager {
ItemStack inserted = ItemHandlerHelper.copyStackWithSize(stack, size); ItemStack inserted = ItemHandlerHelper.copyStackWithSize(stack, size);
for (ICraftingTask task : craftingTasks) { 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)) { if (processable.onReceiveOutput(inserted)) {
return; return;
} }

View File

@@ -98,7 +98,7 @@ public class CraftingPattern implements ICraftingPattern {
} }
} }
} else { } else {
outputs = ItemPattern.getOutputs(stack).stream().map(Comparer::stripTags).collect(Collectors.toList()); outputs = ItemPattern.getOutputs(stack).stream().collect(Collectors.toList());
} }
if (oreInputs.isEmpty()) { if (oreInputs.isEmpty()) {
@@ -194,7 +194,7 @@ public class CraftingPattern implements ICraftingPattern {
if (cleaned.isEmpty()) { if (cleaned.isEmpty()) {
return null; return null;
} }
outputs.add(Comparer.stripTags(cleaned.copy())); outputs.add(cleaned.copy());
return outputs; return outputs;
} }

View File

@@ -84,6 +84,10 @@ public class CraftingStepProcess extends CraftingStep {
IItemHandler inventory = getPattern().getContainer().getFacingInventory(); IItemHandler inventory = getPattern().getContainer().getFacingInventory();
if (insert(inventory, new ArrayDeque<>(actualInputs), true)) { if (insert(inventory, new ArrayDeque<>(actualInputs), true)) {
insert(inventory, actualInputs, false); insert(inventory, actualInputs, false);
} else {
// Something went wrong here, redo!
toInsertItems.addAll(actualInputs);
startedProcessing = false;
} }
} }
} }