Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/enchant: Difference between revisions

From SAS Gaming Wiki
imported>LauraFii
No edit summary
 
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
(One intermediate revision by the same user not shown)
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=[[Minecraft:Cheat]] only{{only|bedrock|short=1}}
|others=Cheat only{{only|bedrock|short=1}}
}}
}}


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.
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.


== Syntax ==
== Syntax ==
Line 20: Line 20:
== Arguments ==
== Arguments ==


{{argument|targets|entity|player: target|CommandSelector<Actor>}}
{{MC/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}}
: {{MC/Arg desc|je=entity|amount=multiple|type=entities|be=actor}}


{{el|je|short=1}}: {{argument|enchantment|resource}}<br>
{{MC/El|je|short=1}}: {{MC/Argument|enchantment|resource}}<br>
{{el|be|short=1}}: {{argument|be=1|enchantmentId: int|int}} or {{argument|enchantmentName: Enchant|enum}}
{{MC/El|be|short=1}}: {{MC/Argument|be=1|enchantmentId: int|int}} or {{MC/Argument|enchantmentName: Enchant|enum}}
: Specifies the [[Minecraft:enchantment]] to be added to the item held in main hand by the target.
: Specifies the enchantment to be added to the item held in main hand by the target.
: {{arg desc|je=resource|registry=minecraft:enchantment|be=enum}}
: {{MC/Arg desc|je=resource|registry=minecraft:enchantment|be=enum}}


{{argument|level|integer|level: int|int}}
{{MC/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 {{cmd|give}}, {{cmd|replaceitem}}, and {{cmd|data}}) can bypass these restrictions.</ref>. If not specified, defaults to 1.
: 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 {{MC/Cmd|give}}, {{MC/Cmd|replaceitem}}, and {{MC/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).
: {{MC/Arg desc|be=int|je=integer|min=0}} {{MC/In|bedrock}}, it should be between 1 and 2147483647 (inclusive).


== Result ==
== Result ==
Line 52: Line 52:
== Output ==
== Output ==


{{Output table}}
{{MC/Output table}}
{{Output table|edition=je|On fail|0|0|0}}
{{MC/Output table|edition=je|On fail|0|0|0}}
{{Output table|On success|1|1|the number of players whose items are successfully enchanted.}}
{{MC/Output table|On success|1|1|the number of players whose items are successfully enchanted.}}
{{Output table|edition=be|On fail|0}}
{{MC/Output table|edition=be|On fail|0}}
{{Output table|On success|the number of players whose items are successfully enchanted.}}
{{MC/Output table|On success|the number of players whose items are successfully enchanted.}}
{{Output table}}
{{MC/Output table}}


== Examples ==
== Examples ==


* To give the [[Minecraft:Infinity]] enchantment to all players holding a bow:
* To give the 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 [[Minecraft:Sharpness]] 5:
* To enchant the nearest player's held sword with Sharpness 5:
*: <code>/enchant @p sharpness 5</code>
*: <code>/enchant @p sharpness 5</code>


== History ==
== History ==
{{Expand section}}
{{MC/Expand section}}


=== ''Java Edition'' ===
=== ''Java Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|java}}
|{{MC/HistoryLine|java}}
|{{HistoryLine||1.4.4|dev=pre|Added {{cmd|/enchant|link=none}}.}}
|{{HistoryLine||1.4.4|dev=pre|Added {{MC/Cmd|/enchant|link=none}}.}}
|{{HistoryLine||1.13|dev=17w45a|Removed {{cmd|enchant|link=none}}.}}
|{{HistoryLine||1.13|dev=17w45a|Removed {{MC/Cmd|enchant|link=none}}.}}
|{{HistoryLine|||dev=18w06a|Re-added {{cmd|enchant|link=none}}.}}
|{{HistoryLine|||dev=18w06a|Re-added {{MC/Cmd|enchant|link=none}}.}}
|{{HistoryLine||1.19.3|dev=22w42a|{{cd|<enchantment>}} now accepts a [[Minecraft:argument types|<code>resource</code> argument]], instead of <code>item_enchantment</code>.}}
|{{HistoryLine||1.19.3|dev=22w42a|{{MC/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}}
|{{MC/HistoryLine|pocket alpha}}
|{{HistoryLine||v0.16.0|dev=build 5|Added {{cmd|enchant|link=none}}.}}
|{{HistoryLine||v0.16.0|dev=build 5|Added {{MC/Cmd|enchant|link=none}}.}}
|{{HistoryLine|bedrock}}
|{{MC/HistoryLine|bedrock}}
|{{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.20|dev=Preview 1.19.20.22|{{MC/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 {{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>}}
|{{HistoryLine||1.19.50|dev=Preview 1.19.50.20|Using the {{MC/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}}
{{MC/Reflist}}


== External links ==
== External links ==
Line 94: Line 94:


== Navigation ==
== Navigation ==
{{Navbox commands}}
{{MC/Navbox commands}}


[[Minecraft:de:Befehl/enchant]]
de:Befehl/enchant
[[Minecraft:es:Comandos/enchant]]
es:Comandos/enchant
[[Minecraft:ja:コマンド/enchant]]
ja:コマンド/enchant
[[Minecraft:ko:명령어/enchant]]
ko:명령어/enchant
[[Minecraft:lzh:令/enchant]]
lzh:令/enchant
[[Minecraft:pt:Comandos/enchant]]
pt:Comandos/enchant
[[Minecraft:ru:Команды консоли/enchant]]
ru:Команды консоли/enchant
[[Minecraft:th:คำสั่ง/enchant]]
th:คำสั่ง/enchant
[[Minecraft:uk:Команди консолі/enchant]]
uk:Команди консолі/enchant
[[Minecraft:zh:命令/enchant]]
zh:命令/enchant

Latest revision as of 20:09, 9 April 2026

Template:Infobox command

Adds an 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

Template:El<targets>: entity
Template:El: player: target: CommandSelector<Actor>

Specifies the target(s).
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|entity}}{{#vardefine:be-arg|entity}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
  1. REDIRECT Template:Edition

Template:Rcat: <enchantment>: resource

  1. REDIRECT Template:Edition

Template:Rcat: enchantmentId: int: int or <enchantmentName: Enchant>: enum

Specifies the enchantment to be added to the item held in main hand by the target.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|resource}}{{#vardefine:be-arg|{{#var:je-arg}}}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

Template:El<level>: integer
Template:El: level: int: int

Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantment<ref>Although /enchant enforces maximum levels and compatibility, other commands (such as
  1. REDIRECT Template:Command

Template:Redr,

  1. REDIRECT Template:Command

Template:Redr, and

  1. REDIRECT Template:Command

Template:Redr) can bypass these restrictions.</ref>. If not specified, defaults to 1.

{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|integer}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} in Template:Editions, 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

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|0}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|the number of players whose items are successfully enchanted.}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|the number of players whose items are successfully enchanted.}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

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

Template:Message boxTemplate:Article other

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

References

<references group="">

 </references>

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/enchant es:Comandos/enchant ja:コマンド/enchant ko:명령어/enchant lzh:令/enchant pt:Comandos/enchant ru:Команды консоли/enchant th:คำสั่ง/enchant uk:Команди консолі/enchant zh:命令/enchant