Separated Crafting job into a worker thread.

Crafting calculation can be canceled.
Hooked up a crafting calculation launch and the confirmation GUI.
This commit is contained in:
AlgorithmX2
2014-06-18 01:23:37 -05:00
parent 0a18f2d926
commit 32ee57c3a9
11 changed files with 320 additions and 44 deletions
+12 -1
View File
@@ -86,8 +86,11 @@ public class CraftingTreeProcess
throw new RuntimeException( "Crafting Tree construction failed." );
}
public void request(MECraftingInventory inv, long i, BaseActionSource src) throws CraftBranchFailure
public void request(MECraftingInventory inv, long i, BaseActionSource src) throws CraftBranchFailure, InterruptedException
{
if ( Thread.interrupted() )
throw new InterruptedException();
// request and remove inputs...
for (Entry<CraftingTreeNode, Long> entry : nodes.entrySet())
{
@@ -129,4 +132,12 @@ public class CraftingTreeProcess
for (CraftingTreeNode pro : nodes.keySet())
pro.dive( job );
}
public void setSimulate()
{
crafts = 0;
for (CraftingTreeNode pro : nodes.keySet())
pro.setSimulate();
}
}