Okay while trying to make a scroll like thing that summons lightning.. I realized it targeted villagers, how can I fix this command to do that?

/execute @e[r=8,type=!Player,type=!Villager,count=-1] ~ ~ ~ /summon LightningBolt ~ ~ ~

1 Answer 1


Update for 1.13+: This now just works. type=!player,type=!villager works exactly as expected.

Old answer for 1.12: You cannot have more than one parameter with the same key name. The last one defined will be used instead.

To exclude two different entities based on type, you can assign a label separately and then target those that do not have the label.

As well, the correct parameter for maximum count is c, not count.

Example using a scoreboard team:

/scoreboard teams add Exclude

/scoreboard teams join Exclude @a @e[type=Villager]
/execute @e[r=8,team=!Exclude,c=-1] ~ ~ ~ /summon LightningBolt ~ ~ ~

Example using 1.9's "tags" feature:

/scoreboard players tag @a add Exclude
/scoreboard players tag @e[type=Villager] add Exclude
/execute @e[r=8,tag=!Exclude,c=-1] ~ ~ ~ /summon LightningBolt ~ ~ ~

You must log in to answer this question.

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