1

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.

4
  • You might have to flesh this out a bit more. Are you trying to create a jetpack using Vanilla Minecraft through commands, or are you trying to create a modpack?
    – Ben
    Commented Dec 14, 2016 at 23:05
  • Vanilla commands. 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.
    – Kiqro
    Commented Dec 14, 2016 at 23:10
  • If the battery is a chest plate, just damage the player a bit. This would cause the plate taking damage / losing durability as well.
    – dly
    Commented Dec 15, 2016 at 8:36
  • 4

1 Answer 1

1

Unfortunately, Minecraft currently dosent have a way to dynamically edit nbt data. (I.e, lower a durability value by 1). The only way do do this directly would be to have 2 command blocks for every durability value, and when you want it to drop, test for a durability and set it to the next value down (set the durability of chestplate with damage 4 to damage 3, and ect...). Another alternative you could look into is damaging the player. If this chestplate is being worn by the player, then dealing a small amount may lower thr durability by one.

3
  • Hmm, ok, but if I wanted to give damage to the player and harm the armor, I'm not completely sure how to do that. I want to test for the active potion effect of levitation, but it doesn't seem to work. What commands would you use to test the active potion effect? I tried using:
    – Kiqro
    Commented Dec 15, 2016 at 23:15
  • /testfor @p {ActiveEffects:[{21}]}, but it doesn't work
    – Kiqro
    Commented Dec 15, 2016 at 23:16
  • When testing for nbt data, you need to specify the data type (when setting nbt data it autofills). This is a letter 'S' or 'B' (usually, but there are a few others) following the number. In addition, the active effects tag required an 'Id:#' specification. /test for @p {ActiveEffects:[{id:21s}]} shoul work
    – SB32
    Commented Dec 15, 2016 at 23:49

Not the answer you're looking for? Browse other questions tagged .