How to use testfor with a mob with a two-word name?

How to use testfor with a mob with a two-word name? - Metal signage with black letters saying Reserved on gray background used in cafes and restaurants

How can I test for mob who has a name with two words? For example villager named Grumpy Bill. For example I want to kill this villager.

This command

/kill @e[name=Bill]

would work just fine but when I try

/kill @e[name=Grumpy Bill]

it says "The entity UUID provided is in an invalid format"

What is the proper command for this action?



Best Answer

Use the NBT Tag "CustomName", and to make it for /kill use: /scoreboard objectives add KillSpacedName dummy KillSpacedName /scoreboard players set @e KillSpacedName 1 {CustomName:Grumpy Bill} /kill @e[score_KillSpacedName_min=1]




Pictures about "How to use testfor with a mob with a two-word name?"

How to use testfor with a mob with a two-word name? - Small signage from restaurants and cafes
How to use testfor with a mob with a two-word name? - Young troubled woman using laptop at home
How to use testfor with a mob with a two-word name? - High angle of pensive African American female freelancer in glasses and casual clothes focusing on screen and interacting with netbook while sitting at table with glass of yummy drink on cafe terrace in sunny day



How do you Testfor entities in Minecraft?

2. Type the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.




  • How to detect mobs with custom names near a player?




    More answers regarding how to use testfor with a mob with a two-word name?

    Answer 2

    I've learned that you cannot have a space between the words of the name, such as Do not touch.

    Instead you will need to fill those spaces with underscores. For example, Do_not_touch.

    Answer 3

    In commands, you can't have spaces. Use the underscore. Something like

    Grumpy_Bill

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Ryutaro Tsukata, Ryutaro Tsukata, Andrea Piacquadio, Andrea Piacquadio