cache more itemstacks
This commit is contained in:
@@ -893,12 +893,21 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
else if( itemStack.getStackSize() > 0 )
|
else if( itemStack.getStackSize() > 0 )
|
||||||
{
|
{
|
||||||
// make sure strange things didn't happen...
|
// make sure strange things didn't happen...
|
||||||
ItemStack inputStack = itemStack.createItemStack();
|
|
||||||
if( !adaptor.simulateAdd( inputStack ).isEmpty() )
|
ItemStack inputStack = itemStack.getCachedItemStack( itemStack.getStackSize() );
|
||||||
|
|
||||||
|
ItemStack remaining = adaptor.simulateAdd( inputStack );
|
||||||
|
|
||||||
|
if( !remaining.isEmpty() )
|
||||||
{
|
{
|
||||||
|
itemStack.setCachedItemStack( remaining );
|
||||||
changed = true;
|
changed = true;
|
||||||
throw new GridAccessException();
|
throw new GridAccessException();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemStack.setCachedItemStack( inputStack );
|
||||||
|
}
|
||||||
|
|
||||||
IAEItemStack storedStack = this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).getStorageList().findPrecise( itemStack );
|
IAEItemStack storedStack = this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).getStorageList().findPrecise( itemStack );
|
||||||
if( storedStack != null )
|
if( storedStack != null )
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.util.concurrent.Future;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -83,8 +84,16 @@ public class MultiCraftingTracker
|
|||||||
|
|
||||||
public boolean handleCrafting( final int x, final long itemToCraft, final IAEItemStack ais, final InventoryAdaptor d, final World w, final IGrid g, final ICraftingGrid cg, final IActionSource mySrc )
|
public boolean handleCrafting( final int x, final long itemToCraft, final IAEItemStack ais, final InventoryAdaptor d, final World w, final IGrid g, final ICraftingGrid cg, final IActionSource mySrc )
|
||||||
{
|
{
|
||||||
if( ais != null && d.simulateAdd( ais.createItemStack() ).isEmpty() )
|
if( ais != null )
|
||||||
{
|
{
|
||||||
|
ItemStack inputStack = ais.getCachedItemStack( ais.getStackSize() );
|
||||||
|
|
||||||
|
ItemStack remaining = d.simulateAdd( inputStack );
|
||||||
|
|
||||||
|
if( remaining.isEmpty() )
|
||||||
|
{
|
||||||
|
ais.setCachedItemStack( inputStack );
|
||||||
|
|
||||||
final Future<ICraftingJob> craftingJob = this.getJob( x );
|
final Future<ICraftingJob> craftingJob = this.getJob( x );
|
||||||
|
|
||||||
if( this.getLink( x ) != null )
|
if( this.getLink( x ) != null )
|
||||||
@@ -136,6 +145,11 @@ public class MultiCraftingTracker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ais.setCachedItemStack( remaining );
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user