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.

  • 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 Dec 14 '16 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 Dec 14 '16 at 23:10
  • Are you able to help me? Or are you here just to edit the question and get more reputation or something – Kiqro Dec 14 '16 at 23:29
  • 1
    personally, no I cannot help you. As for editing the question, I simply added the information you gave me so that others who may be able to help have more of an idea of what you are trying to achieve. I don't get anything from doing this, I'm just trying to help. – Ben Dec 15 '16 at 0:46
  • 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 Dec 15 '16 at 8:36
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.

  • 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 Dec 15 '16 at 23:15
  • /testfor @p {ActiveEffects:[{21}]}, but it doesn't work – Kiqro Dec 15 '16 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 Dec 15 '16 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.