Run crafting task calculation async
This commit is contained in:
@@ -123,9 +123,15 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
ItemStack stack = network.getItemStorageCache().getList().get(hash);
|
||||
|
||||
if (stack != null) {
|
||||
Thread calculationThread = new Thread(() -> {
|
||||
ICraftingTask task = new CraftingTask(network, stack, network.getPattern(stack), quantity);
|
||||
|
||||
task.calculate();
|
||||
|
||||
RS.INSTANCE.network.sendTo(new MessageGridCraftingPreviewResponse(task.getPreviewStacks(), hash, quantity), player);
|
||||
}, "RS crafting calculation");
|
||||
|
||||
calculationThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -125,6 +125,8 @@ public class GuiCraftingStart extends GuiBase {
|
||||
|
||||
if (quantity != null && quantity > 0) {
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridCraftingPreview(stack.getHash(), quantity));
|
||||
|
||||
startButton.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user