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.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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user