/enchant
< Commands
/enchant| Permission level required |
|
|---|---|
| Restrictions |
Cheat only |
{
"title": "<code>/enchant</code>",
"rows": [
{
"field": "\n* 2 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Java Edition\">(link to Java Edition article, displayed as JE) only</span></i>]</sup>\n* 1 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Bedrock Edition\">(link to Bedrock Edition article, displayed as BE) only</span></i>]</sup>",
"label": "(link to Permission level article, displayed as Permission level<br>required)"
},
{
"field": "(link to Options article, displayed as Cheat) only<sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Bedrock Edition\">(link to Bedrock Edition article, displayed as BE) only</span></i>]</sup>",
"label": "(link to Commands#Restrictions article, displayed as Restrictions)"
}
],
"invimages": [],
"images": []
}
Adds an enchantment to a player's selected item, subject to the same restrictions as an anvil.[1] Also works on any mob or entity holding a weapon/tool/armor in its main hand.
Syntax
- Java Edition
enchant <targets> <enchantment> [<level>]
- Bedrock Edition
enchant <player: target> <enchantmentId: int> [level: int]enchant <player: target> <enchantmentName: Enchant> [level: int]
Arguments
JE: <targets>: entity
BE: player: target: CommandSelector<Actor>
- Specifies the target(s).
- Must be a player name, a target selector or a UUID.
JE: <enchantment>: resource
BE: enchantmentId: int: int or <enchantmentName: Enchant>: enum
- Specifies the enchantment to be added to the item held in main hand by the target.
- In Java Edition, must be an existing registered resource location in
minecraft:enchantmentregistry. In Bedrock Edition, must be an ID of an enchantment (without namespace)
JE: <level>: integer
BE: level: int: int
- Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantment[2]. If not specified, defaults to 1.
- Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). In Java Edition, it must be between 0 and 2147483647 (inclusive). In Bedrock Edition, it should be between 1 and 2147483647 (inclusive).
Result
| Command | Trigger | Java Edition | Bedrock Edition |
|---|---|---|---|
| Any | The command is incomplete, or any argument is not specified correctly. | Unparseable | Unparseable |
<targets> or player: target fails to resolve to one or more entities (named player must be online). | Failed | Failed | |
level: int is lower than 1. | N/A | ||
<level> or level: int is greater than the maximum level for the specified enchantment. | Failed | ||
All the selected entities meet one or more of the following conditions:
| |||
| Otherwise | Successful | ||
Output
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
| Any | Java Edition | On fail | 0 | 0 | 0 |
| On success | 1 | 1 | the number of players whose items are successfully enchanted. | ||
| Bedrock Edition | On fail | 0 | N/A | N/A | |
| On success | the number of players whose items are successfully enchanted. | N/A | N/A |
Examples
- To give the Infinity enchantment to all players holding a bow:
/enchant @a infinity
- To enchant the nearest player's held sword with Sharpness 5:
/enchant @p sharpness 5
History
This section needs expansion.
You can help by expanding it.
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.4.4 | pre | Added /enchant. | |||||
| 1.13 | 17w45a | Removed /enchant. | |||||
| 18w06a | Re-added /enchant. | ||||||
| 1.19.3 | 22w42a | <enchantment> now accepts a resource argument, instead of item_enchantment. | |||||
| Pocket Edition Alpha | |||||||
| v0.16.0 | build 5 | Added /enchant. | |||||
| Bedrock Edition | |||||||
| 1.19.20 | Preview 1.19.20.22 | /enchant command now can be applied on mobs.[3] | |||||
| 1.19.50 | Preview 1.19.50.20 | Using the /enchant command to apply the same level of enchantment no longer results in a higher level being applied.[4] | |||||
References
- ↑ MC-261942
- ↑ Although
/enchantenforces maximum levels and compatibility, other commands (such as/give,/replaceitem, and/data) can bypass these restrictions. - ↑ MCPE-113623 — resolved as "Fixed".
- ↑ MCPE-153204 — resolved as "Fixed".