16

I want to have a button to enchant a piece of armor in my hand with Unbreaking V, if and only if:

  • The tool is already enchanted with Unbreaking III
  • The player has a minimum of 30 levels

I tried using /testfor for a certain enchantment on a certain item ID range, taking away 30 levels, and then enchanting the item in-hand with /enchant. But it turns out you cannot use /enchant to make higher than default enchantment levels, you can only do that with the /give command.

I do not know how I am supposed to use the /give command because the item given has to have all the enchantments it had before it was enchanted with Unbreaking V.

15
  • What you wanna do: Testfor Break3 armor -> remove Break3 armor -> /give Break5 armor. correct?
    – 54D
    Commented Apr 8, 2015 at 14:25
  • @ArceusMaster0493 They also seem to want to keep "the same previous enchants" that are on the armor.
    – SirBenet
    Commented Apr 8, 2015 at 16:25
  • 4
    Well a dumb solution is to add a set of command blocks for every enchant and item combo
    – Moddl
    Commented Apr 15, 2015 at 1:47
  • 2
    Possible duplicate of How can I modify an item while it is inside the player's inventory?
    – pppery
    Commented Oct 14, 2022 at 21:07
  • 2
    Despite the fact that this question has 9 answers, as far as I can tell none of them actually answer the question, and the duplicate does.
    – pppery
    Commented Oct 14, 2022 at 21:07

9 Answers 9

3

Correct me if I'm wrong, but the only way would be to add command blocks for every single armor enchant and level combo in the game. (Unless you wanted to host a server on your computer running bukkit and just not allow anyone in. Then you could download essentials and use /enchant )

0

Unless you have a two command blocks constantly checking for the tool in one hand and the armour in the other, and have command blocks testing for all enchantment combinations AND testing for the xp level, and somehow linking them all to one output, this system is impossible.

The problem with this task is format. A villager generated through a command generator that gives you specific trade that takes a tool (eg. sword) and an item only accessible through a testfor command that detects a certain amount of xp, notifies the player, then gives the second item(eg. emerald). Therefore the villager would trade a Sharpness III sword and 1 paper to give you a Sharpness V sword. This can obviously be adapted for anything you like. A website I recommend is called MCStacker.

-1

Well here's the problem: you are unable to hold multiple objects in your hand! You are trying to enchant armor while holding a tool and that's an issue. Try holding the armor instead and enchanting it that way.

-1

Have you tried using /testfor to find a player with the item then using /replaceitem entity Bob slot.hotbar.0 minecraft:diamond_sword 1 0 {ench:[{id:34,lvl:5}]} -That sets the first hotbar slot of the player named "Bob" to a diamond sword.

-1

well the first thing to do is see if you need to verify/enchant.... so check for the level 3 you require for the upgrade.

if less than three skip the rest and reject...... but if three (or more for lazy way,) you need to figure out everything it holds so>>>>

the following will assume no over enchantments will exist and if it finds an over enchantment this LAZY WAY will set that enchantment to the maximum. this method is already very long and complimented so this assumption will give you more hair pulling before you decide to kill yourself due to how complicated it is (jk on kill yourself but really, redstone is very simple) so , on to it

there was a list of enchantments listed by what they enchant.... it was down voted by at least three people with their heads so far up their "where the sun don't shine" that you should immediately ignore everything they say.... too bad we don't have a complete list of them.... on to the list.

that list helps to limit what to check for so on the list of the item in question, the range is 32 - 35 but you already know unbreaking so don't have to check for that.

after each check (32, 33, and 35) you will need to save the value returned... rs latch for each level and each enchantment (don't forget an rs latch for level zero of each) then simply set the correct latch for each three

now you have over a dozen rs latches but only three of them are set. a command block tree can select the correct /give command for giving your upgraded tool. to allow multiple overclocked enchantments would be easier if there is a way to pass a number to the /give command but i doubt that is possible so while this lazy way has only 48 possible /give commands if you were trying to jump increase armor the command tree would be 80,000 - 200,000 depending on what enchantment you were increasing

that all said, I have a less than automatic way to do this but WAY WAY simpler it is different from you intention so i will place in a separate answer

-2

All you need to do is:

/give <username> minecraft:diamond_sword 1 0 {each:[{id:16,lvl:10}]} 

This is for a sharp X diamond sword.

This goes all the way up to level 32780.

1
  • 1
    How would OP keep the previous enchantments that are already on their weapon, as asked in the question?
    – SirBenet
    Commented Jul 6, 2015 at 20:24
-3

You can use 'clear', then 'give' to give an enchanted item.

First, make a command block with 'clear @p diamond_sword', then add a comparator leading into another command block:

'give @p diamond_sword 1 0 {ench:[{id:diamond_sword,lvl:5}]}'

You can do the same for armor and other tools.

2
  • This does not keep the enchantments on the item as OP requested.
    – SirBenet
    Commented Apr 16, 2015 at 16:27
  • Whoops, didn't realize. Is it not an option to give a whole new item with unbreaking and the new enchant? Commented Apr 16, 2015 at 21:57
-3

Easy to do! just go the minecraftcommand.science and there you can make your own commands for example a diamond sword with sharpness 1000000000

(even though that will only do 8 damage as it passes the limit)

1
  • How does this allow OP to enchant an item whilst keeping the item's previous enchantments?
    – SirBenet
    Commented Aug 4, 2015 at 14:08
-4

Here is a list of enchantments:

Armor

  • 0.protection
  • 1.fire_protection
  • 2.feather_falling
  • 3.blast_protection
  • 4.projectile_protection
  • 5.resperation
  • 6.aqua infinity
  • 7.thorns
  • 8.depth_strider Weapons

  • 16.sharpness

  • 17.smite
  • 18.bane of atropods
  • 19.knockback
  • 20.fire aspect
  • 21.looting

Tools

  • 32.efficiency
  • 33.silk touch
  • 34.unbreaking
  • 35.fortune

Bows

  • 48.power
  • 49.punch
  • 50.flame
  • 51.infinity
2
  • What has this got to do with the question? Commented Jul 25, 2015 at 1:35
  • why did I lose reputation for downvoting this?
    – Aceplante
    Commented Feb 16, 2022 at 17:49

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