-3

I am trying to kill all entities that are not a player and a sheep called test catch but I can't use

/kill @e[type=!Player,!sheep]

so how could it be done WITHOUT scoreboard because I don't want to keep doing scoreboard for everything that deserves and that doesn't. and please don't judge me because I don't want to use scoreboard.

marked as duplicate by bearb001, Tim S., Unionhawk, Ivo Coumans, dly Jul 12 at 6:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    What's the reason you don't want to use /scoreboard? Scoreboard tags would be the best way to do this that I could think of. – SirBenet Mar 25 '17 at 19:37
  • 1
    Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins! – Frank Mar 25 '17 at 20:03
  • I swear I did, but the only things I found was using scoreboard, I don't see why everybody just dislikes the question instantly just because I don't want to use scoreboard, I don't see in the rules of the site that I must use a scoreboard – Mohannad El-Nesr Mar 25 '17 at 21:19
  • 1
    No, the rules state you have to show effort. Pigeonholing yourself with such a specific requirement, without a good reason, is going to draw downvotes; its an inane requirement, without any usefulness. You're just making life harder on yourself. – Frank Mar 25 '17 at 21:27
  • 1
    What research? You haven't shown us anything. We don't know that you did; your question doesn't show any. Its not abuse; its the entire point of down voting. – Frank Mar 25 '17 at 22:05
4

The only way without using /scoreboard is to manually target each entity type that you want to kill, being a very long list of commands (~80):

/kill @e[type=armor_stand]
/kill @e[type=skeleton]
/kill @e[type=item]
/kill @e[type=ghast]
...

Which also means that any new entities being added to the game won't be included and you'd have to manually add new /kill commands.


You should really be using /scoreboard for this. If your worry is bloating the scoreboard with objectives, then you use the "tag" feature instead. I should emphasis that the "tag" feature has essentially nothing to do with the scoreboard, and its usage with /scoreboard is misleading in that sense.

Entities have a list of generic string data that can be directly associated with them, and it just happens that /scoreboard can interact with that list. There is no relation to the scoreboard otherwise.

For example, the following greatly simplifies what the above does, and makes it future-proof:

  1. Assign a custom label to entities that you don't want to kill, provided they don't already have that label. Once again, this does not interact with the scoreboard and makes no use of objectives.

    /scoreboard players tag @e[type=player,tag=!nokill] add nokill
    /scoreboard players tag @e[type=sheep,tag=!nokill] add nokill
    
  2. Kill entities that do not have that label.

    /kill @e[tag=!nokill]
    

The result is only 3 commands versus 80+, no objectives or scoreboard interaction, and will not break in the future when new entities are added to the game.

  • thank you that really helped, I didn't know about tags – Mohannad El-Nesr Mar 25 '17 at 21:17
  • Another way to do it in one command is /execute @e[type=!Player] ~ ~ ~ /kill @e[type=!sheep,r=0] if you keep stacking the /execute command you can increase it to any number of mobs you don't want to kill. the r=0 makes it so that a player won't die if he is in a 1 block hole with 50 cows. – LethaIity Mar 28 '17 at 16:36
  • @LethaIity Unfortunately r=0 is not infallible. If there's any conflict at all with a player overlapping any entity, such as from /tp, that will kill the player. While it's a simple solution (and should probably be used instead of 80+ commands!), it does come with that unavoidable issue. The "tags" feature does not have any targeting flaws and so should be used over /execute, lest the player die unexpectedly. – Skylinerw Mar 28 '17 at 17:23
  • Ah didn't realize that. from my personal experiences and from what other people said I assumed otherwise. – LethaIity Mar 28 '17 at 17:47

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