Puts everywhere brackets
This commit is contained in:
@@ -84,14 +84,22 @@ public class AdaptorBCPipe extends InventoryAdaptor
|
||||
public ItemStack addItems( ItemStack toBeAdded )
|
||||
{
|
||||
if( this.i == null )
|
||||
{
|
||||
return toBeAdded;
|
||||
}
|
||||
if( toBeAdded == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( toBeAdded.stackSize == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return toBeAdded;
|
||||
}
|
||||
|
||||
@@ -99,7 +107,9 @@ public class AdaptorBCPipe extends InventoryAdaptor
|
||||
public ItemStack simulateAdd( ItemStack toBeSimulated )
|
||||
{
|
||||
if( this.i == null )
|
||||
{
|
||||
return toBeSimulated;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,9 +54,13 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
{
|
||||
int boundAmounts = amount;
|
||||
if( boundAmounts > is.stackSize )
|
||||
{
|
||||
boundAmounts = is.stackSize;
|
||||
}
|
||||
if( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
boundAmounts = 0;
|
||||
}
|
||||
|
||||
if( boundAmounts > 0 )
|
||||
{
|
||||
@@ -108,9 +112,13 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
{
|
||||
int boundAmount = amount;
|
||||
if( boundAmount > is.stackSize )
|
||||
{
|
||||
boundAmount = is.stackSize;
|
||||
}
|
||||
if( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
boundAmount = 0;
|
||||
}
|
||||
|
||||
if( boundAmount > 0 )
|
||||
{
|
||||
@@ -143,9 +151,13 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
{
|
||||
int newAmount = amount;
|
||||
if( newAmount > is.stackSize )
|
||||
{
|
||||
newAmount = is.stackSize;
|
||||
}
|
||||
if( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
newAmount = 0;
|
||||
}
|
||||
|
||||
ItemStack rv = null;
|
||||
if( newAmount > 0 )
|
||||
@@ -189,9 +201,13 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
{
|
||||
int boundAmount = amount;
|
||||
if( boundAmount > is.stackSize )
|
||||
{
|
||||
boundAmount = is.stackSize;
|
||||
}
|
||||
if( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
boundAmount = 0;
|
||||
}
|
||||
|
||||
if( boundAmount > 0 )
|
||||
{
|
||||
@@ -223,7 +239,9 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
for( int x = 0; x < s; x++ )
|
||||
{
|
||||
if( this.i.getStackInSlot( x ) != null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -302,7 +320,9 @@ public class AdaptorIInventory extends InventoryAdaptor
|
||||
boolean canRemoveStackFromSlot( int x, ItemStack is )
|
||||
{
|
||||
if( this.wrapperEnabled )
|
||||
{
|
||||
return ( (IInventoryWrapper) this.i ).canRemoveItemFromSlot( x, is );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,9 +50,13 @@ public class AdaptorList extends InventoryAdaptor
|
||||
if( is != null && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
|
||||
{
|
||||
if( amount > is.stackSize )
|
||||
{
|
||||
amount = is.stackSize;
|
||||
}
|
||||
if( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
if( amount > 0 )
|
||||
{
|
||||
@@ -62,7 +66,9 @@ public class AdaptorList extends InventoryAdaptor
|
||||
|
||||
// remove it..
|
||||
if( is.stackSize <= 0 )
|
||||
{
|
||||
this.i.remove( x );
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -108,9 +114,13 @@ public class AdaptorList extends InventoryAdaptor
|
||||
if( is != null && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
|
||||
{
|
||||
if( how_many > is.stackSize )
|
||||
{
|
||||
how_many = is.stackSize;
|
||||
}
|
||||
if( destination != null && !destination.canInsert( is ) )
|
||||
{
|
||||
how_many = 0;
|
||||
}
|
||||
|
||||
if( how_many > 0 )
|
||||
{
|
||||
@@ -120,7 +130,9 @@ public class AdaptorList extends InventoryAdaptor
|
||||
|
||||
// remove it..
|
||||
if( is.stackSize <= 0 )
|
||||
{
|
||||
this.i.remove( x );
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -160,9 +172,13 @@ public class AdaptorList extends InventoryAdaptor
|
||||
public ItemStack addItems( ItemStack toBeAdded )
|
||||
{
|
||||
if( toBeAdded == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( toBeAdded.stackSize == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack left = toBeAdded.copy();
|
||||
|
||||
|
||||
@@ -48,7 +48,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
{
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if( hand == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||
{
|
||||
@@ -56,7 +58,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
|
||||
hand.stackSize -= amount;
|
||||
if( hand.stackSize <= 0 )
|
||||
{
|
||||
this.p.inventory.setItemStack( null );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -69,7 +73,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if( hand == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
|
||||
{
|
||||
@@ -86,7 +92,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
{
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if( hand == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( Filter == null || Platform.isSameItemFuzzy( Filter, hand, fuzzyMode ) )
|
||||
{
|
||||
@@ -94,7 +102,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
|
||||
hand.stackSize -= how_many;
|
||||
if( hand.stackSize <= 0 )
|
||||
{
|
||||
this.p.inventory.setItemStack( null );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -107,7 +117,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if( hand == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( Filter == null || Platform.isSameItemFuzzy( Filter, hand, fuzzyMode ) )
|
||||
{
|
||||
@@ -124,23 +136,35 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
{
|
||||
|
||||
if( toBeAdded == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( toBeAdded.stackSize == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if( this.p == null )
|
||||
{
|
||||
return toBeAdded;
|
||||
}
|
||||
if( this.p.inventory == null )
|
||||
{
|
||||
return toBeAdded;
|
||||
}
|
||||
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
|
||||
if( hand != null && !Platform.isSameItemPrecise( toBeAdded, hand ) )
|
||||
{
|
||||
return toBeAdded;
|
||||
}
|
||||
|
||||
int original = 0;
|
||||
ItemStack newHand = null;
|
||||
if( hand == null )
|
||||
{
|
||||
newHand = toBeAdded.copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
newHand = hand;
|
||||
@@ -166,15 +190,21 @@ public class AdaptorPlayerHand extends InventoryAdaptor
|
||||
{
|
||||
ItemStack hand = this.p.inventory.getItemStack();
|
||||
if( toBeSimulated == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if( hand != null && !Platform.isSameItem( toBeSimulated, hand ) )
|
||||
{
|
||||
return toBeSimulated;
|
||||
}
|
||||
|
||||
int original = 0;
|
||||
ItemStack newHand = null;
|
||||
if( hand == null )
|
||||
{
|
||||
newHand = toBeSimulated.copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
newHand = hand.copy();
|
||||
|
||||
@@ -35,9 +35,13 @@ public class AdaptorPlayerInventory implements IInventory
|
||||
{
|
||||
|
||||
if( swap )
|
||||
{
|
||||
this.src = new WrapperChainedInventory( new WrapperInventoryRange( playerInv, 9, this.size - 9, false ), new WrapperInventoryRange( playerInv, 0, 9, false ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.src = playerInv;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -74,10 +74,14 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
{
|
||||
IItemList<IAEItemStack> list = this.getList();
|
||||
if( !list.isEmpty() )
|
||||
{
|
||||
req = list.getFirstItem();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
req = AEItemStack.create( Filter );
|
||||
}
|
||||
|
||||
IAEItemStack out = null;
|
||||
|
||||
@@ -88,7 +92,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
}
|
||||
|
||||
if( out != null )
|
||||
{
|
||||
return out.getItemStack();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -103,7 +109,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
public ItemStack removeSimilarItems( int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
{
|
||||
if( filter == null )
|
||||
{
|
||||
return this.doRemoveItems( how_many, null, destination, Actionable.MODULATE );
|
||||
}
|
||||
return this.doRemoveItemsFuzzy( how_many, filter, destination, Actionable.MODULATE, fuzzyMode );
|
||||
}
|
||||
|
||||
@@ -111,7 +119,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
{
|
||||
IAEItemStack reqFilter = AEItemStack.create( Filter );
|
||||
if( reqFilter == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
IAEItemStack out = null;
|
||||
|
||||
@@ -122,7 +132,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
req.setStackSize( how_many );
|
||||
out = this.target.extractItems( req, type, this.src );
|
||||
if( out != null )
|
||||
{
|
||||
return out.getItemStack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +145,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
|
||||
{
|
||||
if( filter == null )
|
||||
{
|
||||
return this.doRemoveItems( amount, null, destination, Actionable.SIMULATE );
|
||||
}
|
||||
return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.SIMULATE, fuzzyMode );
|
||||
}
|
||||
|
||||
@@ -145,7 +159,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
{
|
||||
IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
|
||||
if( out != null )
|
||||
{
|
||||
return out.getItemStack();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -158,7 +174,9 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||
{
|
||||
IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
|
||||
if( out != null )
|
||||
{
|
||||
return out.getItemStack();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ public final class IMEAdaptorIterator implements Iterator<ItemSlot>
|
||||
this.slot.isExtractable = true;
|
||||
|
||||
if( this.parent.maxSlots < this.offset )
|
||||
{
|
||||
this.parent.maxSlots = this.offset;
|
||||
}
|
||||
|
||||
if( this.hasNext )
|
||||
{
|
||||
|
||||
@@ -42,12 +42,16 @@ public class IMEInventoryDestination implements IInventoryDestination
|
||||
{
|
||||
|
||||
if( stack == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IAEItemStack failed = this.me.injectItems( AEItemStack.create( stack ), Actionable.SIMULATE, null );
|
||||
|
||||
if( failed == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return failed.getStackSize() != stack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,9 @@ public class WrapperChainedInventory implements IInventory
|
||||
List<IInventory> newOrder = new ArrayList<IInventory>( this.l.size() );
|
||||
newOrder.add( this.l.get( this.l.size() - 1 ) );
|
||||
for( int x = 0; x < this.l.size() - 1; x++ )
|
||||
{
|
||||
newOrder.add( this.l.get( x ) );
|
||||
}
|
||||
this.setInventory( newOrder );
|
||||
}
|
||||
}
|
||||
@@ -181,7 +183,9 @@ public class WrapperChainedInventory implements IInventory
|
||||
int smallest = 64;
|
||||
|
||||
for( IInventory i : this.l )
|
||||
{
|
||||
smallest = Math.min( smallest, i.getInventoryStackLimit() );
|
||||
}
|
||||
|
||||
return smallest;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ public class WrapperInventoryRange implements IInventory
|
||||
this.slots = s;
|
||||
|
||||
if( this.slots == null )
|
||||
{
|
||||
this.slots = new int[0];
|
||||
}
|
||||
|
||||
this.ignoreValidItems = ignoreValid;
|
||||
}
|
||||
@@ -47,7 +49,9 @@ public class WrapperInventoryRange implements IInventory
|
||||
this.src = a;
|
||||
this.slots = new int[_size];
|
||||
for( int x = 0; x < _size; x++ )
|
||||
{
|
||||
this.slots[x] = _min + x;
|
||||
}
|
||||
this.ignoreValidItems = ignoreValid;
|
||||
}
|
||||
|
||||
@@ -145,7 +149,9 @@ public class WrapperInventoryRange implements IInventory
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
if( this.ignoreValidItems )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.src.isItemValidForSlot( this.slots[i], itemstack );
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
|
||||
public ItemStack decrStackSize( int var1, int var2 )
|
||||
{
|
||||
if( this.canRemoveItemFromSlot( var1, this.getStackInSlot( var1 ) ) )
|
||||
{
|
||||
return super.decrStackSize( var1, var2 );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -50,10 +52,14 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
|
||||
{
|
||||
|
||||
if( this.ignoreValidItems )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( this.side.isItemValidForSlot( this.slots[i], itemstack ) )
|
||||
{
|
||||
return this.side.canInsertItem( this.slots[i], itemstack, this.dir.ordinal() );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -62,7 +68,9 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
|
||||
public boolean canRemoveItemFromSlot( int i, ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.side.canExtractItem( this.slots[i], is, this.dir.ordinal() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user