Keep track if a crafting task was made in automated way for an upcoming feature in the crafting monitor

This commit is contained in:
raoulvdberge
2017-01-29 20:37:31 +01:00
parent fcf707ea2c
commit 81e94ef727
7 changed files with 96 additions and 76 deletions

View File

@@ -36,9 +36,10 @@ public interface ICraftingManager {
* @param stack the stack to create a task for * @param stack the stack to create a task for
* @param pattern the pattern * @param pattern the pattern
* @param quantity the quantity * @param quantity the quantity
* @param automated whether this crafting task is created in an automated way
* @return the crafting task * @return the crafting task
*/ */
ICraftingTask create(@Nullable ItemStack stack, ICraftingPattern pattern, int quantity); ICraftingTask create(@Nullable ItemStack stack, ICraftingPattern pattern, int quantity, boolean automated);
/** /**
* Creates a crafting task. * Creates a crafting task.
@@ -46,9 +47,10 @@ public interface ICraftingManager {
* @param stack the stack to create a task for * @param stack the stack to create a task for
* @param patternChain the pattern * @param patternChain the pattern
* @param quantity the quantity * @param quantity the quantity
* @param automated whether this crafting task is created in an automated way
* @return the crafting task * @return the crafting task
*/ */
ICraftingTask create(@Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity); ICraftingTask create(@Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity, boolean automated);
/** /**
* Schedules a crafting task if the task isn't scheduled yet. * Schedules a crafting task if the task isn't scheduled yet.
@@ -100,6 +102,7 @@ public interface ICraftingManager {
@Nullable @Nullable
default ICraftingPattern getPattern(ItemStack pattern, int flags) { default ICraftingPattern getPattern(ItemStack pattern, int flags) {
ICraftingPatternChain chain = getPatternChain(pattern, flags); ICraftingPatternChain chain = getPatternChain(pattern, flags);
return chain == null ? null : chain.cycle(); return chain == null ? null : chain.cycle();
} }
@@ -109,14 +112,15 @@ public interface ICraftingManager {
* Internally, this makes a selection out of the available patterns. * Internally, this makes a selection out of the available patterns.
* It makes this selection based on the item count of the pattern outputs in the {@link IStackList<ItemStack>} provided. * It makes this selection based on the item count of the pattern outputs in the {@link IStackList<ItemStack>} provided.
* *
* @param pattern the stack to get a pattern for * @param pattern the stack to get a pattern for
* @param flags the flags to compare on, see {@link IComparer} * @param flags the flags to compare on, see {@link IComparer}
* @param itemList the {@link IStackList<ItemStack>} used to calculate the best fitting pattern * @param itemList the {@link IStackList<ItemStack>} used to calculate the best fitting pattern
* @return the pattern, or null if the pattern is not found * @return the pattern, or null if the pattern is not found
*/ */
@Nullable @Nullable
default ICraftingPattern getPattern(ItemStack pattern, int flags, IStackList<ItemStack> itemList) { default ICraftingPattern getPattern(ItemStack pattern, int flags, IStackList<ItemStack> itemList) {
ICraftingPatternChain chain = getPatternChain(pattern, flags, itemList); ICraftingPatternChain chain = getPatternChain(pattern, flags, itemList);
return chain == null ? null : chain.cycle(); return chain == null ? null : chain.cycle();
} }
@@ -153,8 +157,8 @@ public interface ICraftingManager {
* Internally, this makes a selection out of the available patterns. * Internally, this makes a selection out of the available patterns.
* It makes this selection based on the item count of the pattern outputs in the {@link IStackList<ItemStack>} provided. * It makes this selection based on the item count of the pattern outputs in the {@link IStackList<ItemStack>} provided.
* *
* @param pattern the stack to get a pattern for * @param pattern the stack to get a pattern for
* @param flags the flags to compare on, see {@link IComparer} * @param flags the flags to compare on, see {@link IComparer}
* @param itemList the {@link IStackList<ItemStack>} used to calculate the best fitting pattern * @param itemList the {@link IStackList<ItemStack>} used to calculate the best fitting pattern
* @return the pattern chain, or null if the pattern chain is not found * @return the pattern chain, or null if the pattern chain is not found
*/ */

View File

@@ -1,7 +1,7 @@
package com.raoulvdberge.refinedstorage.api.autocrafting.registry; package com.raoulvdberge.refinedstorage.api.autocrafting.registry;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern; import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask; import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster; import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -18,25 +18,27 @@ public interface ICraftingTaskFactory {
/** /**
* Returns a crafting task for a given NBT tag and pattern. * Returns a crafting task for a given NBT tag and pattern.
* *
* @param network the network * @param network the network
* @param stack the stack to create task for * @param stack the stack to create task for
* @param pattern the pattern * @param pattern the pattern
* @param quantity the quantity * @param quantity the quantity
* @param tag the NBT tag, if this is null it isn't reading from disk but is used for making a task on demand * @param automated whether this crafting task is created in an automated way
* @param tag the NBT tag, if this is null it isn't reading from disk but is used for making a task on demand
* @return the crafting task * @return the crafting task
*/ */
@Nonnull @Nonnull
ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag); ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity, boolean automated, @Nullable NBTTagCompound tag);
/** /**
* Returns a crafting task for a given NBT tag and pattern. * Returns a crafting task for a given NBT tag and pattern.
* *
* @param network the network * @param network the network
* @param stack the stack to create task for * @param stack the stack to create task for
* @param patternChain the patternChain * @param patternChain the pattern chain
* @param quantity the quantity * @param quantity the quantity
* @param automated whether this crafting task is created in an automated way
* @return the crafting task * @return the crafting task
*/ */
@Nonnull @Nonnull
ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity); ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity, boolean automated);
} }

