Here is a code:
public class IHLMod {
public static IHLMod instance;
public static Item ic2_handpump = (new IHLHandPump().setUnlocalizedName("handpump"));
public static Item ic2_handpump_discharged = (new IHLHandPump().setUnlocalizedName("handpump_discharged"));
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
MinecraftForge.EVENT_BUS.register(new IHLEventHandler());
GameRegistry.registerItem(ic2_handpump, "Handpump");
GameRegistry.registerItem(ic2_handpump_discharged, "Discharged handpump");
}
public class IHLHandPump extends Item implements IElectricItem {
public static int maxCharge = 10000;
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":itemElectricHandpump");
this.setMaxDamage(2);
}
public IHLHandPump()
{
super();
this.maxStackSize = 1;
this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public boolean canProvideEnergy(ItemStack itemStack) {
return false;
}
@Override
public Item getChargedItem(ItemStack itemStack) {
return IHLMod.ic2_handpump;
}
@Override
public Item getEmptyItem(ItemStack itemStack) {
return IHLMod.ic2_handpump_discharged;
}
@Override
public int getMaxCharge(ItemStack itemStack) {
return maxCharge;
}
@Override
public int getTier(ItemStack itemStack) {
return 1;
}
@Override
public int getTransferLimit(ItemStack itemStack) {
return 0;
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
ElectricItem.manager.discharge(par1ItemStack,40,1,false,false);
return par1ItemStack;
}
}
And it seems, that in creative tab both items are have no charge. On click with "charged" version of item it becomes discharged instantly.