I have been trying to make a minecraft map in windows 10 edition but I can't get the setbock command to work if all of the mobs in the area have been killed.

  • 2
    What do you mean all the mobs in an "area"? Could you test and see if there are no zombies in a radius from a block and then run commands, or do you have to test something else? – SpiceWeasel Jan 6 at 20:42

A solution I found is that you can do a command testfor this will test for entities:

/testfor @e[type=zombie]

This will test for all currently loaded zombies

 /testfor @e[type=zombie,(r for PE, distance for PC)=20]

This will test for all zombies within a 20 block radius. Radius is building that many blocks off the sides and connecting them to a cube. Thus displaying radius. Than have a comparator coming out of the command block and redstone repeater followed by a solid block with a redstone torch

  • 1
    As the question states, the post is for bedrock edition. Specifying that the selector r should be substituted with distance for java edition is not required, since /testfor has been replaced with /execute in the Java edition. – Jayden Jan 9 at 1:59
  • Also, please don't use testfor even in versions of Minecraft that support it unless you really know what you're doing. It should be considered to be deprecated, as its utility is almost entirely dependent on conditional command blocks, which can't be used directly in functions. There are almost always better ways to solve a problem by using something other than testfor. – MBraedley Feb 6 at 14:29

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.