1. Make a 5 by 5 ring of magma blocks 2. Put a mob in the centre (ex. villager) 3. Put some carpet on top of the magma
The mob walks over the carpet with magma beneath it.
The mob doesn't walk over the magma.