From a69d1492efd30feb2d5ef7bf3c741dc1af7a5640 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 16 Jul 2014 20:31:23 -0500 Subject: [PATCH] Fixed Bug: #0613 - interface bug when crafting large quantities of items --- crafting/CraftingJob.java | 9 +++++++-- crafting/CraftingTreeNode.java | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crafting/CraftingJob.java b/crafting/CraftingJob.java index 89851404..aef1ec4f 100644 --- a/crafting/CraftingJob.java +++ b/crafting/CraftingJob.java @@ -33,8 +33,8 @@ public class CraftingJob implements Runnable, ICraftingJob boolean simulate = false; final MECraftingInventory original; - final MECraftingInventory availableCheck; + MECraftingInventory availableCheck; public CraftingTreeNode tree; private BaseActionSource actionSrc; private ICraftingCallback callback; @@ -71,8 +71,8 @@ public class CraftingJob implements Runnable, ICraftingJob ICraftingGrid cc = grid.getCache( ICraftingGrid.class ); IStorageGrid sg = grid.getCache( IStorageGrid.class ); original = new MECraftingInventory( sg.getItemInventory(), false, false, false ); - availableCheck = new MECraftingInventory( sg.getItemInventory(), false, false, false ); tree = getCraftingTree( cc, what ); + availableCheck = null; } private World wrapWorld(World w) @@ -138,6 +138,7 @@ public class CraftingJob implements Runnable, ICraftingJob MECraftingInventory meci = new MECraftingInventory( original, true, false, true ); meci.ignore( output ); + availableCheck = new MECraftingInventory( original, false, false, false ); tree.request( meci, output.getStackSize(), actionSrc ); tree.dive( this ); @@ -161,6 +162,8 @@ public class CraftingJob implements Runnable, ICraftingJob MECraftingInventory meci = new MECraftingInventory( original, true, false, true ); meci.ignore( output ); + availableCheck = new MECraftingInventory( original, false, false, false ); + tree.setSimulate(); tree.request( meci, output.getStackSize(), actionSrc ); tree.dive( this ); @@ -216,6 +219,8 @@ public class CraftingJob implements Runnable, ICraftingJob if ( callback != null ) callback.calculationComplete( this ); + availableCheck = null; + synchronized (monitor) { running = false; diff --git a/crafting/CraftingTreeNode.java b/crafting/CraftingTreeNode.java index daee15e6..6a1725b0 100644 --- a/crafting/CraftingTreeNode.java +++ b/crafting/CraftingTreeNode.java @@ -188,7 +188,9 @@ public class CraftingTreeNode { missing += l; bytes += l; - return what; + IAEItemStack rv = what.copy(); + rv.setStackSize( l ); + return rv; } throw new CraftBranchFailure( what, l );