For a surefire farm, you have to be minimalist. As
wolcc says, mobs can be trapped in modified natural terrain. Here is a minimalist setup that spawns all pre-hardmode underground snow enemies and kills them very quickly.
View attachment 229942
View attachment 229943
The spawn rate is maxed out with a
Water Candle and
Jungle Seed Blocks, the spawn surface is
Snow and the PC is put in the snow biome thanks to 300 blocks around her position. As you can see, this setup is capable of getting a whole host of drops — even the exceedingly rare
Snowball Launcher. The trade-off? I’ve excavated every block within ~50 (up/down) and ~90 (left/right) of the PC.
Whatever works for you. Good luck!