5

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?

1 Answer 1

10

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.

9
  • Any idea why the skeleton selector in the question still targets everything, even if it’s not a skeleton?
    – One 2 Many
    Commented Dec 9, 2020 at 15:49
  • 3
    @ExpertCoder14 taking a guess, if I am understanding this right, looking at the wiki for entity tags, the syntax needs to be #(namespaced ID). The namespaced ID for skeletons is skeleton (not plural, where as in the OP it is). Thus because the OP is using the plural form, the condition is never met (since skeletons isn't the namespace ID), and it still kills skeletons in both cases.
    – Timmy Jim
    Commented Dec 9, 2020 at 16:04
  • 2
    @TimmyJim skeletons is in the list tho just do CTRL+F. Also you seem to be talking about the entity itself, while this is talking about tags
    – Penguin
    Commented Dec 9, 2020 at 17:11
  • 1
    @ExpertCoder14 I did a few tests to make sure it's not a bug, and both selectors worked as intended. I think the OP mixed them up or made a typo. Commented Dec 9, 2020 at 18:04
  • 1
    @MegaCrafter10 I was just confused about it, and now I know the reason why is because the "!" means "everything except this" .
    – Cyanite17
    Commented Dec 9, 2020 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .