Minecraft – How to prevent the spreadplayers command from putting the zombies in trees

minecraft-commandsminecraft-java-edition

I'm using the /spreadplayers command to randomly spawn zombies around the player for an adventure map. The problem with this is that there are trees and the zombies all end up on the trees and it gets boring. I've tried every method I can think of to fix this, and they either flat out don't work, or take a lot of time to do. If someone can help with this, that would be amazing, as I've been at it for a while.

  • I'm on minecraft 16w05b
  • I've tried using /execute @e ~ ~ ~ detect /testforblock ~ ~-1 ~
  • I've tried to re-spread all entities above a certain height
  • I've tried to give anything standing on leaves or above a certain height a score

I don't know what else to try or do! — if anyone can either successfully do one of these or think of another method, please tell me!

Best Answer

I do not have a solution as to how to use the /spreadplayers command to make this work. But, another solution to your problem (if the randomness is not that important) would be using the /summon command.

If you want to scatter the zombies around manually you will have to create multiple Command blocks though, but you can just copy-paste the commands and change out the coordinates.