Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.util;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -38,67 +39,68 @@ import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
import appeng.util.inv.WrapperMCISidedInventory;
|
||||
|
||||
|
||||
public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
||||
{
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination);
|
||||
|
||||
public abstract ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination);
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeSimilarItems(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
||||
|
||||
public abstract ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination);
|
||||
|
||||
// return what isn't used...
|
||||
public abstract ItemStack addItems(ItemStack toBeAdded);
|
||||
|
||||
public abstract ItemStack simulateAdd(ItemStack toBeSimulated);
|
||||
|
||||
public abstract boolean containsItems();
|
||||
|
||||
// returns an appropriate adaptor, or null
|
||||
public static InventoryAdaptor getAdaptor(Object te, ForgeDirection d)
|
||||
public static InventoryAdaptor getAdaptor( Object te, ForgeDirection d )
|
||||
{
|
||||
if ( te == null )
|
||||
if( te == null )
|
||||
return null;
|
||||
|
||||
IBetterStorage bs = (IBetterStorage) (AppEng.instance.isIntegrationEnabled( IntegrationType.BetterStorage ) ? AppEng.instance.getIntegration( IntegrationType.BetterStorage ) : null);
|
||||
IBetterStorage bs = (IBetterStorage) ( AppEng.instance.isIntegrationEnabled( IntegrationType.BetterStorage ) ? AppEng.instance.getIntegration( IntegrationType.BetterStorage ) : null );
|
||||
|
||||
if ( te instanceof EntityPlayer )
|
||||
if( te instanceof EntityPlayer )
|
||||
{
|
||||
return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory, false ) );
|
||||
return new AdaptorIInventory( new AdaptorPlayerInventory( ( (EntityPlayer) te ).inventory, false ) );
|
||||
}
|
||||
else if ( te instanceof ArrayList )
|
||||
else if( te instanceof ArrayList )
|
||||
{
|
||||
@SuppressWarnings( "unchecked" )
|
||||
final ArrayList<ItemStack> list = ( ArrayList<ItemStack> ) te;
|
||||
final ArrayList<ItemStack> list = (ArrayList<ItemStack>) te;
|
||||
|
||||
return new AdaptorList( list );
|
||||
}
|
||||
else if ( bs != null && bs.isStorageCrate( te ) )
|
||||
else if( bs != null && bs.isStorageCrate( te ) )
|
||||
{
|
||||
return bs.getAdaptor( te, d );
|
||||
}
|
||||
else if ( te instanceof TileEntityChest )
|
||||
else if( te instanceof TileEntityChest )
|
||||
{
|
||||
return new AdaptorIInventory( Platform.GetChestInv( te ) );
|
||||
}
|
||||
else if ( te instanceof ISidedInventory )
|
||||
else if( te instanceof ISidedInventory )
|
||||
{
|
||||
ISidedInventory si =(ISidedInventory)te;
|
||||
ISidedInventory si = (ISidedInventory) te;
|
||||
int[] slots = si.getAccessibleSlotsFromSide( d.ordinal() );
|
||||
if ( si.getSizeInventory() > 0 && slots != null && slots.length > 0 )
|
||||
if( si.getSizeInventory() > 0 && slots != null && slots.length > 0 )
|
||||
return new AdaptorIInventory( new WrapperMCISidedInventory( si, d ) );
|
||||
}
|
||||
else if ( te instanceof IInventory )
|
||||
else if( te instanceof IInventory )
|
||||
{
|
||||
IInventory i =(IInventory)te;
|
||||
if ( i.getSizeInventory() > 0 )
|
||||
IInventory i = (IInventory) te;
|
||||
if( i.getSizeInventory() > 0 )
|
||||
return new AdaptorIInventory( i );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination );
|
||||
|
||||
public abstract ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination );
|
||||
|
||||
// return what was extracted.
|
||||
public abstract ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination );
|
||||
|
||||
public abstract ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination );
|
||||
|
||||
// return what isn't used...
|
||||
public abstract ItemStack addItems( ItemStack toBeAdded );
|
||||
|
||||
public abstract ItemStack simulateAdd( ItemStack toBeSimulated );
|
||||
|
||||
public abstract boolean containsItems();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user