2014-02-16 19:41:45 +01:00
|
|
|
package appeng.core.features.registries.entries;
|
|
|
|
|
|
|
|
import net.minecraft.inventory.IInventory;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
2014-04-18 05:33:48 +02:00
|
|
|
import appeng.api.networking.security.BaseActionSource;
|
2014-02-16 19:41:45 +01:00
|
|
|
import appeng.api.storage.IExternalStorageHandler;
|
|
|
|
import appeng.api.storage.IMEInventory;
|
|
|
|
import appeng.api.storage.StorageChannel;
|
|
|
|
import appeng.me.storage.MEMonitorIInventory;
|
2014-05-04 02:21:33 +02:00
|
|
|
import appeng.util.InventoryAdaptor;
|
2014-02-16 19:41:45 +01:00
|
|
|
|
|
|
|
public class ExternalIInv implements IExternalStorageHandler
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
2014-05-25 01:23:23 +02:00
|
|
|
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc)
|
2014-02-16 19:41:45 +01:00
|
|
|
{
|
|
|
|
return channel == StorageChannel.ITEMS && te instanceof IInventory;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-04-18 05:33:48 +02:00
|
|
|
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src)
|
2014-02-16 19:41:45 +01:00
|
|
|
{
|
2014-07-24 00:39:42 +02:00
|
|
|
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( (IInventory) te, d );
|
|
|
|
|
|
|
|
if ( channel == StorageChannel.ITEMS && ad != null )
|
|
|
|
return new MEMonitorIInventory( ad );
|
|
|
|
|
2014-02-16 19:41:45 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|