How do I stop bats from spawning?

Solution 1:

You can (depending on your version) use a command block and trigger it on a one second redstone clock. You just program the block to:

/kill @e[type=nameofmobtokill]

So in your case:

/kill @e[type=bat]

There's no need for that to execute on every tick, but it's up to you to figure out how to make sure the command block remains chunk loaded (placing it at the world's spawn point should probably do it).

Credit to stef for mentioning this in an answer to a nearly identical question about accomplishing the same with endermen.

However, you can't craft command blocks, so you have to be in creative mode both to obtain and remove one, as well as make changes to their programming. They can be placed in survival, but any productive use has to be arranged through creative mode.

Without using a command block, or a mod designed to control how / when / where mobs spawn, there's no practical or effective way to accomplish it. Bats are tricky in particular because they can spawn in any single vacant block where the light level is sufficiently low. Zombies and Skeletons need at least a two-block high area in order to spawn.

You could write your own mod to prevent them from spawning, I don't think it would be entirely difficult. I'd recommend going with what's available in Forge since it's very well-maintained and supported, plus its wide-use lets lots of others enjoy your mod if you wish to share it. It'd probably be a great exercise in larning how things work, sort of like a 'hello world' mod.

Solution 2:

There's no way to ban certain mobs without banning all of them UNLESS you use a mod. I googled around a bit and found this one, but I've never used it so I can't say whether or not it works.

If you're not interested in using mods, bats only spawn in darkness, so you could try lighting up everything.