Command is spawning multiple mobs at the same time 1.13.2
My summon command summons a random amount of mobs:
/execute as @e[tag=testercom] at @e[tag=testercom] if block ~ ~ ~ lime_concrete run summon armor_stand ~ ~ ~ {Tags:["testercom","lime"]}
Why is this happening?
It's not random. You told the game to make a list of all entities with the "testercom
" tag, then do everything else as those entities. They then each make a list of all entities with the "testercom
" tag and do everything else at their location. Then they check for the block and summon the armour stands.
Example: You have one entity tagged "testercom
" at position A, one at position B and one at position C. Entity A then spawns an armour stand at positions A, B and C, then the second entity does the same, then the third (if the block matches at those locations). So if all three match, you end up with 9 new armour stands.
I recommend reading the target selector section of the Minecraft wiki page about commands (archive). Basically you multiply your command execution on every selector for all matching entities and things like execute if
filter it. Take particular notice of the @s
selector, which by itself should go a long way to fixing your problem.