Empty syntax error on /give command
I type in /give minecraft:locater_map
, or some other /give
command, and it says
Syntax error. Unexpected ""
I keep thinking to myself: there is nothing in the quotation marks, so why do I get this error?
You must put a Target Selector
/give <target> <the item>
use @p to select the nearest player, @a for all players, @s means yourself, and @r for a random player. You can also use your name by simply writing it, but if your name contains spaces you must put quotations "" around it.
The 1st problem is, you forgot to insert a target selector between the /give
and the item ID. A target selector will specify which player to give the item to. Assuming you just want it for yourself, use @s
, which targets the executing entity.
The 2nd problem is, locator_map
is not a valid ID name. Really, a locator map is just a minecraft:map
with special data, which can't be added using commands.
But don't fret, it isn't the end of the world yet! Here's a handy trick that I've shared multiple times in the past. It's a really cool way to give someone an item with a custom name and custom enchantments. It even lets you colour the name!
Setup
- Place a chest on the floor.
- Use
/give
to give yourself the item you want. If you want to addcan_place_on
andcan_destroy
, now's the time to do it! See other questions/answers for help with using these in Bedrock Edition. - Manually enchant or rename your item. Use the section sign
§
in the anvil to colour or format your text. See the Minecraft Wiki for details on how to use it. - Place the item into the chest.
- Create a impulse command chain with 3 steps. See this post for help on creating command chains correctly.
Here are the commands you will need to put in each command block, in order. In these examples, replace ExpertCoder14
with your username (or a target selector), and coordinates 123, 456, 789 with your template chest's coordinates.
/execute ExpertCoder14 ~ ~ ~ clone 123 456 789 123 456 789 ~ ~ ~
/execute ExpertCoder14 ~ ~ ~ setblock ~ ~ ~ air 0 destroy
/execute ExpertCoder14 ~ ~ ~ kill @e[type=item,name=chest]
How it Works
- The first command will clone the chest containing the map to the entity's position.
- The second command will use the
destroy
mode of/setblock
to get rid of the chest, causing it to drop its items. - The problem is, the chest itself drops too! How can we combat this? It's simple, the 3rd command. It deletes all chest item entities before the player picks them up.
Final Notes
- If one of your items to give is a chest, it will be deleted by the 3rd command. Consider using a trapped chest instead.