[bug] ic2Energy and ic2MaxEnergy not working
Romz24 opened this issue · 4 comments
The Charge and Energy functions work completely identical to each other. They return/change only the value for Charge. In fact, these are 2 different values, items (drill, saw, nano saber, energy crystal, ...) have a charge level, and blocks (mfe, mfsu, ...) have an energy level.
// Code:
var mfe = <ic2:te:74>.withTag({energy: 370040.3});
print("[Charge]" ~ mfe.displayName ~ ": " ~ mfe.ic2Charge ~ "/" ~ mfe.ic2MaxCharge);
print("[Energy]" ~ mfe.displayName ~ ": " ~ mfe.ic2Energy ~ "/" ~ mfe.ic2MaxEnergy);
// Result:
[Charge]МФЭ: 0.0/0.0
[Energy]МФЭ: 0.0/0.0
// Code:
var goggles = <ic2:nightvision_goggles>.withTag({charge: 19000.5});
print("[Charge]" ~ goggles.displayName ~ ": " ~ goggles.ic2Charge ~ "/" ~ goggles.ic2MaxCharge);
print("[Energy]" ~ goggles.displayName ~ ": " ~ goggles.ic2Energy ~ "/" ~ goggles.ic2MaxEnergy);
// Result:
[Charge]Прибор ночного видения: 19000.5/200000.0
[Energy]Прибор ночного видения: 19000.5/200000.0
Interesting. I thought they are the same. Looks like I need to get sometime to re-play IC2 again.
Mind you describe what is the correct behavior?
Mind you describe what is the correct behavior?
Charge and Energy are almost the same in the game, but are written differently in NBT field. As I wrote above, items (drill, saw, nano saber, energy crystal, ...) store energy in the "charge" field, and blocks (mfe, mfsu, ...) store it in the "energy" field. The current behavior of your mod is unable to get and also change the "energy" field for blocks, I hope you understand what I mean.
My point is that ic2Energy and ic2MaxEnergy don't work the way they should.
Just an update on this ticket: the item forms of MFE, MFSU, etc. are not considered as "electric items" internally. This explains why ic2Energy
does not work on MFE/MFSU/...
Code-wise, this means that the item forms of MFE/MFSU/... are not IElectricItem
nor ISpecialElectricItem
.
For now, possible options are:
- Deal with it - modify NBT directly when needed.
- I could hard-code them so that at last BatBox/CESU/MFE/MFSU and their charge-pad version work.
There are several implications about this approach: first, this won't work with other mods - I also have to hard-code for items from other mods; second, theenergy
NBT is technically an internal thing - it may change after next IC2 update (although IC2 for 1.12.2 has probably stopped being maintained). - Ask IC2 dev if this can be changed - again, IC2 for 1.12.2 has probably stopped being maintained.