import bus optimization
This commit is contained in:
@@ -219,8 +219,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
|||||||
{
|
{
|
||||||
final int toSend = this.calculateMaximumAmountToImport( myAdaptor, whatToImport, inv, fzMode );
|
final int toSend = this.calculateMaximumAmountToImport( myAdaptor, whatToImport, inv, fzMode );
|
||||||
|
|
||||||
if( toSend == 0 ){
|
if( toSend == 0 )
|
||||||
return false;
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ItemStack newItems;
|
final ItemStack newItems;
|
||||||
@@ -291,9 +292,14 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
|||||||
itemAmountNotStorable = inv.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
itemAmountNotStorable = inv.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( simResult.isEmpty() )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if( itemAmountNotStorable != null )
|
if( itemAmountNotStorable != null )
|
||||||
{
|
{
|
||||||
if (simResult.getCount() == itemAmountNotStorable.getStackSize())
|
if( simResult.getCount() == itemAmountNotStorable.getStackSize() )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,24 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
|
|||||||
if( type == Actionable.MODULATE )
|
if( type == Actionable.MODULATE )
|
||||||
{
|
{
|
||||||
if (this.cache.cachedAeStacks.length == 0) this.cache.update();
|
if (this.cache.cachedAeStacks.length == 0) this.cache.update();
|
||||||
this.cache.cachedAeStacks = Arrays.copyOf( this.cache.cachedAeStacks, this.cache.cachedAeStacks.length + 1 );
|
boolean found = false;
|
||||||
this.cache.cachedAeStacks[this.cache.cachedAeStacks.length - 1] = iox.copy();
|
for (IAEItemStack iaeItemStack : this.cache.cachedAeStacks)
|
||||||
|
{
|
||||||
|
if( iaeItemStack == null )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if( iaeItemStack.equals( iox ) )
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
iaeItemStack.incStackSize( iox.getStackSize() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
this.cache.cachedAeStacks = Arrays.copyOf( this.cache.cachedAeStacks, this.cache.cachedAeStacks.length + 1 );
|
||||||
|
this.cache.cachedAeStacks[this.cache.cachedAeStacks.length - 1] = iox.copy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AEItemStack.fromItemStack( remaining );
|
return AEItemStack.fromItemStack( remaining );
|
||||||
|
|||||||
Reference in New Issue
Block a user