View File

@@ -127,4 +127,9 @@ public interface ICraftingTask {
* @return get a list of {@link ICraftingPreviewElement}s * @return get a list of {@link ICraftingPreviewElement}s
*/ */
List<ICraftingPreviewElement> getPreviewStacks(); List<ICraftingPreviewElement> getPreviewStacks();
/**
* @return whether this crafting task is created in an automated way
*/
boolean isAutomated();
} }

View File

@@ -1,10 +1,6 @@
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting; package com.raoulvdberge.refinedstorage.apiimpl.autocrafting;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain; import com.raoulvdberge.refinedstorage.api.autocrafting.*;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskFactory; import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingStep; import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingStep;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask; import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
@@ -67,13 +63,13 @@ public class CraftingManager implements ICraftingManager {
} }
@Override @Override
public ICraftingTask create(@Nullable ItemStack stack, ICraftingPattern pattern, int quantity) { public ICraftingTask create(@Nullable ItemStack stack, ICraftingPattern pattern, int quantity, boolean automated) {
return API.instance().getCraftingTaskRegistry().get(pattern.getId()).create(network, stack, pattern, quantity, null); return API.instance().getCraftingTaskRegistry().get(pattern.getId()).create(network, stack, pattern, quantity, automated, null);
} }
@Override @Override
public ICraftingTask create(@Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity) { public ICraftingTask create(@Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity, boolean automated) {
return API.instance().getCraftingTaskRegistry().get(patternChain.getPrototype().getId()).create( network, stack, patternChain, quantity); return API.instance().getCraftingTaskRegistry().get(patternChain.getPrototype().getId()).create(network, stack, patternChain, quantity, automated);
} }
@Override @Override
@@ -242,7 +238,7 @@ public class CraftingManager implements ICraftingManager {
ICraftingPatternChain patternChain = getPatternChain(stack, compare); ICraftingPatternChain patternChain = getPatternChain(stack, compare);
if (patternChain != null) { if (patternChain != null) {
ICraftingTask task = create(stack, patternChain, toSchedule); ICraftingTask task = create(stack, patternChain, toSchedule, true);
task.calculate(); task.calculate();
task.getMissing().clear(); task.getMissing().clear();
@@ -293,7 +289,7 @@ public class CraftingManager implements ICraftingManager {
ICraftingTaskFactory factory = API.instance().getCraftingTaskRegistry().get(tag.getString(ICraftingTask.NBT_PATTERN_ID)); ICraftingTaskFactory factory = API.instance().getCraftingTaskRegistry().get(tag.getString(ICraftingTask.NBT_PATTERN_ID));
if (factory != null) { if (factory != null) {
return factory.create(network, tag.hasKey(ICraftingTask.NBT_REQUESTED) ? new ItemStack(tag.getCompoundTag(ICraftingTask.NBT_REQUESTED)) : null, pattern, tag.getInteger(ICraftingTask.NBT_QUANTITY), tag); return factory.create(network, tag.hasKey(ICraftingTask.NBT_REQUESTED) ? new ItemStack(tag.getCompoundTag(ICraftingTask.NBT_REQUESTED)) : null, pattern, tag.getInteger(ICraftingTask.NBT_QUANTITY), false, tag);
} }
} }
} }

