Minecraft:Commands/enchant: Difference between revisions
More actions
Fix template calls: add MC/ prefix |
Sync: updated from Minecraft Tag: Manual revert |
||
| Line 4: | Line 4: | ||
* 2 {{only|java|short=1}} | * 2 {{only|java|short=1}} | ||
* 1 {{only|bedrock|short=1}} | * 1 {{only|bedrock|short=1}} | ||
|others=Cheat only{{only|bedrock|short=1}} | |others=[[Minecraft:Cheat]] only{{only|bedrock|short=1}} | ||
}} | }} | ||
Adds an enchantment to a player's selected [[Minecraft:item]], subject to the same restrictions as an anvil.<ref>{{bug|MC-261942}}</ref> Also works on any mob or entity holding a [[Minecraft:weapon]]/[[Minecraft:tool]]/[[Minecraft:armor]] in its main hand. | Adds an [[Minecraft:enchantment]] to a player's selected [[Minecraft:item]], subject to the same restrictions as an [[Minecraft:anvil mechanics|anvil]].<ref>{{bug|MC-261942}}</ref> Also works on any mob or entity holding a [[Minecraft:weapon]]/[[Minecraft:tool]]/[[Minecraft:armor]] in its main hand. | ||
== Syntax == | == Syntax == | ||
| Line 20: | Line 20: | ||
== Arguments == | == Arguments == | ||
{{ | {{argument|targets|entity|player: target|CommandSelector<Actor>}} | ||
: Specifies the target(s). | : Specifies the target(s). | ||
: {{ | : {{arg desc|je=entity|amount=multiple|type=entities|be=actor}} | ||
{{ | {{el|je|short=1}}: {{argument|enchantment|resource}}<br> | ||
{{ | {{el|be|short=1}}: {{argument|be=1|enchantmentId: int|int}} or {{argument|enchantmentName: Enchant|enum}} | ||
: Specifies the enchantment to be added to the item held in main hand by the target. | : Specifies the [[Minecraft:enchantment]] to be added to the item held in main hand by the target. | ||
: {{ | : {{arg desc|je=resource|registry=minecraft:enchantment|be=enum}} | ||
{{ | {{argument|level|integer|level: int|int}} | ||
: Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantment<ref>Although <code>/enchant</code> enforces maximum levels and compatibility, other commands (such as {{ | : Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantment<ref>Although <code>/enchant</code> enforces maximum levels and compatibility, other commands (such as {{cmd|give}}, {{cmd|replaceitem}}, and {{cmd|data}}) can bypass these restrictions.</ref>. If not specified, defaults to 1. | ||
: {{ | : {{arg desc|be=int|je=integer|min=0}} {{IN|bedrock}}, it should be between 1 and 2147483647 (inclusive). | ||
== Result == | == Result == | ||
| Line 52: | Line 52: | ||
== Output == | == Output == | ||
{{ | {{Output table}} | ||
{{ | {{Output table|edition=je|On fail|0|0|0}} | ||
{{ | {{Output table|On success|1|1|the number of players whose items are successfully enchanted.}} | ||
{{ | {{Output table|edition=be|On fail|0}} | ||
{{ | {{Output table|On success|the number of players whose items are successfully enchanted.}} | ||
{{ | {{Output table}} | ||
== Examples == | == Examples == | ||
* To give the Infinity enchantment to all players holding a bow: | * To give the [[Minecraft:Infinity]] enchantment to all players holding a bow: | ||
*: <code>/enchant @a infinity</code> | *: <code>/enchant @a infinity</code> | ||
* To enchant the nearest player's held sword with Sharpness 5: | * To enchant the nearest player's held sword with [[Minecraft:Sharpness]] 5: | ||
*: <code>/enchant @p sharpness 5</code> | *: <code>/enchant @p sharpness 5</code> | ||
== History == | == History == | ||
{{ | {{Expand section}} | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|java}} | ||
|{{HistoryLine||1.4.4|dev=pre|Added {{ | |{{HistoryLine||1.4.4|dev=pre|Added {{cmd|/enchant|link=none}}.}} | ||
|{{HistoryLine||1.13|dev=17w45a|Removed {{ | |{{HistoryLine||1.13|dev=17w45a|Removed {{cmd|enchant|link=none}}.}} | ||
|{{HistoryLine|||dev=18w06a|Re-added {{ | |{{HistoryLine|||dev=18w06a|Re-added {{cmd|enchant|link=none}}.}} | ||
|{{HistoryLine||1.19.3|dev=22w42a|{{ | |{{HistoryLine||1.19.3|dev=22w42a|{{cd|<enchantment>}} now accepts a [[Minecraft:argument types|<code>resource</code> argument]], instead of <code>item_enchantment</code>.}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|pocket alpha}} | ||
|{{HistoryLine||v0.16.0|dev=build 5|Added {{ | |{{HistoryLine||v0.16.0|dev=build 5|Added {{cmd|enchant|link=none}}.}} | ||
|{{ | |{{HistoryLine|bedrock}} | ||
|{{HistoryLine||1.19.20|dev=Preview 1.19.20.22|{{ | |{{HistoryLine||1.19.20|dev=Preview 1.19.20.22|{{cd|/enchant}} command now can be applied on mobs.<ref>{{bug|MCPE-113623||resolution=Fixed}}</ref>}} | ||
|{{HistoryLine||1.19.50|dev=Preview 1.19.50.20|Using the {{ | |{{HistoryLine||1.19.50|dev=Preview 1.19.50.20|Using the {{cd|/enchant}} command to apply the same level of enchantment no longer results in a higher level being applied.<ref>{{bug|MCPE-153204||resolution=Fixed}}</ref>}} | ||
}} | }} | ||
== References == | == References == | ||
{{ | {{Reflist}} | ||
== External links == | == External links == | ||
| Line 94: | Line 94: | ||
== Navigation == | == Navigation == | ||
{{ | {{Navbox commands}} | ||
de:Befehl/enchant | [[Minecraft:de:Befehl/enchant]] | ||
es:Comandos/enchant | [[Minecraft:es:Comandos/enchant]] | ||
ja:コマンド/enchant | [[Minecraft:ja:コマンド/enchant]] | ||
ko:명령어/enchant | [[Minecraft:ko:명령어/enchant]] | ||
lzh:令/enchant | [[Minecraft:lzh:令/enchant]] | ||
pt:Comandos/enchant | [[Minecraft:pt:Comandos/enchant]] | ||
ru:Команды консоли/enchant | [[Minecraft:ru:Команды консоли/enchant]] | ||
th:คำสั่ง/enchant | [[Minecraft:th:คำสั่ง/enchant]] | ||
uk:Команди консолі/enchant | [[Minecraft:uk:Команди консолі/enchant]] | ||
zh:命令/enchant | [[Minecraft:zh:命令/enchant]] | ||
Revision as of 11:04, 6 May 2026
Adds an Minecraft:enchantment to a player's selected Minecraft:item, subject to the same restrictions as an anvil.<ref>Template:Bug</ref> Also works on any mob or entity holding a Minecraft:weapon/Minecraft:tool/Minecraft: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
- Specifies the target(s).
- Template:Arg desc
Template:El: Template:Argument
Template:El: Template:Argument or Template:Argument
- Specifies the Minecraft:enchantment to be added to the item held in main hand by the target.
- Template:Arg desc
- Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantment<ref>Although
/enchantenforces maximum levels and compatibility, other commands (such as Template:Cmd, Template:Cmd, and Template:Cmd) can bypass these restrictions.</ref>. If not specified, defaults to 1. - Template:Arg desc Template:IN, it should be between 1 and 2147483647 (inclusive).
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table
Examples
- To give the Minecraft:Infinity enchantment to all players holding a bow:
/enchant @a infinity
- To enchant the nearest player's held sword with Minecraft:Sharpness 5:
/enchant @p sharpness 5
History
Java Edition
Bedrock Edition
References
External links
Minecraft:de:Befehl/enchant Minecraft:es:Comandos/enchant Minecraft:ja:コマンド/enchant Minecraft:ko:명령어/enchant Minecraft:lzh:令/enchant Minecraft:pt:Comandos/enchant Minecraft:ru:Команды консоли/enchant Minecraft:th:คำสั่ง/enchant Minecraft:uk:Команди консолі/enchant Minecraft:zh:命令/enchant