How to properly register electric tool in IC2V2

  • Here is a code:




    And it seems, that in creative tab both items are have no charge. On click with "charged" version of item it becomes discharged instantly.

    • Official Post

    - I'd use only 1 item, not 2 unless there's special requirements e.g. for stacking -> getChargedItem and getEmptyItem are the same.
    - getTransferLimit returning 0 makes it useless, you can't charge it then. It's the max amount of eu to charge per tick.
    - setMaxDamage(2) is a bit low, that won't allow displaying the charge level well using the damage bar, ic2 uses 27
    - for the creative page, you'll have to add your item manually, once discharged and once fully charged. You have to charge it yourself while doing so. To implement this override getSubItems and add 2 stacks of this item after passing each through ElectricItem.manager.charge with charge = 0 and Integer.MAX_VALUE (or maxCharge, same effect) respectively. Set ignoreTrasnferLimit to true in those charge calls.
    - Don't instantiate your items like that. It's recommend to do so in preInit, not while declaring them, which would create them way too early.


    Extending ElectricItem isn't required/recommended, it just needs to implement IElectricItem properly