2

I have searched a lot about killing a mob that has two words in his name but I failed, somehow it works with testfor and doesn't with/kill:

/kill @e[name=Dragon's Minion,type=item]

Always results in this error:

Entity '@e[name=Dragon's' cannot be found

I tried every way possible but found nothing, so any help would be appreciated.

0

1 Answer 1

4

You cannot have spaces in target selectors, but you can in NBT data. You can use /scoreboard players tag to add a scoreboard tag based on NBT data, then /kill entities with that tag.

For example:

/scoreboard players tag @e[type=item] add IsCalledDragonMinion {CustomName:"Dragon's Minion"}
/kill @e[type=item,tag=IsCalledDragonMinion]

The IsCalledDragonMinion tag can be called whatever you want, so long as it's consistent.

Keep in mind that name= and CustomName will both check the dropped item entity's name, not the display name of the item itself.

6
  • your answer is appreciated but as the title said "without scoreboard" but that included it. if there is any other way it would be appreciated Commented Mar 22, 2017 at 14:07
  • @MohannadEl-Nesr Ah, missed that. There is no other way as far as I know. Why do you not want to use scoreboard?
    – SirBenet
    Commented Mar 22, 2017 at 14:25
  • The scoreboards become too much so I want to keep it for stuff that is impossible to be done without it like for example, executing anyone in X scoreboard to place ice under him in a radius of 3 if he is standing on water, there is no other way other than scoreboard to do that, but giving items scores like that isn't really that good but looks like there is no other choice, so thank you for your help :) Commented Mar 22, 2017 at 17:17
  • 1
    @MohannadEl-Nesr What do you mean by "The scoreboards become too much"? This won't add any objectives, if that's what you mean. The /scoreboard command is very useful, and is the best/only way to do a lot of things. Avoiding it will make some things very difficult/inefficient, and make other things impossible. If you're working much with commands then you'll be using /scoreboard a fair amount; I don't see much reason to avoid it.
    – SirBenet
    Commented Mar 22, 2017 at 17:31
  • 1
    @MohannadEl-Nesr This answer doesn't need any objectives; it uses tags.
    – SirBenet
    Commented Mar 24, 2017 at 21:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.