3

I want to with every command add one enchantment level like this:

/replaceitem entity {player} slot.armor.head chainmail_helmet 1 0 {ench:[{id:0,lvl:+1}]

Level: +1

Or

If I have a helmet with protection: 1, after the command it should be protection: 2.

Can you help me?

  • I don't think it is possible, you can only list out all the enchantment you want with level, detect the current enchantment and give 1 more level... – pca006132 Mar 14 '17 at 23:12
0

you can do it, but it will need multiple command blocks, first of all, you will use testfor for example

/testfor @a {SelectedItem:{id:"minecraft:iron_sword",Damage:0s,Count:1b,tag:{ench:[{id:20s,lvl:1s}]}}}

that's if you want it for an item, but if you want it for a piece of armor try this

/testfor @a {Inventory:[{id:"minecraft:chainmail_chestplate",Damage:0s,Count:1b,Slot:102s,tag:{ench:[{id:4s,lvl:1s}]}}]}

after using the testfor in a repeat command block that is always active and nonconditional then put in front of it a chain command block that is conditional and always active and then write inside of it

/replaceitem entity @a slot.armor.chest minecraft:chainmail_chestplate 1 0 {ench:[{id:4s,lvl:2s}]}

and if it had level 2 repeat the steps mentioned up, just replace the first command(for the armor) enchantment from 1 to X(the level you want) and the second command from 2 to X+1

  • You should not be using @e, which selects all entities. As the question and data refer to players only, you should be using @a. Secondly, be aware that this is not multiplayer-friendly. The /replaceitem command presented is going to affect all players, not the relevant ones. If only one player matched, then all players are modified. You should be using /scoreboard to assign a label (score or "tag") instead of using /testfor, which is mostly useless for multiplayer-friendliness. – Skylinerw Mar 22 '17 at 19:57
  • you are right, sorry, do I edit my answer or add a new one? – Mohannad El-Nesr Mar 24 '17 at 13:59
  • Editing is fine! – Skylinerw Mar 24 '17 at 14:56
  • edited the post, done ;) – Mohannad El-Nesr Apr 28 '18 at 15:48

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.