Fix crafting task issues
This commit is contained in:
@@ -85,7 +85,7 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
|
||||
private List<ClientSideMachine> clientSideMachines = new ArrayList<ClientSideMachine>();
|
||||
|
||||
private List<CraftingPattern> patterns = new ArrayList<CraftingPattern>();
|
||||
private List<ICraftingTask> craftingTasks = new ArrayList<ICraftingTask>();
|
||||
private Stack<ICraftingTask> craftingTasks = new Stack<ICraftingTask>();
|
||||
private List<ICraftingTask> craftingTasksToAdd = new ArrayList<ICraftingTask>();
|
||||
private List<ICraftingTask> craftingTasksToCancel = new ArrayList<ICraftingTask>();
|
||||
|
||||
@@ -143,15 +143,12 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
|
||||
craftingTasks.addAll(craftingTasksToAdd);
|
||||
craftingTasksToAdd.clear();
|
||||
|
||||
Iterator<ICraftingTask> craftingTaskIterator = craftingTasks.iterator();
|
||||
if (!craftingTasks.empty()) {
|
||||
ICraftingTask top = craftingTasks.peek();
|
||||
if (ticks % top.getPattern().getCrafter(worldObj).getSpeed() == 0 && top.update(this)) {
|
||||
top.onDone(this);
|
||||
|
||||
while (craftingTaskIterator.hasNext()) {
|
||||
ICraftingTask task = craftingTaskIterator.next();
|
||||
|
||||
if (ticks % task.getPattern().getCrafter(worldObj).getSpeed() == 0 && task.update(this)) {
|
||||
task.onDone(this);
|
||||
|
||||
craftingTaskIterator.remove();
|
||||
craftingTasks.pop();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -67,15 +67,6 @@ public class BasicCraftingTask implements ICraftingTask {
|
||||
itemsTook.add(took);
|
||||
|
||||
satisfied[i] = true;
|
||||
|
||||
// This is needed because if we request 2 chests for example
|
||||
// it will schedule 2 child tasks for wood the child tasks will then give 8 wood
|
||||
// but the first chest task will take all the 8 wood for completion
|
||||
// and then you end up with the second task not having anything anymore
|
||||
// and is stuck because the child task is already created.
|
||||
if (childTasks[i]) {
|
||||
break;
|
||||
}
|
||||
} else if (!childTasks[i]) {
|
||||
CraftingPattern pattern = controller.getPattern(input);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user