Applied-Energistics-2-tiler.../core/features/registries/ExternalStorageRegistry.java
AlgorithmX2 dc095749b7 Fixed Issue with DSU API,
Re-added support for MJ
Re-added support for pipe
Re-added support for BC-Facades.
2014-02-16 12:41:45 -06:00

44 lines
1.1 KiB
Java

package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IExternalStorageRegistry;
import appeng.api.storage.StorageChannel;
import appeng.core.features.registries.entries.ExternalIInv;
public class ExternalStorageRegistry implements IExternalStorageRegistry
{
List<IExternalStorageHandler> Handlers;
final ExternalIInv lastHandler = new ExternalIInv();
public ExternalStorageRegistry() {
Handlers = new ArrayList();
}
@Override
public IExternalStorageHandler getHandler(TileEntity te, ForgeDirection d, StorageChannel chan)
{
for (IExternalStorageHandler x : Handlers)
{
if ( x.canHandle( te, d, chan ) )
return x;
}
if ( lastHandler.canHandle( te, d, chan ) )
return lastHandler;
return null;
}
@Override
public void addExternalStorageInterface(IExternalStorageHandler ei)
{
Handlers.add( ei );
}
}