Need help creating a little addon

  • Alright, so I've seen some tutorials on how to create a basic IElectricItem, but the info is out of date. A lot has changed in IC2exp. For example, getChargedItemId and getEmptyItemId are now just getChargedItem and getEmptyItem respectively, so I have no idea what to put in there. I just can't figure out the basic code that's required for an electric item. Can someone share knowledge with me?

    • Official Post

    In getChargedItem() and getEmptyItem() you mostly want to return "this". This is just there for things like RE-Batteries, that have a different Item depending on if there is charge in the Item or not.
    In general, the JavaDoc comments in the API are mostly up-to-date.

  • If it is only a 2-5 items mod then use the ic2 creative tab.. I mean why spamming Creativetabs...
    If it is planned as big mod then you should do one of your own...
    But if not get the creative tab from ic2

  • You should create your own Creative Tab.


    Oh, okay. How do I add discharged and charged states of my item to the NEI then? Currently it is there without any metadata\damage value.


    If it is only a 2-5 items mod then use the ic2 creative tab.. I mean why spamming Creativetabs...
    If it is planned as big mod then you should do one of your own...
    But if not get the creative tab from ic2


    Exactly! As title states "little addon", I only plan on adding one item, lol.

  • For some reason when I try to use IC2 recipe manager game just crashes during loading throwing java.lang.NullPointerException: Initializing game. Maybe I'm doing something wrong? The recipe is shapeless, and works if I use forge's GameRegistry.

    • Official Post

    Oh, okay. How do I add discharged and charged states of my item to the NEI then? Currently it is there without any metadata\damage value.

    You can just override the getSubItems class and add the empty verdion of the item to the list and then you add another Item that you prepare in before with ElectricItemManager.charge() or something.

    For some reason when I try to use IC2 recipe manager game just crashes during loading throwing java.lang.NullPointerException

    You, as an addon creator, should know that ,in order to help you, we need a full crash log.

  • There is a simple list you can do.
    1: Is Ic2 in your dev invioment?
    2: Is in your mod declared that your mod has to load after IC2
    3: Did you try to load recipes not on Preinit (init is the recipe state)
    4: If that was the case what about post init.
    5: If that still crashes do you have the right itemName? (If you access ic2 items)
    6: If everything fails then push a crashlog.

  • You, as an addon creator, should know that ,in order to help you, we need a full crash log.


    Sorry for asking stupidest questions, but it's been a while since I was modding for Minecraft (1.2.5 to be sure), many things have changed since then. And as for IC2 API, it's completely new for me.



    1. Of course.
    2. Yes.
    3. I tried init and it wasn't working.
    4. With Postinit it's now working, thanks!

  • No problem.
    If something crashes. Make yourself a list what could cause it. Even if it is something stupid. Put it on the list and try everything out. With that you can fix almost every bug...