Fixed Bug: #0613 - interface bug when crafting large quantities of items

This commit is contained in:
AlgorithmX2 2014-07-16 20:31:23 -05:00
parent ead5e65a0e
commit a69d1492ef
2 changed files with 10 additions and 3 deletions

View file

@ -33,8 +33,8 @@ public class CraftingJob implements Runnable, ICraftingJob
boolean simulate = false; boolean simulate = false;
final MECraftingInventory original; final MECraftingInventory original;
final MECraftingInventory availableCheck;
MECraftingInventory availableCheck;
public CraftingTreeNode tree; public CraftingTreeNode tree;
private BaseActionSource actionSrc; private BaseActionSource actionSrc;
private ICraftingCallback callback; private ICraftingCallback callback;
@ -71,8 +71,8 @@ public class CraftingJob implements Runnable, ICraftingJob
ICraftingGrid cc = grid.getCache( ICraftingGrid.class ); ICraftingGrid cc = grid.getCache( ICraftingGrid.class );
IStorageGrid sg = grid.getCache( IStorageGrid.class ); IStorageGrid sg = grid.getCache( IStorageGrid.class );
original = new MECraftingInventory( sg.getItemInventory(), false, false, false ); original = new MECraftingInventory( sg.getItemInventory(), false, false, false );
availableCheck = new MECraftingInventory( sg.getItemInventory(), false, false, false );
tree = getCraftingTree( cc, what ); tree = getCraftingTree( cc, what );
availableCheck = null;
} }
private World wrapWorld(World w) private World wrapWorld(World w)
@ -138,6 +138,7 @@ public class CraftingJob implements Runnable, ICraftingJob
MECraftingInventory meci = new MECraftingInventory( original, true, false, true ); MECraftingInventory meci = new MECraftingInventory( original, true, false, true );
meci.ignore( output ); meci.ignore( output );
availableCheck = new MECraftingInventory( original, false, false, false );
tree.request( meci, output.getStackSize(), actionSrc ); tree.request( meci, output.getStackSize(), actionSrc );
tree.dive( this ); tree.dive( this );
@ -161,6 +162,8 @@ public class CraftingJob implements Runnable, ICraftingJob
MECraftingInventory meci = new MECraftingInventory( original, true, false, true ); MECraftingInventory meci = new MECraftingInventory( original, true, false, true );
meci.ignore( output ); meci.ignore( output );
availableCheck = new MECraftingInventory( original, false, false, false );
tree.setSimulate(); tree.setSimulate();
tree.request( meci, output.getStackSize(), actionSrc ); tree.request( meci, output.getStackSize(), actionSrc );
tree.dive( this ); tree.dive( this );
@ -216,6 +219,8 @@ public class CraftingJob implements Runnable, ICraftingJob
if ( callback != null ) if ( callback != null )
callback.calculationComplete( this ); callback.calculationComplete( this );
availableCheck = null;
synchronized (monitor) synchronized (monitor)
{ {
running = false; running = false;

View file

@ -188,7 +188,9 @@ public class CraftingTreeNode
{ {
missing += l; missing += l;
bytes += l; bytes += l;
return what; IAEItemStack rv = what.copy();
rv.setStackSize( l );
return rv;
} }
throw new CraftBranchFailure( what, l ); throw new CraftBranchFailure( what, l );