I'm trying to make a jetpack with a battery using Vanilla Minecraft commands. The more you use it, the more the battery depletes. So far, I have the 'battery' part working and the jetpack itself, but I cannot figure out how to lower the durability of an item every time you use the jetpack.
I've used the carrot on a stick as the jetpack, so when I right click and hold it levitates me up slightly, and I got a chest plate as the battery (Because it has durability). I've also made it where the jetpack only works if you have the battery, so if the durability of the chest plate runs out, then it won't work anymore. My only issue is that I can't figure out how to lower the durability of the chest-plate (acting as the battery) when I use the jetpack.