Use /enchant to add an enchatement on a holding item with restriction (normal max enchant level, compatibility, enchantable item)

How can I add an enchant to an item I am holding(or what command to use in replacement)? Thanks a lot!


Ok, after 4 hours of commandblocking, I got this:
Super RS CMD Block stuff

Now to explain:

to activate this all, just use this command:

/setblock wool coords minecraft:redstone_block

The CB #1 is to replace the redstone block with wool:

/setblock wool coords minecraft:wool

The CB #2's make new scoreboard objectives:

/scoreboard objectives add selectMe dummy
/scoreboard objectives add selectMe2 dummy
/scoreboard objectives add selectMe9 dummy

The #3's have this:

/scoreboard players set @a selectMe 0
/scoreboard players set @a selectMe9 0

The CB's labeled 4 use this commands:

/scoreboard players set @a selectMe 1 {SelectedItem:{id:"minecraft:TOOL1"}}
/scoreboard players set @a selectMe9 1 {SelectedItem:{id:"minecraft:TOOL9"}}

Now, the line tagged #5 has:

/clear @a[score_selectMe_min=1] minecraft:TOOL1 0 1
/clear @a[score_selectMe9_min=1] minecraft:TOOL9 0 1

Finally, those with #6:

/give @a[score_selectMe_min=1] minecraft:TOOL1 1 0 {ench:[{id:ENCH_FOR_TOOL1,lvl:10}]}
/give @a[score_selectMe9_min=1] minecraft:TOOL9 1 0 {ench:[{id:ENCH_FOR_TOOL9,lvl:10}]}

The 7-15 commands vary only in the items, enchant id's and scoreboard stuff:

7 - iron_helmet, 0, selectMe
8 - iron_chestplate, 0, selectMe2
9 - iron_leggings, 0, selectMe3
10 - iron_boots, 0, selectMe4
11 - iron_sword, 16, selectMe5
12 - bow, 48, selectMe6
13 - iron_shovel, 32, selectMe7
14 - iron_axe, 32, selectMe8
15 - iron_pickaxe, 32, selectMe9

This system will obvioulsy work only with certian (iron) items, will give only 1 enchant and will need for the Player to hold the item whilst entering the command - see higher.
So you would need to use a giant system for auto-executing a enchant, but if you just use the give command:

/give @p YOUR_TOOL 1 0 {ench:[{id:FIRST_ENCH_ID,lvl:2},{id:SECOND_ENCH_ID,lvl:30}]}

Hope helped a bit.

| improve this answer | |

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.