View File

@@ -1,8 +1,8 @@
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.registry; package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.registry;
import com.raoulvdberge.refinedstorage.RSUtils; import com.raoulvdberge.refinedstorage.RSUtils;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern; import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskFactory; import com.raoulvdberge.refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingStep; import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingStep;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask; import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
@@ -28,7 +28,7 @@ public class CraftingTaskFactory implements ICraftingTaskFactory {
@Override @Override
@Nonnull @Nonnull
public ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag) { public ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity, boolean automated, @Nullable NBTTagCompound tag) {
if (tag != null) { if (tag != null) {
NBTTagList stepsList = tag.getTagList(CraftingTask.NBT_STEPS, Constants.NBT.TAG_COMPOUND); NBTTagList stepsList = tag.getTagList(CraftingTask.NBT_STEPS, Constants.NBT.TAG_COMPOUND);
@@ -70,15 +70,15 @@ public class CraftingTaskFactory implements ICraftingTaskFactory {
} }
} }
return new CraftingTask(network, stack, pattern, quantity, steps, toInsert, toTakeFluids, toInsertFluids); return new CraftingTask(network, stack, pattern, quantity, steps, toInsert, toTakeFluids, toInsertFluids, tag.hasKey(CraftingTask.NBT_AUTOMATED) && tag.getBoolean(CraftingTask.NBT_AUTOMATED));
} }
return new CraftingTask(network, stack, pattern, quantity); return new CraftingTask(network, stack, pattern, quantity, automated);
} }
@Nonnull @Nonnull
@Override @Override
public ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity) { public ICraftingTask create(INetworkMaster network, @Nullable ItemStack stack, ICraftingPatternChain patternChain, int quantity, boolean automated) {
return new CraftingTask(network, stack, patternChain, quantity); return new CraftingTask(network, stack, patternChain, quantity, automated);
} }
} }

View File

