AE2 First Commit, the dawn of 1.7 hast arrived.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package appeng.core.features.registries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
public class CellRegistry implements ICellRegistry
|
||||
{
|
||||
|
||||
List<ICellHandler> handlers;
|
||||
|
||||
public CellRegistry() {
|
||||
handlers = new ArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCellHandler(ICellHandler h)
|
||||
{
|
||||
if ( h != null )
|
||||
handlers.add( h );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellHandled(ItemStack is)
|
||||
{
|
||||
if ( is == null )
|
||||
return false;
|
||||
for (ICellHandler ch : handlers)
|
||||
if ( ch.isCell( is ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICellHandler getHander(ItemStack is)
|
||||
{
|
||||
if ( is == null )
|
||||
return null;
|
||||
for (ICellHandler ch : handlers)
|
||||
{
|
||||
if ( ch.isCell( is ) )
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack is, StorageChannel chan)
|
||||
{
|
||||
if ( is == null )
|
||||
return null;
|
||||
for (ICellHandler ch : handlers)
|
||||
{
|
||||
if ( ch.isCell( is ) )
|
||||
{
|
||||
return ch.getCellInventory( is, chan );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user