Let processing tasks insert immediately to avoid conflicts.

This commit is contained in:
raoulvdberge
2018-06-30 17:15:18 +02:00
parent d316fb0e5a
commit fb19aa2983

View File

@@ -107,6 +107,8 @@ public class CraftingExtractor {
} }
public void extractOne(@Nullable IItemHandler processingInventory) { public void extractOne(@Nullable IItemHandler processingInventory) {
boolean changed = false;
for (int i = 0; i < items.size(); ++i) { for (int i = 0; i < items.size(); ++i) {
if (status.get(i) == CraftingExtractorItemStatus.AVAILABLE) { if (status.get(i) == CraftingExtractorItemStatus.AVAILABLE) {
ItemStack extracted = network.extractItem(items.get(i), items.get(i).getCount(), CraftingTask.getFlags(items.get(i)), false); ItemStack extracted = network.extractItem(items.get(i), items.get(i).getCount(), CraftingTask.getFlags(items.get(i)), false);
@@ -116,7 +118,7 @@ public class CraftingExtractor {
if (processing) { if (processing) {
if (processingInventory == null) { if (processingInventory == null) {
throw new IllegalStateException("Processing inventory is suddenly null"); throw new IllegalStateException("Processing inventory is null");
} }
ItemStack remainder = ItemHandlerHelper.insertItem(processingInventory, extracted, false); ItemStack remainder = ItemHandlerHelper.insertItem(processingInventory, extracted, false);
@@ -127,11 +129,18 @@ public class CraftingExtractor {
status.set(i, CraftingExtractorItemStatus.EXTRACTED); status.set(i, CraftingExtractorItemStatus.EXTRACTED);
network.getCraftingManager().onTaskChanged(); changed = true;
return; // For processing patterns we want to insert all items at once to avoid conflicts with other crafting steps.
if (!processing) {
return;
}
} }
} }
if (changed) {
network.getCraftingManager().onTaskChanged();
}
} }
public NBTTagList writeToNbt() { public NBTTagList writeToNbt() {