[BUG] IC 1.97 API. IElectricItem not work correctly.

  • I working now at new addon for IC. But i faced the problem in ElecticItem.class main IC code. If i set MaxCharge of my item more than 5 000 000. Algorithm of calculation of a charge state in ElectricItem not work correctly (through meta data). Please fix algorithm of calculation charge state and Render through meta data.


    Sample of new formula:

  • short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters.


    extreme amount of enternal variables inside IC2 code are shorts and you meet overlow, default durability for every electric item is 30002

  • it is not smart to use large data structures everywhere, integer is fine for nearly everything.


    just do not bloat your objects with useless zeros, you will never need such precice calculations of item state, ever 5000 durability will go fine with rounding and some logic.

  • Since v1.60 the charge for an electric item is stored in NBT as an int, with the damage value (0-23 if I remember correctly) only being used to scale the durability bar and determine the special partially charged icons on batteries, crystals and lapotrons.

  • Hm... I fixed this problem another way. I set manual maxDamage of item = 26 (setMaxDamage(26)). And all work correctly o_0. Very strange, why at creation items meta value not truly was defined...