Minecraft Java Edition – Command for Multiple Enchantments on One Item

minecraft-commandsminecraft-java-edition

On the official Minecraft Wiki page, it says this about mutually exclusive enchantments for swords:

Sharpness, Smite, and Bane of Arthropods are mutually exclusive. If commands are used to have two or more of these enchantments on the same item, the effects will stack.

When I use command:

/enchant <player name> <enchantment ID> <level ID>

I get this message:

Smite V can't be combined with Sharpness V

What are those commands so two or more mutually exclusive enchantments can be put on the same item?

Best Answer

/enchant restricts enchantments based on survival attainability. You can use the /give command to provide the player with an item that already contains a list of enchantments. For example, the following provides the player with a Sharpness 5 and Smite 5 sword:

/give @p minecraft:diamond_sword 1 0 {ench:[{id:16s,lvl:5s},{id:17s,lvl:5s}]}