Fix crafting task update being called multiple times.
This commit is contained in:
@@ -48,6 +48,8 @@ public class CraftingTask implements ICraftingTask {
|
||||
IStackList<ItemStack> results = API.instance().createItemStackList();
|
||||
IStackList<ItemStack> storage = network.getItemStorageCache().getList().copy();
|
||||
|
||||
this.toCraft.add(requested, quantity);
|
||||
|
||||
while (qty > 0) {
|
||||
this.steps.add(calculateInternal(storage, results, pattern));
|
||||
|
||||
@@ -154,7 +156,7 @@ public class CraftingTask implements ICraftingTask {
|
||||
if (!step.isCompleted()) {
|
||||
allCompleted = false;
|
||||
|
||||
if (step.canExecute() && step.execute() && ticks % getTickInterval(step.getPattern().getContainer().getSpeedUpgradeCount()) == 0) { // TODO: speed upgrades handling
|
||||
if (ticks % getTickInterval(step.getPattern().getContainer().getSpeedUpgradeCount()) == 0 && step.canExecute() && step.execute()) {
|
||||
step.setCompleted();
|
||||
|
||||
network.getCraftingManager().sendCraftingMonitorUpdate();
|
||||
|
||||
@@ -17,8 +17,8 @@ public class StackListItem implements IStackList<ItemStack> {
|
||||
|
||||
@Override
|
||||
public void add(@Nonnull ItemStack stack, int size) {
|
||||
if (stack.isEmpty() || size <= 0) {
|
||||
return;
|
||||
if (stack == null || stack.isEmpty() || size <= 0) {
|
||||
throw new IllegalArgumentException("Cannot accept empty stack");
|
||||
}
|
||||
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
|
||||
Reference in New Issue
Block a user