Parameters for target selectors seem to be only capable of understanding "AND" statements. For instance, @e[type=Cow,r=10] targets all entities that are both a cow AND within 10 blocks. However, OR statements are a little more tricky. Say I wanted to target anything that was either cow OR a pig, but nothing else. I'd either have to to a crap ton of NOT statements (@e[type=!Player,type=!Creeper,...] literally anything that isn't a pig or a cow), or make two commands- one for cows and one for pigs (which seems to be what most people do).
However, I think OR statements should be supported. It would increase efficiency in command creations by quite a bit, and it wouldn't have to interfere with already-existing creations. Here's how I think it should be done:
@e[type=Cow][type=Pig]
It's just a target selector with two parameter segments, each acting independently, and selected entities have to fulfill one or more of these parameters to be selected.
Other examples could be like this: @e[type=Cow,r=5][type=Pig,r=10] would select cows within 5 blocks, or pigs within 10 blocks... you get the idea. Also, the amount of segments shouldn't be limited to two, just to clarify.
This would also clean up how many command blocks you would need, and allow you to make changes easier later on down the road. Want to include sheep? Just add a command block with scoreboard players set @e[type=sheep] AnimalFilter 1.
Or just wait until 1.13, and then it will be included as the base part of the game, being able to run a command on multiple entities at the same time.
Parameters for target selectors seem to be only capable of understanding "AND" statements. For instance, @e[type=Cow,r=10] targets all entities that are both a cow AND within 10 blocks. However, OR statements are a little more tricky. Say I wanted to target anything that was either cow OR a pig, but nothing else. I'd either have to to a crap ton of NOT statements (@e[type=!Player,type=!Creeper,...] literally anything that isn't a pig or a cow), or make two commands- one for cows and one for pigs (which seems to be what most people do).
However, I think OR statements should be supported. It would increase efficiency in command creations by quite a bit, and it wouldn't have to interfere with already-existing creations. Here's how I think it should be done:
@e[type=Cow][type=Pig]
It's just a target selector with two parameter segments, each acting independently, and selected entities have to fulfill one or more of these parameters to be selected.
Other examples could be like this: @e[type=Cow,r=5][type=Pig,r=10] would select cows within 5 blocks, or pigs within 10 blocks... you get the idea. Also, the amount of segments shouldn't be limited to two, just to clarify.
That's really it. What do you think?
@e[type=!Player,type=!Creeper,...]
Planned for 1.13
What do you mean "planned for 1.13"? That already exists. What I'm suggesting is a way to NOT have to do that.
What they are saying there, is it's coming in 1.13, but they used the wrong quote in their reply.
You will be able to say @e[type=cow,type=pig] in the upcoming 1.13 update.
This means it will execute for every entity that is a cow and a pig, and nothing else.
In the meantime, you could use scoreboards to quickly sort them and test using the score. Eg:
scoreboard players set @e[type=cow] AnimalFilter 1
scoreboard players set @e[type=pig] AnimalFilter 1
execute @e[score_AnimalFilter_min=1] ~ ~ ~ [command here]
This would also clean up how many command blocks you would need, and allow you to make changes easier later on down the road. Want to include sheep? Just add a command block with scoreboard players set @e[type=sheep] AnimalFilter 1.
Or just wait until 1.13, and then it will be included as the base part of the game, being able to run a command on multiple entities at the same time.
No. @e[type=cow,type=pig] will throw an error because it mean `everything that is a cow AND a pig`