2013-12-27 23:59:59 +01:00
|
|
|
package appeng.core.features.registries.entries;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraft.util.IIcon;
|
2014-01-23 20:02:48 +01:00
|
|
|
import appeng.api.implementations.tiles.IChestOrDrive;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.storage.ICellHandler;
|
2014-03-28 01:48:38 +01:00
|
|
|
import appeng.api.storage.ICellInventory;
|
|
|
|
import appeng.api.storage.ICellInventoryHandler;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.storage.IMEInventory;
|
|
|
|
import appeng.api.storage.IMEInventoryHandler;
|
2014-07-28 07:11:34 +02:00
|
|
|
import appeng.api.storage.ISaveProvider;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.storage.StorageChannel;
|
2014-05-26 03:58:44 +02:00
|
|
|
import appeng.client.texture.ExtraBlockTextures;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.core.sync.GuiBridge;
|
|
|
|
import appeng.me.storage.CellInventory;
|
2014-01-20 17:41:37 +01:00
|
|
|
import appeng.me.storage.CellInventoryHandler;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.tile.AEBaseTile;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
|
|
|
|
public class BasicCellHandler implements ICellHandler
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isCell(ItemStack is)
|
|
|
|
{
|
|
|
|
return CellInventory.isCell( is );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-07-28 07:11:34 +02:00
|
|
|
public IMEInventoryHandler getCellInventory(ItemStack is, ISaveProvider container, StorageChannel channel)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
if ( channel == StorageChannel.ITEMS )
|
2014-07-28 07:11:34 +02:00
|
|
|
return CellInventory.getCell( is, container );
|
2013-12-27 23:59:59 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-07-17 06:44:02 +02:00
|
|
|
public IIcon getTopTexture_Dark()
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-07-17 06:44:02 +02:00
|
|
|
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IIcon getTopTexture_Light()
|
|
|
|
{
|
|
|
|
return ExtraBlockTextures.BlockMEChestItems_Light.getIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IIcon getTopTexture_Medium()
|
|
|
|
{
|
|
|
|
return ExtraBlockTextures.BlockMEChestItems_Medium.getIcon();
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@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)
|
|
|
|
{
|
2014-01-20 17:41:37 +01:00
|
|
|
if ( handler instanceof CellInventoryHandler )
|
|
|
|
{
|
|
|
|
CellInventoryHandler ci = (CellInventoryHandler) handler;
|
|
|
|
return ci.getCellInv().getStatusForCell();
|
|
|
|
}
|
|
|
|
return 0;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double cellIdleDrain(ItemStack is, IMEInventory handler)
|
|
|
|
{
|
2014-03-28 01:48:38 +01:00
|
|
|
ICellInventory inv = ((ICellInventoryHandler) handler).getCellInv();
|
2013-12-27 23:59:59 +01:00
|
|
|
return inv.getIdleDrain();
|
|
|
|
}
|
|
|
|
}
|