Minecraft – What do the “#” and “!#” mean when selecting entities

minecraft-commandsminecraft-java-edition

I've seen # and !# show up before minecraft:entity when I'm typing a command to kill or teleport all of one mob. What do they mean? I experimented with

/kill @e[type=!#minecraft:skeletons]

and

/kill @e[type=#minecraft:skeletons]

But they both end up with everything dying; not just skeletons, and it includes me. Is this a bug, or am I not using it right? Below is a picture of what I mean:

What is this?

Best Answer

Minecraft has a set of pre-defined tags (or groups) for entities, blocks, items, etc. These tags allow you to select multiple types of entities (or other mentioned types) at the same time.

The "#" prefix indicates that you are referencing a tag. For example, "#minecraft:arrows" will target all arrow types (normal arrows and spectral arrows). The exclamation mark before the "#" prefix is used in combination with the equal sign to invert the condition.

  • "=" means "is equal"
  • "=!" means "is not equal"

So "type=!#minecraft:arrows" will target every entity that is not an arrow. You can find more info about tags on this wiki page.