A space for a name is now included in the /summon
command.
Let's look at the documentation for the command, specifically the syntax.
summon <entityType: EntityType> [spawnPos: x y z] [spawnEvent: string] [nameTag: string]
summon <entityType: EntityType> <nameTag: string> [spawnPos: x y z]
So looks like we can type an entity name right into the command! And it looks like we get two options for the command too!
You use the top version if you want to use a spawn event in your /summon
command. If you don't want to use a spawn event, you can use the bottom version.
For example, to replicate the JE command in the question:
/summon zombie TheUndead ~ ~ ~
If you want to use a spawn event...
/summon zombie ~ ~ ~ minecraft:as_baby TheUndead
Note though, that if your mob name contains spaces, you must surround the name with double quotes "
. If, while doing so, you need to include a double quote as part of the name, escape them with a backslash \
before each one.
/summon zombie "Hello! My name is \"The Undead\"." ~ ~ ~
Browse more workarounds for getting/setting NBT in Bedrock Edition
The BE equivalents of these tags are minecraft:can_place_on
and minecraft:can_destroy
respectively. You can use these in the /give
and /replaceitem
commands using the final [components: json]
argument. For example, the syntax of /give
is:
give <player: target> <itemName: Item> [amount: int] [data: int] [components: json]
Note that unlike Java Edition, block names go inside an array named blocks
that goes inside minecraft:can_place_on
and minecraft:can_destroy
. Like so:
give @s stone 1 0 {"minecraft:can_place_on":{"blocks":["grass","dirt"]}}
give @s netherite_axe 1 0 {"minecraft:can_destroy":{"blocks":["pumpkin"]}}
You can also combine both minecraft:can_place_on
and minecraft:can_destroy
:
give @s iron_block 1 0 {"minecraft:can_place_on":{"blocks":["iron_block"]},"minecraft:can_destroy":{"blocks":["grass","dirt"]}}
* The namespace value minecraft:
is optional and can be omitted.
This syntax is called JavaScript Object Notation (JSON), which is a format similar to the NBT used in JE commands (technically SNBT). Objects are surrounded by braces ({
and }
), have keys and values separated by colons (:
), and have key-value pairs separated by commas (,
). Keys and strings are surrounded by double quotes ("
); arrays are surrounded by brackets ([
and ]
) and contain items delimited by commas (,
).
Best Answer
You can use the
replaceitem
Info command.