You can use /clear
<player> netherite_sword -1 0
. The -1
matches all data values* and the 0
specifies the maximum number of items to clear (so none will be cleared). If the player has at least 1 netherite sword in their inventory, the command will output a success.
The success can be detected using a chain command block. Put the /clear
any command block facing a conditional, always active, chain command block with the command that you want to execute if the player has a netherite sword.
* I'm not sure if a sword has any data values (e.g. for durability) so just match all data values instead of 0
just in case.
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
Best Answer
Bedrock Edition uses data values to store the potion effect used by a potion or Tipped Arrow. To give a potion of tipped arrow with the specified effect, you use the command:
where the data value is looked up from this table:
Tipped arrows use a similar syntax:
(note: it's just
arrow
, nottipped_arrow
, unlike in Java Edition, and the data values are off by one)