Minecraft:Commands/enchant: Difference between revisions
More actions
Remove broken links to missing pages |
Fix template calls: add MC/ prefix |
||
| Line 20: | Line 20: | ||
== Arguments == | == Arguments == | ||
{{ | {{MC/Argument|targets|entity|player: target|CommandSelector<Actor>}} | ||
: Specifies the target(s). | : Specifies the target(s). | ||
: {{ | : {{MC/Arg desc|je=entity|amount=multiple|type=entities|be=actor}} | ||
{{ | {{MC/El|je|short=1}}: {{MC/Argument|enchantment|resource}}<br> | ||
{{ | {{MC/El|be|short=1}}: {{MC/Argument|be=1|enchantmentId: int|int}} or {{MC/Argument|enchantmentName: Enchant|enum}} | ||
: Specifies the 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. | ||
: {{ | : {{MC/Arg desc|je=resource|registry=minecraft:enchantment|be=enum}} | ||
{{ | {{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 {{ | : 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. | ||
: {{ | : {{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 == | ||
| Line 67: | Line 67: | ||
== 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 {{ | |{{HistoryLine||1.4.4|dev=pre|Added {{MC/Cmd|/enchant|link=none}}.}} | ||
|{{HistoryLine||1.13|dev=17w45a|Removed {{ | |{{HistoryLine||1.13|dev=17w45a|Removed {{MC/Cmd|enchant|link=none}}.}} | ||
|{{HistoryLine|||dev=18w06a|Re-added {{ | |{{HistoryLine|||dev=18w06a|Re-added {{MC/Cmd|enchant|link=none}}.}} | ||
|{{HistoryLine||1.19.3|dev=22w42a|{{ | |{{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 {{ | |{{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|{{ | |{{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 {{ | |{{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}} | ||
de:Befehl/enchant | de:Befehl/enchant | ||
Latest revision as of 20:09, 9 April 2026
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|}}
- REDIRECT Template:Edition
Template:Rcat: <enchantment>: resource
- 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
/enchantenforces maximum levels and compatibility, other commands (such as
- REDIRECT Template:Command
- REDIRECT Template:Command
Template:Redr, and
- 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
Bedrock Edition
References
<references group="">
</references>
External links
de:Befehl/enchant es:Comandos/enchant ja:コマンド/enchant ko:명령어/enchant lzh:令/enchant pt:Comandos/enchant ru:Команды консоли/enchant th:คำสั่ง/enchant uk:Команди консолі/enchant zh:命令/enchant