I want to summon multiple Slimes, then make sure that they are never in the same block. (If it's not possible to keep them from being in the same block, having them be at least 1 block from each other would work too.)

To do this I tried nesting execute commands like this:

execute @e[type=Slime,name=explore1] ~ ~ ~ execute @e[type=Slime,name=explore1,r=0,c=1] ~ ~ ~ spreadplayers ~.5 ~.5 0 1 false @e[type=Slime,name=explore1,r=1,c=1]

But that didn't work. I also tried

execute @e[type=Slime,name=explore1] ~ ~ ~ spreadplayers ~.5 ~.5 0 1 false @e[type=Slime,name=explore1,c=1,r=0]

I figured the r=0 tag might be off but I also tried with r=1 and it still didn't work.

The first command groups all the Slimes together and randomly teleports them, and the second command just does nothing.

Any ideas on how to do this?


The following command should work:

execute @e[type=Slime,name=explore1] ~ ~ ~ spreadplayers ~ ~ 2 3 false @e[type=Slime,rm=0,r=1,name=explore1]

All slimes will try to spread nearby (r=1) slimes that aren't themselves (rm=0) a maximum of 3 blocks around them.

| improve this answer | |
  • Just be aware that rm=0 will not be able to target entities at the exact same coordinates as the slime, so if two are at the same location then they will not be targeted. /spreadplayers itself can end up placing slimes at the same location. – Skylinerw Mar 7 '16 at 18:11
  • @Skylinerw Yep, when I was testing it though it didn't seem an issue in practice, as the slimes immediately push each other apart slightly then get teleported (though it could be a problem if OP has them with NoAI). – SirBenet Mar 7 '16 at 18:31
  • I'm afraid this isn't working for me @colorfusion, the slimes never stop being spread around... I was using NoAI but it still doesn't work with it off. – A.J. Ruckman Mar 7 '16 at 20:01
  • Update: It works with NoAI off and rm=1 + r=2 in the last command, but that's not completely ideal; I really need the slimes to have NoAI. Any ideas? – A.J. Ruckman Mar 7 '16 at 20:04
  • @A.J.Ruckman Do you need to constantly check if slimes are on top of each other, or just when you summon/manually move them? There's another possible solution either way, but which one works best depends on what you're actually using the slimes for (why do they need to be never close together?). – SirBenet Mar 7 '16 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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