Mob in distance 1.15.2

  • Im using this command:

    /execute if entity @e[type=minecraft:zombie,distance=100] run say HEY!

    ignore the say part, but I want it to detect a zombie in a radius from the command block, logically this should work right or am I just being an idiot?

  • As of 1.13, the distance you specify is no longer considered a range from 0 to the number you wrote. Instead, the command will only execute if the distance between the entity and the command block is exactly n number of blocks. So in your command, you are testing for a zombie that is exactly at the 100 block mark from the command block.

    You can specify a range by using two dots (..) before or after a number. Here is the command you should use:

    /execute if entity @e[type=minecraft:zombie,distance=..100] run say HEY!

    in this example, the two dots mean that the distance has to be lower or equal to 100. If you were to write the dots after the number (100..), that means the value has to be greater or equal to 100.

Suggested Topics