Commands/enchant

From Minecraft Wiki
Jump to: navigation, search
enchant
Restrictions

Operator

First introduced

1.4.4 (1.4.4-pre)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 5)

Adds an enchantment to a player's selected item, subject to the same restrictions as an anvil.

Syntax
  • Java Edition
enchant <player> <enchantment ID> [level]
  • Pocket Edition
enchant <player: target> <enchantmentId: int> [level: int]
An alternate syntax for enchantment ID's name uses:
enchant <player: target> <enchantmentName: string> [level: int]
Arguments
player (PE: player: target)
Specifies the target(s). Must be a player name or target selector.
enchantment ID (PE: enchantmentId: int or enchantmentName: string)
Specifies the enchantment to be added to the item held by the target. Must be a valid enchantment ID (for example, 16 or minecraft:sharpness).
level (PE: level: int) (optional)
Specifies the enchantment level. Must be at least 1 and not greater than the maximum level for the specified enchantment. If not specified, defaults to 1.
Result
Fails if arguments are not specified correctly, if player fails to resolve to one or more online players, or if the enchantment is not valid for the item or conflicts with current enchantments (for example, "Fire Protection" cannot be given to armor which already has "Protection", and "Sharpness III" cannot be given to a sword which already has "Sharpness I").
On success, adds the specified enchantment to the item held by the target.
Examples
To give the Infinity enchantment to all players holding a bow: enchant @a 51
Note
Although /enchant enforces maximum levels and compatibility, other commands (such as /give, /replaceitem, and /entitydata) can bypass these restrictions.