Give yourself a named sword
Make a diamond sword called Cave Runner in a Java world where you can use commands. Pick the version you play so Minecraft can read the item settings.
- On Item, search for diamond sword and select it. Leave Count at 1.
- On Target, pick
@sto give the sword to yourself in chat. Use@pfor the nearest player or enter a player name to send it to someone specific. - Open Name and lore and enter Cave Runner as the custom name. Open Enchantments, select Sharpness and set its level to 5.
- Press Copy above the editor and paste into Minecraft chat. Leave Include slash on for chat. Turn it off for a server console or a function.
If the command grows too long for chat, try it in a command block. When you run it there, choose a player name or a selector such as @p so the block knows who should get the item.
Give a tool for an Adventure map
Open Rules to choose which blocks an item can break or be placed on. For a pickaxe that can break two kinds of ore, enter the block IDs separated by a comma. Try the command in Adventure mode before handing the item to players.
In Bedrock Edition, the same tab lets you keep an item after death or lock it in the player's inventory. Choose Lock in slot if the item should stay in the slot where the player gets it.
Pick up where you left off
Use Save draft and Load draft to keep working in the same browser. Each save replaces the previous draft. To bring in a command you already have, pick its game version, open Import command, paste the full command and press Import. Check the edition and version shown above the editor before copying it back to the game.