Hello, first of all I'd like to lay out that I'm a brand new modder who is working on their first mod in 1.12, coming in with at least some amount of basic Java knowledge.
I'm trying to add behavior that will negate any damage taken to tools/armor if it is a certain tool material. From what I can tell, there aren't any forge hooks that will fire if an item changes its damage value, so at the moment I only have implemented a block break event that will detect if the mainhand held item is DIAMOND and if so, set the items damage to 0, which works perfectly.
So what's the problem?
The event handler executes the code and then hands it over to the vanilla methods, which proceed to attempt to damage the item, essentially giving the tool a permanent 1 item damage. I wouldn't mind this since it does indeed make the tool unbreakable, but it also renders the durability bar over the item, which I dislike. Trying to figure out this problem has honestly been a head scratcher, especially since I'm still very new to modding and don't fully understand what Forge is fully capable of yet. I've considered the following options:
1. Somehow cancel the client rendering the durability bar
2. Cancel the block break event and then put in my own implementation so that the tool isn't damaged
3. Every tick check to see if a diamond tool is damaged and then reverse it (Which seems like a very wasteful use of resources)
4. See if a library exists which can handle item durability better (I currently have no idea when to use libraries like Mantle, Bookshelf, Crafttweaker, ect.)
5. Create a custom forge hook that will fire when Item.setDamage() executes (No idea where to even start on this one)
Feedback would be a godsend since I've had little luck finding information related to this particular problem