@@ -1,8 +1,8 @@
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task; package com.raoulvdberge.refinedstorage.apiimpl.autocrafting.task;
import com.raoulvdberge.refinedstorage.RSUtils; import com.raoulvdberge.refinedstorage.RSUtils;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern; import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternChain;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer; import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement; import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementList; import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementList;
@@ -38,6 +38,7 @@ public class CraftingTask implements ICraftingTask {
public static final String NBT_TO_TAKE_FLUIDS = "ToTakeFluids"; public static final String NBT_TO_TAKE_FLUIDS = "ToTakeFluids";
public static final String NBT_TO_INSERT_ITEMS = "ToInsertItems"; public static final String NBT_TO_INSERT_ITEMS = "ToInsertItems";
public static final String NBT_TO_INSERT_FLUIDS = "ToInsertFluids"; public static final String NBT_TO_INSERT_FLUIDS = "ToInsertFluids";
public static final String NBT_AUTOMATED = "Automated";
private INetworkMaster network; private INetworkMaster network;
@Nullable @Nullable
@@ -45,6 +46,7 @@ public class CraftingTask implements ICraftingTask {
private ICraftingPattern pattern; private ICraftingPattern pattern;
private ICraftingPatternChain chain; private ICraftingPatternChain chain;
private int quantity; private int quantity;
private boolean automated;
private List<ICraftingStep> mainSteps = new LinkedList<>(); private List<ICraftingStep> mainSteps = new LinkedList<>();
private IStackList<ItemStack> toTake = API.instance().createItemStackList(); private IStackList<ItemStack> toTake = API.instance().createItemStackList();
private IStackList<ItemStack> toCraft = API.instance().createItemStackList(); private IStackList<ItemStack> toCraft = API.instance().createItemStackList();
@@ -55,20 +57,23 @@ public class CraftingTask implements ICraftingTask {
private Deque<FluidStack> toInsertFluids = new ArrayDeque<>(); private Deque<FluidStack> toInsertFluids = new ArrayDeque<>();
private IStackList<FluidStack> toTakeFluids = API.instance().createFluidStackList(); private IStackList<FluidStack> toTakeFluids = API.instance().createFluidStackList();
public CraftingTask(INetworkMaster network, @Nullable ItemStack requested, ICraftingPattern pattern, int quantity) { public CraftingTask(INetworkMaster network, @Nullable ItemStack requested, ICraftingPattern pattern, int quantity, boolean automated) {
this.network = network; this.network = network;
this.requested = requested; this.requested = requested;
this.pattern = pattern; this.pattern = pattern;
this.quantity = quantity; this.quantity = quantity;
this.automated = automated;
} }
public CraftingTask(INetworkMaster network, @Nullable ItemStack requested, ICraftingPatternChain chain, int quantity) { public CraftingTask(INetworkMaster network, @Nullable ItemStack requested, ICraftingPatternChain chain, int quantity, boolean automated) {
this(network, requested, chain.getPrototype(), quantity); this(network, requested, chain.getPrototype(), quantity, automated);
this.chain = chain; this.chain = chain;
} }
public CraftingTask(INetworkMaster network, @Nullable ItemStack requested, ICraftingPattern pattern, int quantity, List<ICraftingStep> mainSteps, Deque<ItemStack> toInsertItems, IStackList<FluidStack> toTakeFluids, Deque<FluidStack> toInsertFluids) { public CraftingTask(INetworkMaster network, @Nullable ItemStack requested, ICraftingPattern pattern, int quantity, List<ICraftingStep> mainSteps, Deque<ItemStack> toInsertItems, IStackList<FluidStack> toTakeFluids, Deque<FluidStack> toInsertFluids, boolean automated) {
this(network, requested, pattern, quantity); this(network, requested, pattern, quantity, automated);
this.mainSteps = mainSteps; this.mainSteps = mainSteps;
this.toInsertItems = toInsertItems; this.toInsertItems = toInsertItems;
this.toTakeFluids = toTakeFluids; this.toTakeFluids = toTakeFluids;
@@ -133,7 +138,8 @@ public class CraftingTask implements ICraftingTask {
extraStack = toInsert.get(input, compare); extraStack = toInsert.get(input, compare);
networkStack = networkList.get(input, compare); networkStack = networkList.get(input, compare);
} while (extraStack == null && networkStack == null && ++i < inputs.size() && network.getCraftingManager().hasPattern(input, compare)); }
while (extraStack == null && networkStack == null && ++i < inputs.size() && network.getCraftingManager().hasPattern(input, compare));
if (i == inputs.size()) { if (i == inputs.size()) {
input = inputs.get(0).copy(); input = inputs.get(0).copy();
} }
@@ -330,13 +336,14 @@ public class CraftingTask implements ICraftingTask {
@Override @Override
public String toString() { public String toString() {
return "\nCraftingTask{quantity=" + quantity + return "\nCraftingTask{quantity=" + quantity +
"\n, toTake=" + toTake + "\n, automated=" + automated +
"\n, toTakeFluids=" + toTakeFluids + "\n, toTake=" + toTake +
"\n, toCraft=" + toCraft + "\n, toTakeFluids=" + toTakeFluids +
"\n, toInsertItems=" + toInsertItems + "\n, toCraft=" + toCraft +
"\n, toInsertFluids=" + toInsertFluids + "\n, toInsertItems=" + toInsertItems +
"\n, mainSteps=" + mainSteps + "\n, toInsertFluids=" + toInsertFluids +
'}'; "\n, mainSteps=" + mainSteps +
'}';
} }
@Override @Override
@@ -395,7 +402,7 @@ public class CraftingTask implements ICraftingTask {
if (timesUsed++ <= container.getSpeedUpdateCount()) { if (timesUsed++ <= container.getSpeedUpdateCount()) {
if (!step.getPattern().isProcessing() || !container.isBlocked()) { if (!step.getPattern().isProcessing() || !container.isBlocked()) {
if (step.canStartProcessing(oreDictPrepped, networkFluids)){ if (step.canStartProcessing(oreDictPrepped, networkFluids)) {
step.setStartedProcessing(); step.setStartedProcessing();
step.execute(toInsertItems, toInsertFluids); step.execute(toInsertItems, toInsertFluids);
usedContainers.put(container, timesUsed); usedContainers.put(container, timesUsed);
@@ -407,7 +414,6 @@ public class CraftingTask implements ICraftingTask {
} }
if (getSteps().stream().filter(ICraftingStep::hasStartedProcessing).count() == 0) { if (getSteps().stream().filter(ICraftingStep::hasStartedProcessing).count() == 0) {
// When there is no started processes, restart the task. // When there is no started processes, restart the task.
reschedule(); reschedule();
@@ -486,6 +492,8 @@ public class CraftingTask implements ICraftingTask {
tag.setTag(NBT_TO_INSERT_FLUIDS, toInsertFluidsList); tag.setTag(NBT_TO_INSERT_FLUIDS, toInsertFluidsList);
tag.setBoolean(NBT_AUTOMATED, automated);
return tag; return tag;
} }
@@ -494,23 +502,23 @@ public class CraftingTask implements ICraftingTask {
ICraftingMonitorElementList elements = API.instance().createCraftingMonitorElementList(); ICraftingMonitorElementList elements = API.instance().createCraftingMonitorElementList();
elements.directAdd(new CraftingMonitorElementItemRender( elements.directAdd(new CraftingMonitorElementItemRender(
network.getCraftingManager().getTasks().indexOf(this), network.getCraftingManager().getTasks().indexOf(this),
requested != null ? requested : pattern.getOutputs().get(0), requested != null ? requested : pattern.getOutputs().get(0),
quantity, quantity,
0 0
)); ));
if (!missing.isEmpty()) { if (!missing.isEmpty()) {
elements.directAdd(new CraftingMonitorElementText("gui.refinedstorage:crafting_monitor.items_missing", 16)); elements.directAdd(new CraftingMonitorElementText("gui.refinedstorage:crafting_monitor.items_missing", 16));
missing.getStacks().stream() missing.getStacks().stream()
.map(stack -> new CraftingMonitorElementError(new CraftingMonitorElementItemRender( .map(stack -> new CraftingMonitorElementError(new CraftingMonitorElementItemRender(
-1, -1,
stack, stack,
stack.getCount(), stack.getCount(),
32 32
), "")) ), ""))
.forEach(elements::add); .forEach(elements::add);
elements.commit(); elements.commit();
} }
@@ -519,13 +527,13 @@ public class CraftingTask implements ICraftingTask {
elements.directAdd(new CraftingMonitorElementText("gui.refinedstorage:crafting_monitor.items_inserting", 16)); elements.directAdd(new CraftingMonitorElementText("gui.refinedstorage:crafting_monitor.items_inserting", 16));
toInsertItems.stream() toInsertItems.stream()
.map(stack -> new CraftingMonitorElementItemRender( .map(stack -> new CraftingMonitorElementItemRender(
-1, -1,
stack, stack,
stack.getCount(), stack.getCount(),
32 32
)) ))
.forEach(elements::add); .forEach(elements::add);
elements.commit(); elements.commit();
} }
@@ -540,10 +548,10 @@ public class CraftingTask implements ICraftingTask {
for (ICraftingStep step : getSteps().stream().filter(s -> !s.getPattern().isProcessing()).collect(Collectors.toList())) { for (ICraftingStep step : getSteps().stream().filter(s -> !s.getPattern().isProcessing()).collect(Collectors.toList())) {
for (int i = 0; i < step.getPattern().getOutputs().size(); ++i) { for (int i = 0; i < step.getPattern().getOutputs().size(); ++i) {
ICraftingMonitorElement element = new CraftingMonitorElementItemRender( ICraftingMonitorElement element = new CraftingMonitorElementItemRender(
-1, -1,
step.getPattern().getOutputs().get(i), step.getPattern().getOutputs().get(i),
step.getPattern().getOutputs().get(i).getCount(), step.getPattern().getOutputs().get(i).getCount(),
32 32
); );
if (!step.hasStartedProcessing() && !step.canStartProcessing(oreDictPrepped, networkFluids)) { if (!step.hasStartedProcessing() && !step.canStartProcessing(oreDictPrepped, networkFluids)) {
@@ -563,10 +571,10 @@ public class CraftingTask implements ICraftingTask {
for (ICraftingStep step : getSteps().stream().filter(s -> s.getPattern().isProcessing()).collect(Collectors.toList())) { for (ICraftingStep step : getSteps().stream().filter(s -> s.getPattern().isProcessing()).collect(Collectors.toList())) {
for (int i = 0; i < step.getPattern().getOutputs().size(); ++i) { for (int i = 0; i < step.getPattern().getOutputs().size(); ++i) {
ICraftingMonitorElement element = new CraftingMonitorElementItemRender( ICraftingMonitorElement element = new CraftingMonitorElementItemRender(
-1, -1,
step.getPattern().getOutputs().get(i), step.getPattern().getOutputs().get(i),
step.getPattern().getOutputs().get(i).getCount(), step.getPattern().getOutputs().get(i).getCount(),
32 32
); );
if (step.getPattern().getContainer().getFacingTile() == null) { if (step.getPattern().getContainer().getFacingTile() == null) {
@@ -661,6 +669,11 @@ public class CraftingTask implements ICraftingTask {
return elements; return elements;
} }
@Override
public boolean isAutomated() {
return automated;
}
@Override @Override
public boolean isFinished() { public boolean isFinished() {
return mainSteps.stream().allMatch(ICraftingStep::hasReceivedOutputs); return mainSteps.stream().allMatch(ICraftingStep::hasReceivedOutputs);

View File

@@ -169,7 +169,7 @@ public class ItemGridHandler implements IItemGridHandler {
if (stack != null) { if (stack != null) {
Thread calculationThread = new Thread(() -> { Thread calculationThread = new Thread(() -> {
ICraftingTask task = new CraftingTask(network, stack, network.getCraftingManager().getPatternChain(stack), quantity); ICraftingTask task = new CraftingTask(network, stack, network.getCraftingManager().getPatternChain(stack), quantity, false);
task.calculate(); task.calculate();
@@ -193,7 +193,7 @@ public class ItemGridHandler implements IItemGridHandler {
} }
if (stack != null) { if (stack != null) {
ICraftingTask task = new CraftingTask(network, stack, network.getCraftingManager().getPatternChain(stack), quantity); ICraftingTask task = new CraftingTask(network, stack, network.getCraftingManager().getPatternChain(stack), quantity, false);
task.calculate(); task.calculate();