update item cache directly on insert/removal

import bus fails faster and throttles down when inventory is full
This commit is contained in:
Salomão
2021-05-08 19:08:21 -03:00
parent 03fb43db16
commit 62d1d904c6
2 changed files with 44 additions and 22 deletions
@@ -218,6 +218,11 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
private boolean importStuff( final InventoryAdaptor myAdaptor, final IAEItemStack whatToImport, final IMEMonitor<IAEItemStack> inv, final IEnergySource energy, final FuzzyMode fzMode )
{
final int toSend = this.calculateMaximumAmountToImport( myAdaptor, whatToImport, inv, fzMode );
if( toSend == 0 ){
return false;
}
final ItemStack newItems;
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
@@ -288,6 +293,10 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( itemAmountNotStorable != null )
{
if (simResult.getCount() == itemAmountNotStorable.getStackSize())
{
return 0;
}
return (int) Math.min( simResult.getCount() - itemAmountNotStorable.getStackSize(), toSend );
}