invert comparison

This commit is contained in:
Salomão
2021-05-12 03:26:12 -03:00
parent 6180c188e6
commit 4f627b234c
@@ -73,7 +73,6 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
@Override @Override
public IAEItemStack injectItems( IAEItemStack iox, Actionable type, IActionSource src ) public IAEItemStack injectItems( IAEItemStack iox, Actionable type, IActionSource src )
{ {
if( this.cache.cachedAeStacks.length == 0 ) this.cache.update();
ItemStack orgInput = iox.createItemStack(); ItemStack orgInput = iox.createItemStack();
ItemStack remaining = orgInput; ItemStack remaining = orgInput;
@@ -92,7 +91,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
injectedList.add( Pair.of( i, countPre ) ); injectedList.add( Pair.of( i, countPre ) );
break; break;
} }
else if( countPos > countPre ) else if( countPos < countPre )
{ {
injectedList.add( Pair.of( i, countPos - countPre ) ); injectedList.add( Pair.of( i, countPos - countPre ) );
} }
@@ -107,20 +106,27 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
if( type == Actionable.MODULATE ) if( type == Actionable.MODULATE )
{ {
for( Pair<Integer, Integer> pair : injectedList ) if( this.cache.cachedAeStacks.length == 0 )
{ {
if (pair.getKey() >= this.cache.cachedAeStacks.length) this.cache.update();
}
else
{
for( Pair<Integer, Integer> pair : injectedList )
{ {
this.cache.update(); if( pair.getKey() >= this.cache.cachedAeStacks.length )
break; {
} this.cache.update();
if( this.cache.cachedAeStacks[pair.getKey()] == null ) break;
{ }
this.cache.cachedAeStacks[pair.getKey()] = iox.copy().setStackSize( pair.getValue() ); if( this.cache.cachedAeStacks[pair.getKey()] == null )
} {
else this.cache.cachedAeStacks[pair.getKey()] = iox.copy().setStackSize( pair.getValue() );
{ }
this.cache.cachedAeStacks[pair.getKey()].incStackSize( pair.getValue() ); else
{
this.cache.cachedAeStacks[pair.getKey()].incStackSize( pair.getValue() );
}
} }
} }
@@ -206,20 +212,21 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
{ {
if( mode == Actionable.MODULATE ) if( mode == Actionable.MODULATE )
{ {
if( this.cache.cachedAeStacks.length == 0 )
for ( Pair<Integer, Integer> pair : extractedList )
{ {
if (pair.getKey() >= this.cache.cachedAeStacks.length) this.cache.update();
}
else
{
for( Pair<Integer, Integer> pair : extractedList )
{ {
this.cache.update(); if( this.cache.cachedAeStacks[pair.getKey()] != null )
break;
}
if( this.cache.cachedAeStacks[pair.getKey()] != null )
{
this.cache.cachedAeStacks[pair.getKey()].decStackSize( pair.getValue() );
if( this.cache.cachedAeStacks[pair.getKey()].getStackSize() == 0 )
{ {
this.cache.cachedAeStacks[pair.getKey()] = null; this.cache.cachedAeStacks[pair.getKey()].decStackSize( pair.getValue() );
if( this.cache.cachedAeStacks[pair.getKey()].getStackSize() == 0 )
{
this.cache.cachedAeStacks[pair.getKey()] = null;
}
} }
} }
} }