Minecraft wiki entry for Magma_Cube, associated text: A magma cube seeks out any player or an iron golem within a spherical distance of 16 blocks. If it finds no enemy, it waits for 40 to 120 ticks (2 to 6 seconds), then changes direction by a random amount up to 57.30° (1 radian) left or right, jumps, and repeats the process. If it finds a target, the delay before jumping is 1⁄3 as long (13 to 40 ticks), and the magma cube changes direction directly toward the target before jumping.