AE2 First Commit, the dawn of 1.7 hast arrived.

This commit is contained in:
algorithmx2
2013-12-27 16:59:59 -06:00
commit e9acdcbee2
468 changed files with 47440 additions and 0 deletions
@@ -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;
}
}
@@ -0,0 +1,38 @@
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 );
}
}
@@ -0,0 +1,46 @@
package appeng.core.features.registries;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridCache;
import appeng.api.networking.IGridCacheRegistry;
import appeng.core.AELog;
public class GridCacheRegistry implements IGridCacheRegistry
{
final private HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap();
@Override
public void registerGridCache(Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation)
{
if ( iface.isAssignableFrom( implementation ) )
caches.put( iface, implementation );
else
throw new RuntimeException( "Invalid setup, grid cache must either be the same class, or an interface that the implementation implements" );
}
@Override
public HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance(IGrid g)
{
HashMap<Class<? extends IGridCache>, IGridCache> map = new HashMap();
for (Class<? extends IGridCache> iface : caches.keySet())
{
try
{
Constructor<? extends IGridCache> c = caches.get( iface ).getConstructor( IGrid.class );
map.put( iface, c.newInstance( g ) );
}
catch (Throwable e)
{
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
throw new RuntimeException( e );
}
}
return map;
}
}
@@ -0,0 +1,227 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import appeng.api.features.IGrinderEntry;
import appeng.api.features.IGrinderRegistry;
import appeng.core.AELog;
import appeng.core.Configuration;
import appeng.core.features.registries.entries.AppEngGrinderRecipe;
import appeng.recipes.ores.IOreListener;
import appeng.recipes.ores.OreDictionaryHandler;
import appeng.util.Platform;
public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
{
public List<IGrinderEntry> RecipeList;
private ItemStack copy(ItemStack is)
{
if ( is != null )
return is.copy();
return null;
}
public GrinderRecipeManager() {
RecipeList = new ArrayList();
addOre( "Gold", new ItemStack( Block.oreGold ) );
addOre( "Iron", new ItemStack( Block.oreIron ) );
addIngot( "Gold", new ItemStack( Item.ingotGold ) );
addIngot( "Iron", new ItemStack( Item.ingotIron ) );
addOre( "Obsidian", new ItemStack( Block.obsidian ) );
addOre( "EnderPearl", new ItemStack( Item.enderPearl ) );
addOre( "Coal", new ItemStack( Item.coal ) );
addOre( "Charcoal", new ItemStack( Item.coal, 1, 1 ) );
OreDictionaryHandler.instance.observe( this );
}
@Override
public List<IGrinderEntry> getRecipes()
{
log( "API - getRecipes" );
return RecipeList;
}
@Override
public void addRecipe(ItemStack in, ItemStack out, int cost)
{
if ( in == null || out == null )
{
log( "Invalid Grinder Recipe Specified." );
return;
}
log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " for "
+ cost );
RecipeList.add( new AppEngGrinderRecipe( copy( in ), copy( out ), cost ) );
}
@Override
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, int cost)
{
if ( in == null || (optional == null && out == null) )
{
log( "Invalid Grinder Recipe Specified." );
return;
}
log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out )
+ " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
RecipeList.add( new AppEngGrinderRecipe( copy( in ), copy( out ), copy( optional ), chance, cost ) );
}
@Override
public IGrinderEntry getRecipeForInput(ItemStack input)
{
log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
if ( input != null )
{
for (IGrinderEntry r : RecipeList)
{
if ( Platform.isSameItem( input, r.getInput() ) )
{
log( "Recipe for " + input.getUnlocalizedName() + " found " + Platform.getItemDisplayName( r.getOutput() ) );
return r;
}
}
log( "Count not find recipe for " + Platform.getItemDisplayName( input ) );
}
return null;
}
public void log(String o)
{
AELog.grinder( o );
}
private int getDustToOreRatio(String name)
{
if ( name.equals( "Obsidian" ) )
return 1;
if ( name.equals( "EnderPearl" ) )
return 1;
if ( name.equals( "Charcoal" ) )
return 1;
if ( name.equals( "Coal" ) )
return 1;
if ( name.contains( "Quartz" ) )
return 1;
return 2;
}
public Map<ItemStack, String> Ores = new HashMap<ItemStack, String>();
public Map<ItemStack, String> Ingots = new HashMap<ItemStack, String>();
public Map<String, ItemStack> Dusts = new HashMap<String, ItemStack>();
private void addOre(String name, ItemStack item)
{
if ( item == null )
return;
log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) );
Ores.put( item, name );
if ( Dusts.containsKey( name ) )
{
ItemStack is = Dusts.get( name ).copy();
int ratio = getDustToOreRatio( name );
if ( ratio > 1 )
{
ItemStack extra = is.copy();
extra.stackSize = ratio - 1;
addRecipe( item, is, extra, (float) (Configuration.instance.oreDoublePercentage / 100.0), 8 );
}
else
addRecipe( item, is, 8 );
}
}
private void addIngot(String name, ItemStack item)
{
if ( item == null )
return;
log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) );
Ingots.put( item, name );
if ( Dusts.containsKey( name ) )
{
addRecipe( item, Dusts.get( name ), 4 );
}
}
private void addDust(String name, ItemStack item)
{
if ( item == null )
return;
if ( Dusts.containsKey( name ) )
{
log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
return;
}
log( "Adding Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
Dusts.put( name, item );
for (Entry<ItemStack, String> d : Ores.entrySet())
if ( name.equals( d.getValue() ) )
{
ItemStack is = item.copy();
is.stackSize = 1;
int ratio = getDustToOreRatio( name );
if ( ratio > 1 )
{
ItemStack extra = is.copy();
extra.stackSize = ratio - 1;
addRecipe( d.getKey(), is, extra, (float) (Configuration.instance.oreDoublePercentage / 100.0), 8 );
}
else
addRecipe( d.getKey(), is, 8 );
}
for (Entry<ItemStack, String> d : Ingots.entrySet())
if ( name.equals( d.getValue() ) )
addRecipe( d.getKey(), item, 4 );
}
@Override
public void oreRegistered(String Name, ItemStack item)
{
if ( Name.startsWith( "ore" ) || Name.startsWith( "ingot" ) || Name.startsWith( "dust" ) )
{
for (String ore : Configuration.instance.grinderOres)
{
if ( ore.equals( "CertusQuartz" ) )
continue;
if ( ore.equals( "NetherQuartz" ) )
continue;
if ( Name.equals( "ore" + ore ) )
{
addOre( ore, item );
}
else if ( Name.equals( "ingot" + ore ) )
{
addIngot( ore, item );
}
else if ( Name.equals( "dust" + ore ) )
{
addDust( ore, item );
}
}
}
}
}
@@ -0,0 +1,45 @@
package appeng.core.features.registries;
import java.util.HashMap;
import net.minecraftforge.event.ForgeSubscribe;
import appeng.api.events.LocatableEventAnnounce;
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
import appeng.api.features.ILocatable;
import appeng.api.features.ILocateableRegistry;
import appeng.util.Platform;
public class LocateableRegistry implements ILocateableRegistry
{
private HashMap<Long, ILocatable> set;
@ForgeSubscribe
public void updateLocateable(LocatableEventAnnounce e)
{
if ( Platform.isClient() )
return; // IGNORE!
if ( e.change == LocatableEvent.Register )
{
set.put( e.target.getLocatableSerial(), e.target );
} else if ( e.change == LocatableEvent.Unregister )
{
set.remove( e.target.getLocatableSerial() );
}
}
public LocateableRegistry() {
set = new HashMap();
}
/**
* Find a locate-able object by its serial.
*/
@Override
public Object findLocateableBySerial(long ser)
{
return set.get( ser );
}
}
@@ -0,0 +1,129 @@
package appeng.core.features.registries;
import java.util.HashMap;
import java.util.LinkedList;
import net.minecraft.tileentity.TileEntity;
import appeng.api.exceptions.AppEngException;
import appeng.api.movable.IMovableHandler;
import appeng.api.movable.IMovableRegistry;
import appeng.api.movable.IMovableTile;
import appeng.spatial.DefaultSpatialHandler;
public class MovableTileRegistry implements IMovableRegistry
{
private HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<Class<? extends TileEntity>, IMovableHandler>();
private LinkedList<Class<? extends TileEntity>> test = new LinkedList<Class<? extends TileEntity>>();
private LinkedList<IMovableHandler> handlers = new LinkedList<IMovableHandler>();
private DefaultSpatialHandler dsh = new DefaultSpatialHandler();
private IMovableHandler nullHandler = new DefaultSpatialHandler();
private IMovableHandler testClass(Class myClass, TileEntity te)
{
IMovableHandler handler = null;
// ask handlers...
for (IMovableHandler han : handlers)
{
if ( han.canHandle( myClass, te ) )
{
handler = han;
break;
}
}
// if you have a handler your opted in
if ( handler != null )
{
Valid.put( myClass, handler );
return handler;
}
// if your movable our opted in
if ( te instanceof IMovableTile )
{
Valid.put( myClass, dsh );
return dsh;
}
// if you are on the white list your opted in.
for (Class<? extends TileEntity> testClass : test)
{
if ( testClass.isAssignableFrom( myClass ) )
{
Valid.put( myClass, dsh );
return dsh;
}
}
Valid.put( myClass, nullHandler );
return nullHandler;
}
@Override
public boolean askToMove(TileEntity te)
{
Class myClass = te.getClass();
IMovableHandler canMove = Valid.get( myClass );
if ( canMove == null )
canMove = testClass( myClass, te );
if ( canMove != nullHandler )
{
if ( te instanceof IMovableTile )
((IMovableTile) te).prepareToMove();
te.invalidate();
return true;
}
return false;
}
@Override
public void doneMoving(TileEntity te)
{
if ( te instanceof IMovableTile )
{
IMovableTile mt = (IMovableTile) te;
mt.doneMoving();
}
}
@Override
public void whiteListTileEntity(Class<? extends TileEntity> c)
{
if ( c.getName().equals( TileEntity.class.getName() ) )
{
throw new RuntimeException( new AppEngException( "Someone tried to make all tiles movable, this is a clear violation of the purpose of the white list." ) );
}
test.add( c );
}
@Override
public void addHandler(IMovableHandler han)
{
handlers.add( han );
}
@Override
public IMovableHandler getHandler(TileEntity te)
{
Class myClass = te.getClass();
IMovableHandler h = Valid.get( myClass );
return h == null ? dsh : h;
}
@Override
public IMovableHandler getDefaultHandler()
{
return dsh;
}
}
@@ -0,0 +1,40 @@
package appeng.core.features.registries;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.util.Platform;
public class P2PTunnelRegistry implements IP2PTunnelRegistry
{
HashMap<ItemStack, TunnelType> Tunnels = new HashMap();
@Override
public void addNewAttunement(ItemStack trigger, TunnelType type)
{
if ( type == null )
throw new RuntimeException( "Invalid Tunnel Type." );
Tunnels.put( trigger, type );
}
@Override
public TunnelType getTunnelTypeByItem(ItemStack trigger)
{
if ( FluidContainerRegistry.isContainer( trigger ) )
return TunnelType.FLUID;
for (ItemStack is : Tunnels.keySet())
{
if ( Platform.isSameItemType( is, trigger ) )
return Tunnels.get( is );
}
return null;
}
}
@@ -0,0 +1,81 @@
package appeng.core.features.registries;
import appeng.api.features.IGrinderRegistry;
import appeng.api.features.ILocateableRegistry;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.features.IRegistryContainer;
import appeng.api.features.ISpecialComparisonRegistry;
import appeng.api.features.IWirelessTermRegistery;
import appeng.api.movable.IMovableRegistry;
import appeng.api.networking.IGridCacheRegistry;
import appeng.api.storage.ICellRegistry;
import appeng.api.storage.IExternalStorageRegistry;
public class RegistryContainer implements IRegistryContainer
{
private GrinderRecipeManager GrinderRecipes = new GrinderRecipeManager();
private ExternalStorageRegistry ExternalStorageHandlers = new ExternalStorageRegistry();
private CellRegistry CellRegistry = new CellRegistry();
private LocateableRegistry LocateableRegistry = new LocateableRegistry();
private SpecialComparisonRegistry SpecialComparsonRegistry = new SpecialComparisonRegistry();
private WirelessRegistry WirelessRegistery = new WirelessRegistry();
private GridCacheRegistry GridCacheRegistry = new GridCacheRegistry();
private P2PTunnelRegistry P2PRegistry = new P2PTunnelRegistry();
private MovableTileRegistry MoveableReg = new MovableTileRegistry();
@Override
public IWirelessTermRegistery wireless()
{
return WirelessRegistery;
}
@Override
public ICellRegistry cell()
{
return CellRegistry;
}
@Override
public IGrinderRegistry grinder()
{
return GrinderRecipes;
}
@Override
public ISpecialComparisonRegistry specialComparson()
{
return SpecialComparsonRegistry;
}
@Override
public IExternalStorageRegistry externalStorage()
{
return ExternalStorageHandlers;
}
@Override
public ILocateableRegistry locateable()
{
return LocateableRegistry;
}
@Override
public IGridCacheRegistry gridCache()
{
return GridCacheRegistry;
}
@Override
public IMovableRegistry moveable()
{
return MoveableReg;
}
@Override
public IP2PTunnelRegistry p2pTunnel()
{
return P2PRegistry;
}
}
@@ -0,0 +1,41 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import appeng.api.features.IItemComparisionProvider;
import appeng.api.features.IItemComparison;
import appeng.api.features.ISpecialComparisonRegistry;
public class SpecialComparisonRegistry implements ISpecialComparisonRegistry
{
private List<IItemComparisionProvider> CompRegistry;
public SpecialComparisonRegistry() {
CompRegistry = new ArrayList<IItemComparisionProvider>();
}
@Override
public IItemComparison getSpecialComparion(ItemStack stack)
{
for (IItemComparisionProvider i : CompRegistry)
{
IItemComparison comp = i.getComparison( stack );
if ( comp != null )
{
return comp;
}
}
return null;
}
@Override
public void addComparisonProvider(IItemComparisionProvider prov)
{
CompRegistry.add( prov );
}
}
@@ -0,0 +1,16 @@
package appeng.core.features.registries;
import net.minecraft.tileentity.TileEntity;
public class WirelessRangeResult
{
public WirelessRangeResult(TileEntity t, float d) {
dist = d;
te = t;
}
final public float dist;
final public TileEntity te;
}
@@ -0,0 +1,71 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.features.IWirelessTermRegistery;
import appeng.util.Platform;
import cpw.mods.fml.common.network.Player;
public class WirelessRegistry implements IWirelessTermRegistery
{
List<IWirelessTermHandler> handlers;
public WirelessRegistry() {
handlers = new ArrayList();
}
@Override
public void registerWirelessHandler(IWirelessTermHandler handler)
{
handlers.add( handler );
}
@Override
public boolean isWirelessTerminal(ItemStack is)
{
for (IWirelessTermHandler h : handlers)
{
if ( h.canHandle( is ) )
return true;
}
return false;
}
@Override
public IWirelessTermHandler getWirelessTerminalHandler(ItemStack is)
{
for (IWirelessTermHandler h : handlers)
{
if ( h.canHandle( is ) )
return h;
}
return null;
}
@Override
public void OpenWirelessTermainlGui(ItemStack item, World w, EntityPlayer player)
{
if ( Platform.isClient() )
return;
IWirelessTermHandler handler = getWirelessTerminalHandler( item );
if ( handler == null )
{
player.addChatMessage( "Item is not a wireless terminal." );
return;
}
if ( handler.usePower( (Player) player, 10.0f, item ) )
{
}
}
}
@@ -0,0 +1,88 @@
package appeng.core.features.registries.entries;
import net.minecraft.item.ItemStack;
import appeng.api.features.IGrinderEntry;
public class AppEngGrinderRecipe implements IGrinderEntry
{
private ItemStack in;
private ItemStack out;
private float optionalChance;
private ItemStack optionalOutput;
private int energy;
public AppEngGrinderRecipe(ItemStack a, ItemStack b, int cost) {
in = a;
out = b;
energy = cost;
}
public AppEngGrinderRecipe(ItemStack a, ItemStack b, ItemStack c, float chance, int cost) {
in = a;
out = b;
optionalOutput = c;
optionalChance = chance;
energy = cost;
}
@Override
public ItemStack getInput()
{
return in;
}
@Override
public void setInput(ItemStack i)
{
in = i.copy();
}
@Override
public ItemStack getOutput()
{
return out;
}
@Override
public void setOutput(ItemStack o)
{
out = o.copy();
}
@Override
public int getEnergyCost()
{
return energy;
}
@Override
public void setEnergyCost(int c)
{
energy = c;
}
@Override
public ItemStack getOptionalOutput()
{
return optionalOutput;
}
@Override
public void setOptionalOutput(ItemStack output, float chance)
{
optionalOutput = output;
optionalChance = chance;
}
@Override
public float getOptionalChance()
{
return optionalChance;
}
}
@@ -0,0 +1,58 @@
package appeng.core.features.registries.entries;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import appeng.api.implementations.IChestOrDrive;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.client.texture.ExtraTextures;
import appeng.core.sync.GuiBridge;
import appeng.me.storage.CellInventory;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
public class BasicCellHandler implements ICellHandler
{
@Override
public boolean isCell(ItemStack is)
{
return CellInventory.isCell( is );
}
@Override
public IMEInventoryHandler getCellInventory(ItemStack is, StorageChannel channel)
{
if ( channel == StorageChannel.ITEMS )
return CellInventory.getCell( is );
return null;
}
@Override
public Icon getTopTexture()
{
return ExtraTextures.BlockMEChestItems.getIcon();
}
@Override
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
{
Platform.openGUI( player, (AEBaseTile) chest, chest.getUp(), GuiBridge.GUI_ME );
}
@Override
public int getStatusForCell(ItemStack is, IMEInventory handler)
{
return 1;
}
@Override
public double cellIdleDrain(ItemStack is, IMEInventory handler)
{
CellInventory inv = (CellInventory) handler;
return inv.getIdleDrain();
}
}
@@ -0,0 +1,62 @@
package appeng.core.features.registries.entries;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.AEApi;
import appeng.api.features.IWirelessTermHandler;
import appeng.util.Platform;
import cpw.mods.fml.common.network.Player;
public class BasicTerminalHandler implements IWirelessTermHandler
{
@Override
public boolean canHandle(ItemStack is)
{
if ( is == null )
return false;
if ( AEApi.instance().items().itemWirelessTerminal.sameAs( is ) )
return true;
return false;
}
@Override
public boolean usePower(Player player, float amount, ItemStack is)
{
return false;
}
@Override
public boolean hasPower(Player player, ItemStack is)
{
return false;
}
@Override
public String getEncryptionKey(ItemStack i)
{
if ( i == null )
return null;
NBTTagCompound tag = Platform.openNbtData( i );
if ( tag != null )
{
return tag.getString( "encKey" );
}
return null;
}
@Override
public void setEncryptionKey(ItemStack i, String encKey, String name)
{
if ( i == null )
return;
NBTTagCompound tag = Platform.openNbtData( i );
if ( tag != null )
{
tag.setString( "encKey", encKey );
}
}
}
@@ -0,0 +1,57 @@
package appeng.core.features.registries.entries;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.Icon;
import appeng.api.implementations.IChestOrDrive;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.client.texture.ExtraTextures;
import appeng.items.storage.ItemCreativeStorageCell;
import appeng.me.storage.CreativeCellInventory;
public class CreativeCellHandler implements ICellHandler
{
@Override
public boolean isCell(ItemStack is)
{
return is != null && is.getItem() instanceof ItemCreativeStorageCell;
}
@Override
public IMEInventoryHandler getCellInventory(ItemStack is, StorageChannel channel)
{
if ( channel == StorageChannel.ITEMS && is != null && is.getItem() instanceof ItemCreativeStorageCell )
return CreativeCellInventory.getCell( is );
return null;
}
@Override
public Icon getTopTexture()
{
return ExtraTextures.BlockMEChestItems.getIcon();
}
@Override
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
{
player.sendChatToPlayer( ChatMessageComponent.createFromText( "Not ready yet..." ) );
}
@Override
public int getStatusForCell(ItemStack is, IMEInventory handler)
{
return 2;
}
@Override
public double cellIdleDrain(ItemStack is, IMEInventory handler)
{
return 0;
}
}