Okay I know I have been posting here a lot recently and I want to make it clear, 1. I am not working on a big huge project that is going to be released I am just trying to relearn some things since the last time I modded was back in 1.4, 2. Eventually with the new Knowledge I gain I do plan on making a mod but not quit sure yet on what I want.
Now time for my confusion, so I decided to move to tools and armor cause I've been curious on what I can do with them and so far on my own i was able to make two swords one has a enchant on crafting witch wasn't that hard to do, and the second one has a potion effect when it hits an entity witch again wasn't hard to do I even made a key binding where you can turn off the effect of the second sword.
What led me to the key binding was I wanted the weapon to take different damage based if the effect was on or off, now here is where I'm confused, first I set the max damage to 10(for testing purpose) and then decided to test if that did anything without adding anything to the hit entity function, and nothing happened to the durability at first I decided to look to see if there was any posts on this and I came up with only one post explain he was working with is own material, as for me though I am working with iron as the material.
So I did more testing and decided in my hit entity function to set damage to 2 when the effect was off and 5 when it was on(again testing purpose) but every time it would hit any entity instead of subtracting more durability it was only setting the new durability to 8 and 5 now this is were I'm confused why durability will not drop at all.
Note: I have took out the set damage part out completely for now in the code but if you would like to see it this is the part class I am working in https://github.com/SureShotM/Moding-For-Fun/blob/master/src/main/java/com/Leo/mff/item/ItemLionsSword.java