Applied-Energistics-2-tiler.../core/features/registries/ExternalStorageRegistry.java
2013-12-27 16:59:59 -06:00

38 lines
904 B
Java

package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IExternalStorageRegistry;
import appeng.api.storage.StorageChannel;
public class ExternalStorageRegistry implements IExternalStorageRegistry
{
List<IExternalStorageHandler> Handlers;
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;
}
return null;
}
@Override
public void addExternalStorageInterface(IExternalStorageHandler ei)
{
Handlers.add( ei );
}
}