[support] maxDamage
Romz24 opened this issue · 10 comments
I'm trying to use maxDamage to change the max durability of an item but it doesn't work. Can you please add a feature that will make it possible to change the durability of items from the ic2 mod?
var rotor_carbon = <ic2:rotor_carbon>;
print("rotor_carbon: " ~ rotor_carbon.maxDamage);
rotor_carbon.maxDamage = 1000;
print("rotor_carbon: " ~ rotor_carbon.maxDamage);
[INITIALIZATION][CLIENT][INFO] rotor_carbon: 604800
[INITIALIZATION][CLIENT][INFO] Setting max damage of Carbon Rotor to 1000
[INITIALIZATION][CLIENT][INFO] rotor_carbon: 604800
All (wind) rotors in IC2 have custom implementation for max damage.
I will see what I can do about it.
It seems to be a problem with the ic2 mod, even if you force the item name to change, it changes back to the original. All changes from scripts (CraftTweaker) are simply discarded.
It seems to be a problem with the ic2 mod, even if you force the item name to change, it changes back to the original. All changes from scripts (CraftTweaker) are simply discarded.
Yes, that is because IC2 decides to store rotor damage in NBT. So it has to have custom implementation for damage-related things, but they somehow missed Item.setMaxDamage
.
Edit: … or it is intentional. It seems that IC2 doesn't anticipate the possibility of changing max durability of rotors.
Edit II: regarding display name. Mind you sharing your script? Typically, you'd like to change the language file in order to change the display name of a certain item.
Do you mind having something like this:
print("rotor_carbon: " ~ rotor_carbon.ic2MaxDamage); // In theory this would be just alias of maxDamage
rotor_carbon.ic2MaxDamage = 1000;
print("rotor_carbon: " ~ rotor_carbon.maxDamage);
?
Tried on my own.
CraftTweaker uses wrong translation key when overriding the display name. This is out of my control. The correct translation key for <item:ic2:dust:31>
should be ic2.dust.ender_pearl
but CraftTweaker uses ic2.dust.ender_pearl.name
.
I can only suggest to use a resourcepack to override this.
Regarding to the main topic of this ticket. I will go with ic2Damage
and ic2MaxDamage
then. Documentation will come later.
Can you do something similar so that you can conveniently change the charge level and energy of items through scripts? At the moment, all this data is recorded in NBT, and if this is the charge level, in addition to NBT, we also need to edit the damage of the item so that it is displayed visually (for example, if it is a drill, or an energy crystal).
I think it should work like this:
<myic2item>.ic2Charge = 1000000; // set item charge (nbt + damage)
print("item: " ~ <myic2item>.ic2Charge); // return item charge
print("item: " ~ <myic2item>.ic2MaxCharge); // return item max charge
<myic2item>.ic2Enegy = 4000000; // set item energy (ntb)
print("item: " ~ <myic2item>.ic2Enegy); // return item energy
print("item: " ~ <myic2item>.ic2MaxEnegy); // return item max energy
Sure. For easier management I have created GH-10 to track this feature.
https://www.curseforge.com/minecraft/mc-mods/ic2-tweaker/files/4083913
New version has been released. Please try and let me know if anything goes wrong.