What's wrong with my Minecraft command? [1.18+] [duplicate]

What's wrong with my Minecraft command? [1.18+] [duplicate] - 1 + 1 = 3 Text on Black Chalkboard

This is my Minecraft command and I want to give the deity sword a name but my command doesn't work. Can you fix it?

/give @p netherite_sword{Enchantments:[{id:sharpness,lvl:5},{id:knockback,lvl:2},{id:fire_aspect,lvl:2},{id:looting,lvl:2},{id:sweeping,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]}{display:{Name:'[{"text":"Wool's Deity Sword"}]'}} 1


Best Answer

Corrected version
/give @p netherite_sword{Enchantments:[{id:sharpness,lvl:5},{id:knockback,lvl:2},{id:fire_aspect,lvl:2},{id:looting,lvl:2},{id:sweeping,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}],display:{Name:'[{"text":"Wool's Deity Sword"}]'}} 1

Like it has already been commented, always say what error you are getting, as your problem might not even be an error problem, but a "wrong" answer instead (for example, it gives you the item but no custom name).

Looking from the command, it looks like it has been parsed wrongfuly, meaning the amount of and/or order of {'s and ['s are wrong, let us expand the command and take a look:

///

By expaning, like @Fredy31 has mentioned in the comments, open this line of command in any text editor and:

  • Every time you find an opening { or [ you create a new line with enter and ident it with blank spaces with tab. Every time you have to tab, make sure to tab further than the last one.

  • If you find ,'s, simply create a new line with same ident space as the last line.

  • Every time you find a closing } or ], also create a new line but, this time, reduce the identation by one.

////

/give @p netherite_sword{          <-- Initial { as of every nbt.
    Enchantments:[                 <-- 1 [ and 1 {
        {id:sharpness,lvl:5},
        {id:knockback,lvl:2},
        {id:fire_aspect,lvl:2},
        {id:looting,lvl:2},
        {id:sweeping,lvl:3},
        {id:unbreaking,lvl:3},
        {id:mending,lvl:1}
    ]                              <-- 0 [ and 1 {
}                                  <-- 0 [ and 0 {
## Here, the game expects the next command token, that is, amount of the /give command.
## Notice how, instead, another { is opened.
{
    display:{
        Name:'[
            {"text":"Wool's Deity Sword"}
        ]'
    }
}

1

How to check if a nbt is right?

The idea begind these structures (Called json), is:

  • { } Are dictionaries, meaning they expect a group of key:value where value can be another a data (integer, string...), dictionary or a list. Each item (key:values) is separated by ,'s. They start with a { and end with }

  • [ ] are lists. They recive only a value separated by ,'s. Value, again, can be any data, dictionaries or other lists.

So what does exactly the game expect? Let's ignore what is inside Enchantments and display:

/give @p netherite_sword{
    Enchantments:[], <-- 'key' is Enchantments and values is '[]'
    display:{}       <-- 'key' is display and value is '{}'
}

1

Now, filling what is inside display and Enchantments:

/give @p netherite_sword{
    Enchantments:[
        {id:sharpness,lvl:5},
        {id:knockback,lvl:2},
        {id:fire_aspect,lvl:2},
        {id:looting,lvl:2},
        {id:sweeping,lvl:3},
        {id:unbreaking,lvl:3},
        {id:mending,lvl:1}
    ],
    display:{
        Name:'[
            {"text":"Wool's Deity Sword"}
        ]'
    }
}

1

Ps.: Even if your json is well structured, you stil have to respect the nbt tree format. Here, Name must be inside display. Both Enchantments and display stay close to the root.

{
Enchantments:[],
display:{Name:[]}
}



Pictures about "What's wrong with my Minecraft command? [1.18+] [duplicate]"

What's wrong with my Minecraft command? [1.18+] [duplicate] - Two Persons Holding Two Red Heart Shaped Balloons
What's wrong with my Minecraft command? [1.18+] [duplicate] - White Metal High-rise Viewing Deck Building
What's wrong with my Minecraft command? [1.18+] [duplicate] - Man Kissing His Woman While Holding a Red Heart Shaped Balloon



How do you duplicate items in Minecraft with commands?

So you would type /duplicate_inventory @a,s,p,e,r and it would duplicate everything in your inventory and items that don't have a space fall on the ground.

How do you get rid of clone commands in Minecraft?

However, if you are prepared for it, you can use the /clone command. You'll want to clone the part of the map (periodically) you are working on to another, far away area. Then, if you want to "undo" this, simply reverse this cycle, and clone the "backup" area into the "work" area.

What is the command to clone yourself in Minecraft?

The Repeating Command Block is a redstone-powered block that was made available in the 1.9 patch for Minecraft. The repeating command block will perform server commands over and over again when attached to a redstone circuit. This block cannot be crafted, and only server administrators are allowed to place them.



NERD SHAMES A Girl OVER BAD GRADES, What Happens Is Shocking | Dhar Mann




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: George Becker, RODNAE Productions, Pixabay, RODNAE Productions